dependencies.py
Dependencies
¶
Bases: nx.DiGraph
The graph of dependencies (foreign keys) between loaded tables.
Note: the 'connection' argument should normally be supplied; Empty use is permitted to facilitate use of networkx algorithms which internally create objects with the expectation of empty constructors. See also: https://github.com/datajoint/datajoint-python/pull/443
Source code in datajoint/dependencies.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 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 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
ancestors(full_table_name)
¶
:param full_table_name: In form schema
.table_name
:return: all dependent tables sorted in topological order. Self is included.
Source code in datajoint/dependencies.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
children(table_name, primary=None)
¶
:param table_name: schema
.table
:param primary: if None, then all children are returned. If True, then only foreign keys composed of
primary key attributes are considered. If False, the only foreign keys including at least one non-primary
attribute are considered.
:return: dict of tables referencing the table through foreign keys
Source code in datajoint/dependencies.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
descendants(full_table_name)
¶
:param full_table_name: In form schema
.table_name
:return: all dependent tables sorted in topological order. Self is included.
Source code in datajoint/dependencies.py
164 165 166 167 168 169 170 171 172 173 |
|
load(force=True)
¶
Load dependencies for all loaded schemas. This method gets called before any operation that requires dependencies: delete, drop, populate, progress.
Source code in datajoint/dependencies.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 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 |
|
parents(table_name, primary=None)
¶
:param table_name: schema
.table
:param primary: if None, then all parents are returned. If True, then only foreign keys composed of
primary key attributes are considered. If False, the only foreign keys including at least one non-primary
attribute are considered.
:return: dict of tables referenced by the foreign keys of table
Source code in datajoint/dependencies.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
unite_master_parts(lst)
¶
re-order a list of table names so that part tables immediately follow their master tables without breaking
the topological order.
Without this correction, a simple topological sort may insert other descendants between master and parts.
The input list must be topologically sorted.
:example:
unite_master_parts(
['s
.a
', 's
.a__q
', 's
.b
', 's
.c
', 's
.c__q
', 's
.b__q
', 's
.d
', 's
.a__r
']) ->
['s
.a
', 's
.a__q
', 's
.a__r
', 's
.b
', 's
.b__q
', 's
.c
', 's
.c__q
', 's
.d
']
Source code in datajoint/dependencies.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|