graflo.architecture.schema.db_aware¶
DB-aware projections for logical graph configs.
These wrappers materialize database-specific naming/defaults from logical
VertexConfig/EdgeConfig and DPProfile without mutating logical models.
Attributes¶
Classes¶
EdgeConfigDBAware
¶
DB-aware projection wrapper for EdgeConfig.
Source code in graflo/architecture/schema/db_aware.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
Attributes¶
db_profile = database_features
instance-attribute
¶
edges
property
¶
ingestion_overlay = ingestion_overlay
instance-attribute
¶
logical = logical
instance-attribute
¶
vertex_config = vertex_config
instance-attribute
¶
vertices
property
¶
Methods:¶
__init__(logical, vertex_config, database_features, ingestion_overlay=None)
¶
Source code in graflo/architecture/schema/db_aware.py
__iter__()
¶
compile_identity_indexes()
¶
Source code in graflo/architecture/schema/db_aware.py
effective_weights(edge)
¶
Source code in graflo/architecture/schema/db_aware.py
items()
¶
relation_dbname(edge)
¶
Source code in graflo/architecture/schema/db_aware.py
relationship_merge_property_names(edge)
¶
Relationship properties that, with the endpoints, key an edge (per backend).
An edge is keyed by its endpoints and relation. The first logical
identities key adds the properties it names, which is how parallel
edges between the same two vertices stay distinct; every other property
is written, never matched on. Additional identities keys are
compiled into separate indexes via :meth:compile_identity_indexes but
do not change the writer's key. Without identities the list is empty.
Source code in graflo/architecture/schema/db_aware.py
runtime(edge)
¶
Source code in graflo/architecture/schema/db_aware.py
EdgeIngestionOverlay
¶
Bases: Protocol
Ingestion-only signals that affect DB projection (e.g. TigerGraph DDL).
Source code in graflo/architecture/schema/db_aware.py
EdgeRuntime
dataclass
¶
Resolved DB-facing runtime data for one logical edge.
Source code in graflo/architecture/schema/db_aware.py
Attributes¶
db_profile
instance-attribute
¶
edge
instance-attribute
¶
edge_id
property
¶
effective_relation_field
instance-attribute
¶
relation_name
instance-attribute
¶
source_storage
instance-attribute
¶
store_extracted_relation_as_weight
instance-attribute
¶
target_storage
instance-attribute
¶
Methods:¶
__init__(edge, source_storage, target_storage, relation_name, store_extracted_relation_as_weight, effective_relation_field, db_profile)
¶
graph_name(*, purpose=None)
¶
physical_variants()
¶
storage_name(*, purpose=None)
¶
Source code in graflo/architecture/schema/db_aware.py
SchemaDBAware
dataclass
¶
DB-aware schema runtime view.
Source code in graflo/architecture/schema/db_aware.py
VertexConfigDBAware
¶
DB-aware projection wrapper for VertexConfig.
Source code in graflo/architecture/schema/db_aware.py
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 252 253 254 255 256 257 258 259 260 261 262 263 | |
Attributes¶
assigned_vertices
property
¶
blank_vertices
property
¶
db_profile = database_features
instance-attribute
¶
hash_identity_vertices
property
¶
logical = logical
instance-attribute
¶
vertex_set
property
¶
vertices
property
¶
Methods:¶
__init__(logical, database_features)
¶
compile_secondary_identity_indexes()
¶
Register a lookup index for every declared secondary identity.
has_vertex(name)
¶
identity_fields(vertex_name)
¶
Source code in graflo/architecture/schema/db_aware.py
index(vertex_name)
¶
Get primary index for a vertex (DB layer needs Index for collection setup).
is_assigned(name)
¶
is_blank(name)
¶
is_hash_identity(name)
¶
match_fields(vertex_name, selector)
¶
Fields an edge endpoint is matched on, with DB-aware identity fallback.
Source code in graflo/architecture/schema/db_aware.py
properties(vertex_name)
¶
Source code in graflo/architecture/schema/db_aware.py
property_names(vertex_name)
¶
secondary_identities(vertex_name)
¶
WeightConfig
¶
Bases: ConfigBaseModel
Configuration for edge weights and relationships.
This class manages the configuration of weights and relationships for edges, including source and target field mappings.
Attributes:
| Name | Type | Description |
|---|---|---|
vertices |
list[Weight]
|
List of weight configurations |
direct |
list[Field]
|
List of direct field mappings. Can be specified as strings, Field objects, or dicts. Will be normalized to Field objects by the validator. After initialization, this is always list[Field] (type checker sees this). |
Examples:
>>> # Typed fields: list of Field objects
>>> wc2 = WeightConfig(direct=[
... Field(name="date", type="DATETIME"),
... Field(name="weight", type="FLOAT")
... ])
>>> # From dicts (e.g., from YAML/JSON)
>>> wc3 = WeightConfig(direct=[
... {"name": "date", "type": "DATETIME"},
... {"name": "weight"} # defaults to None type
... ])
Source code in graflo/architecture/schema/db_aware.py
Attributes¶
direct = PydanticField(default_factory=list, description='Direct edge attributes (field names, Field objects, or dicts). Normalized to Field objects.')
class-attribute
instance-attribute
¶
direct_names
property
¶
Get list of direct field names (as strings).
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: List of field names |
vertices = PydanticField(default_factory=list, description='List of weight definitions for vertex-based edge attributes.')
class-attribute
instance-attribute
¶
Methods:¶
Functions:¶
compile_secondary_identity_indexes(vertex_config, db_profile)
¶
Register a lookup index for every declared secondary identity.
Endpoint resolution filters on these fields, so the index is what keeps the lookup from degrading into a scan — and on NebulaGraph a tag index is required outright for the property lookup to run at all.
Indexes are non-unique: secondary identities are softly unique, and asking the database to enforce uniqueness would reject exactly the duplicate data the ambiguity policy exists to handle.
Called from :meth:Schema.finish_init so the profile is populated for every
backend, including those whose index definition does not go through
:meth:Schema.resolve_db_aware.
Source code in graflo/architecture/schema/db_aware.py
edge_identity_index(identity_key, db_flavor)
¶
The index an edge identities key compiles to on db_flavor, or None.
Logical uniqueness is always (source, *relationship_fields, target).
- ArangoDB — Edge documents carry
_from/_to. Unique persistent indexes must include them before other fields, even when the YAMLidentitiesentry lists only relationship tokens (e.g._role). - Neo4j, FalkorDB, Memgraph, Nebula — Indexed columns are relationship /
edge-type properties only; they cannot express endpoint scope. We still
register the property fields for lookups but set
unique=Falseso the database is not asked to enforce a misleading global uniqueness on those properties alone. (Application MERGE / ingest semantics remain authoritative.) - TigerGraph, PostgreSQL — Uniqueness is kept on the index; neither builds it (TigerGraph has no edge indexes, the PostgreSQL edge key covers it).
Source code in graflo/architecture/schema/db_aware.py
relationship_merge_properties(edge, db_flavor)
¶
Relationship properties that, with the endpoints, key edge on db_flavor.
See :meth:EdgeConfigDBAware.relationship_merge_property_names; needs no
db-aware projection, only the edge's first identities key.