Skip to content

tdfs4ds.deploy.fingerprint

tdfs4ds.deploy.fingerprint

Normalised fingerprints of object definitions (0.3.8.15). Pure: no database, no clock.

The same object exported from one environment and read back from another must give the same fingerprint when its definition is the same, whatever the databases are called and whatever the process ids are. So a fingerprint is taken on the definition in its placeholder form (databases are {{VAR}}, processes are named by their view), and:

  • SQL goes through process_sql.normalise_sql (comments, white space, case outside literals) after process_sql.neutral_text replaced every manager the object reads by one token: a TimeManager / FilterManager moving its cursor, a literal swap (run(at=...)) or a soft clone of the domain clock is no change of definition;
  • lists whose order carries no meaning (feature names) are sorted, dict keys are sorted;
  • a manager is fingerprinted on its STRUCTURE (type, columns, calendar rule), never its contents;
  • what only the first run creates (value types, statistics) is information, not definition.

SETTING_DEFAULTS module-attribute

SETTING_DEFAULTS = {'CLOSE_ABSENT_ENTITIES': 'N', 'TRACK_ENTITY_REFRESH': 'N', 'DATASET_TIME_MANAGER': None, 'DOMAIN_ROLL_OUT': 'Y', 'DATASET_VIEW_NAME': '', 'DATASET_GROUPED': 'N', 'DATASET_JOIN_TYPE': '', 'DATASET_REBUILD_ON_CHANGE': '', 'WINDOW_LENGTH': '', 'VALID_TIME_COLUMN': '', 'FORCE_VARCHAR_LENGTH': '1024'}

DOMAIN_STATE_SETTINGS module-attribute

DOMAIN_STATE_SETTINGS = {'TIME_MANAGER', 'CALENDAR_GAPS', 'CALENDAR_CHANGE'}

_CURSOR_RE module-attribute

_CURSOR_RE = re.compile('\\bTIME_ID\\s*=\\s*\\d+', re.I)

_BY_KIND module-attribute

_BY_KIND = {'process': process_fingerprint, 'dataset': dataset_fingerprint, 'view': view_fingerprint, 'table': table_fingerprint, 'time_manager': manager_fingerprint, 'filter_manager': manager_fingerprint, 'domain': domain_fingerprint, 'glossary': glossary_fingerprint, 'documentation': documentation_fingerprint, 'requires': requires_fingerprint}

sha

sha(obj: Any) -> str

_u

_u(x) -> str

_ulist

_ulist(xs) -> List[str]

_ws

_ws(text) -> str

manager_refs

manager_refs(defn: Dict[str, Any]) -> List[Tuple[str, str]]

[(kind, '{{VAR}}.VIEW')] of the managers a definition reads (process: its time / filter manager and the domain clock; dataset: its TimeManager).

normal_sql

normal_sql(text: str, managers: Iterable[Tuple[str, str]] = ()) -> str

_settings

_settings(raw: Optional[Dict[str, Any]]) -> Dict[str, str]

process_fingerprint

process_fingerprint(d: Dict[str, Any]) -> str

_features

_features(sel) -> Dict[str, Any]

dataset_fingerprint

dataset_fingerprint(d: Dict[str, Any]) -> str

view_sql_fingerprint_text

view_sql_fingerprint_text(sql, managers=()) -> str

The normalised SQL of a view for comparison. A soft clone of a TimeManager (a view over a *_HIDDEN table) names its cursor (WHERE TIME_ID = 3): that is state, moved by every roll-out, not definition, so a deployed clone read as 'different' from the bundle (live, 0.3.8.15); the registration rewrites the clone with SELECT where the bundle has SEL.

view_fingerprint

view_fingerprint(d: Dict[str, Any]) -> str

table_body

table_body(ddl: str) -> str

The part of a CREATE TABLE that defines the table: from the column list on (table options such as FALLBACK / MAP / journaling between the name and the column list are system settings).

table_fingerprint

table_fingerprint(d: Dict[str, Any]) -> str

manager_fingerprint

manager_fingerprint(d: Dict[str, Any]) -> str

_props

_props(rows) -> list

domain_fingerprint

domain_fingerprint(d: Dict[str, Any]) -> str

glossary_fingerprint

glossary_fingerprint(d: Dict[str, Any]) -> str

documentation_parts

documentation_parts(d: Dict[str, Any]) -> Dict[str, str]

{part key: normalised text} of a documentation definition.

documentation_fingerprint

documentation_fingerprint(d: Dict[str, Any]) -> str

documentation_covered

documentation_covered(definition: Dict[str, Any], target: Optional[Dict[str, Any]]) -> bool

True when every part of definition is in target with the same text (extra target parts are allowed: a deployment never deletes documentation). Pure.

requires_fingerprint

requires_fingerprint(d: Dict[str, Any]) -> str

fingerprint

fingerprint(defn: Optional[Dict[str, Any]]) -> Optional[str]

The fingerprint of a definition (None for None). Pure.