Skip to content

tdfs4ds.genai.view_fingerprint

tdfs4ds.genai.view_fingerprint

When is an upstream view documented again? (0.3.7.34)

A process documentation pass walks the views below the process view. Each of them used to be regenerated whenever a pass could not read an object-level description for it - so the same access-layer view was documented by the model once per process. The decision now comes from the store: a view is documented again only when it has no documentation, when its SQL changed since the model last described it, or with force_update=True.

The SQL the model described is remembered as a fingerprint (sha256 of the normalised view text, as process_sql hashes a chain) in the reserved business-dictionary section DOC_FINGERPRINT (no new table; left out of every documentation reader like EXPOSES / ATTACHED).

FINGERPRINT_SECTION module-attribute

FINGERPRINT_SECTION = 'DOC_FINGERPRINT'

logger_safe

logger_safe(level, message, *args, **kwargs)

Wrapper around the global logger that only emits logs when tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.

fingerprint

fingerprint(ddl: str) -> str

sha256 of the normalised view text ('' for no text). Pure.

render

render(ddl: str) -> str

parse

parse(text) -> Optional[str]

The stored hash, or None. Pure.

decide

decide(documented: bool, stored_hash: Optional[str], current_hash: str, force: bool = False) -> Tuple[bool, str]

(document again?, reason). Pure.

force -> yes; no documentation -> yes; documented with no fingerprint (written before it existed, imported, or by hand) -> no; fingerprint equal -> no; the SQL changed -> yes. An unreadable view text (empty hash) never triggers a regeneration by itself.

read_hash

read_hash(db: str, obj: str) -> Optional[str]

write

write(db: str, obj: str, ddl: str) -> None

Remember the SQL the model has just described. Fail-open.

needs_documentation

needs_documentation(db: str, obj: str, ddl: Optional[str], force: bool = False) -> bool

The pipeline's decision for an upstream view (see module doc). A read failure never regenerates (it is logged): a model call overwrites documentation, so doubt means keep.