dpmcore.connection
Connection management for standalone library usage.
DpmConnection
- class dpmcore.connection.DpmConnection(url, pool_config=None)[source]
Bases:
objectA connection to a DPM database.
Holds a SQLAlchemy engine + session and exposes services through the
servicesaccessor.- Parameters:
- property orm: Session
Direct access to the SQLAlchemy session.
Use for advanced ORM queries that bypass the service layer.
- validate_schema()[source]
Run a shallow shape + data-sanity check on the database.
Reflects the engine, compares against the dpmcore ORM metadata (case-insensitively), and probes a small set of canonical seed tables for non-emptiness. Designed to be cheap (tens of milliseconds on a real DPM database) — not a deep audit.
- Return type:
SchemaValidationResult- Returns:
A
SchemaValidationResultwith the discrepancies. An empty or non-DPM database returns a result withis_valid=Falserather than raising.
connect
- dpmcore.connection.connect(url, pool_config=None)[source]
Open a connection to a DPM database.
- Parameters:
- Return type:
- Returns:
A
DpmConnectioninstance.