dpmcore.services.data_dictionary
Read-only queries over the DPM dictionary: releases, tables, item
signatures, table versions, and item categories. Release-aware methods
accept release_id or release_code (at most one).
DataDictionaryService
- class dpmcore.services.data_dictionary.DataDictionaryService(session)[source]
Bases:
objectQuery the DPM data dictionary.
- Parameters:
session (
Session) – An open SQLAlchemy session.
- __init__(session)[source]
Build the service bound to
session.- Parameters:
session (Session)
- Return type:
None
- get_releases()[source]
Return all releases, latest first.
Ordered by the date-based sort order (see
compute_sort_order()), so an undated (unpublished) working release ranks as the latest and comes first; ties break byrelease_idfor determinism.
- get_latest_release()[source]
Return the latest release by the date-based sort order.
An undated (unpublished) working release ranks as the latest; ties break by
release_idfor determinism.
- get_tables(release_id=None, date=None, release_code=None, verbose=False)[source]
Return available tables.
When
verboseisFalse(default) returns a list of table codes. WhenverboseisTruereturns a list of dicts with{code, name, description}for each active table version.
- get_table_version(table_code, release_id=None, release_code=None)[source]
Return table version info for a given table code.
- get_open_keys_for_tables(table_codes, release_id=None, release_code=None)[source]
Return
{table_code: {property_code: data_type_code}}.Identifies the open-key (compound-key) variables of each table by walking
TableVersion→KeyComposition→VariableVersion→Property→ItemCategory(for the property code) →DataType(for the type code).
- get_open_keys_for_table(table_code, release_id=None, release_code=None)[source]
Return
{property_code: data_type_code}for one table.