graflo.architecture.schema.physical_keys¶
Translate document keys between logical and stored property names.
The ingestion pipeline produces documents keyed by logical property names. A
database may store some of those properties under other names, recorded in
DatabaseProfile.vertex_property_names and edge_specs[].property_names.
:class:PhysicalKeys is the one place those maps are applied to documents: the
writer translates every document and field list it hands a backend, and the
schema-aware reads (Connection.graph_neighbors / traverse) translate
their arguments in and their results back out.
With no stored names on the profile every method returns its input unchanged (the same object), so the translation costs nothing for the common case.
Attributes¶
Classes¶
PhysicalKeys
¶
Logical <-> stored name translation for one resolved profile.
Source code in graflo/architecture/schema/physical_keys.py
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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
Attributes¶
active
property
¶
Whether any property is stored under a different name.
Methods:¶
__init__(profile)
¶
Source code in graflo/architecture/schema/physical_keys.py
anchor_key(vertex, key)
¶
An anchor given as a field mapping, keyed by stored names; a raw id as-is.
Source code in graflo/architecture/schema/physical_keys.py
container(gc, edge_config)
¶
gc with every vertex and edge document keyed by stored names.
For backends that take a whole container (native bulk load). Edge keys whose schema edge cannot be found are passed through: the writer skips them the same way.
Source code in graflo/architecture/schema/physical_keys.py
edge_fields(edge_id, fields)
¶
Stored names for logical property fields of the schema edge edge_id.
Source code in graflo/architecture/schema/physical_keys.py
edge_filter(filters, edge_ids)
¶
An edge filter over the edges edge_ids, naming stored attributes.
One filter is applied to every edge a walk follows, so a property it names must be stored under one name across them; edges sharing a relation always are.
Raises:
| Type | Description |
|---|---|
ValueError
|
if a property the filter names is stored under different names on different edges. |
Source code in graflo/architecture/schema/physical_keys.py
edge_triples(edge_id, source, target, triples)
¶
(source_doc, target_doc, weights) triples keyed by stored names.
edge_id is the schema edge the triples belong to, which differs from the container key for an edge whose relation is extracted per document.
Source code in graflo/architecture/schema/physical_keys.py
logical_container(gc, edge_config)
¶
A container read from the database, keyed by logical names.
Vertex documents are translated per type. Edge rows are dicts of edge attributes (plus the endpoint keys, which are left alone); a row read through a declared inverse name is translated with its stored edge's names.
Source code in graflo/architecture/schema/physical_keys.py
logical_edge_triples(edge_id, source, target, triples)
¶
Triples read back from the database, keyed by logical names.
Source code in graflo/architecture/schema/physical_keys.py
logical_vertex_doc(vertex, doc)
¶
A document read back from the database, keyed by logical names.
vertex_doc(vertex, doc)
¶
doc keyed by stored names; doc itself when nothing is renamed.
vertex_docs(vertex, docs)
¶
vertex_fields(vertex, fields)
¶
Stored names for logical fields of vertex.
Functions:¶
schema_edge_id(edge_config, edge_id)
¶
The declared edge a container key belongs to.
An exact match first, then the relation=None edge that carries
per-document relations.