populate_all_common.py
log_insert_error(table, err, error_constants=None)
¶
Log a given error to the InsertError table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
table
|
str
|
The table name where the error occurred. |
required |
err
|
Exception
|
The exception that was raised. |
required |
error_constants
|
dict
|
Dictionary with keys for dj_user, connection_id, and nwb_file_name. Defaults to checking dj.conn and using "Unknown" for nwb_file_name. |
None
|
Source code in src/spyglass/common/populate_all_common.py
single_transaction_make(tables, nwb_file_name, raise_err=False, error_constants=None)
¶
For each table, run the make
method directly instead of populate
.
Requires allow_direct_insert
set to True within each method. Uses
nwb_file_name search table key_source for relevant key. Currently assumes
all tables will have exactly one key_source entry per nwb file.
Source code in src/spyglass/common/populate_all_common.py
populate_all_common(nwb_file_name, rollback_on_fail=False, raise_err=False)
¶
Insert all common tables for a given NWB file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nwb_file_name
|
str
|
The name of the NWB file to populate. |
required |
rollback_on_fail
|
bool
|
If True, will delete the Session entry if any errors occur. Defaults to False. |
False
|
raise_err
|
bool
|
If True, will raise any errors that occur during population. Defaults to False. This will prevent any rollback from occurring. |
False
|
Returns:
Type | Description |
---|---|
List
|
A list of keys for InsertError entries if any errors occurred. |
Source code in src/spyglass/common/populate_all_common.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|