Skip to content

Business dictionary

Three temporal tables store business-oriented descriptions for any database object, its columns, and its sections. They form a 3-level hierarchy designed for chunking-free hierarchical RAG.

Level Table Key Extra columns
0 FS_BUSINESS_DICTIONARY_OBJECTS (DATABASE_NAME, OBJECT_NAME) OBJECT_TYPE CHAR(1) ('T'/'V'/'D'), BUSINESS_DESCRIPTION
1 FS_BUSINESS_DICTIONARY_SECTIONS (DATABASE_NAME, OBJECT_NAME, SECTION_NAME) SECTION_CONTENT VARCHAR(32000)
2 FS_BUSINESS_DICTIONARY_COLUMNS (DATABASE_NAME, TABLE_NAME, COLUMN_NAME) BUSINESS_DESCRIPTION

All three are VALIDTIME temporal — every write uses CURRENT VALIDTIME MERGE, so the full history of descriptions is preserved.

Provisioning

The tables are created automatically by tdfs4ds.setup() and tdfs4ds.connect(create_if_missing=True). Override the default names via keyword arguments to connect:

tdfs4ds.connect(
    database = 'my_db',
    documentation_business_dictionary_objects = 'MY_BIZ_OBJECTS',
    documentation_business_dictionary_columns = 'MY_BIZ_COLUMNS',
)

Populating without an LLM

To document one feature, process or dataset by hand, use the set_*_documentation functions in Writing documentation by hand. They write every place a description is read from, copy feature descriptions to datasets, and protect the text from later LLM runs. The loaders below suit a bulk load of an existing data dictionary; since 0.3.2.1 their rows are tagged imported and are kept by LLM runs (source=None records nothing).

import pandas as pd
from tdfs4ds.genai import (
    upload_business_dictionary_objects,
    upload_business_dictionary_columns,
    upload_business_dictionary_sections,
)

# Level 0 — objects
upload_business_dictionary_objects(pd.DataFrame([
    {
        'DATABASE_NAME'       : 'MY_DB',
        'OBJECT_NAME'         : 'CUSTOMER',
        'OBJECT_TYPE'         : 'T',
        'BUSINESS_DESCRIPTION': 'Core customer table — one row per enrolled customer.',
    },
    {
        'DATABASE_NAME'       : 'MY_DB',
        'OBJECT_NAME'         : 'V_CUSTOMER_ORDERS',
        'OBJECT_TYPE'         : 'V',
        'BUSINESS_DESCRIPTION': 'Business view joining customers with their order history for reporting.',
    },
]))

# Level 1 — sections
upload_business_dictionary_sections(pd.DataFrame([
    {
        'DATABASE_NAME'  : 'MY_DB',
        'OBJECT_NAME'    : 'DS_CUSTOMER_SPEND',
        'SECTION_NAME'   : 'OVERVIEW',
        'SECTION_CONTENT': 'Customer-level analytical dataset combining spend metrics …',
    },
]))

# Level 2 — columns
upload_business_dictionary_columns(pd.DataFrame([
    {
        'DATABASE_NAME'       : 'MY_DB',
        'TABLE_NAME'          : 'CUSTOMER',
        'COLUMN_NAME'         : 'CUSTOMER_ID',
        'BUSINESS_DESCRIPTION': 'Unique customer identifier assigned at enrolment.',
    },
    {
        'DATABASE_NAME'       : 'MY_DB',
        'TABLE_NAME'          : 'CUSTOMER',
        'COLUMN_NAME'         : 'BIRTH_DATE',
        'BUSINESS_DESCRIPTION': 'Customer date of birth, used for age-band segmentation.',
    },
]))

All three functions:

  • Validate that the required columns are present and raise ValueError with the list of missing columns if not.
  • Use CURRENT VALIDTIME MERGE — re-running them updates existing descriptions and preserves history.
  • Require no LLM — provide whatever text you want.

How LLM documentation populates the dictionary

Call What it writes to the dictionary
document_process Mirrors the process's entity description into FS_BUSINESS_DICTIONARY_OBJECTS (OBJECT_TYPE='V', the process view) and the feature descriptions into FS_BUSINESS_DICTIONARY_COLUMNS. The business logic stays in FS_PROCESS_DOCUMENTATION_BUSINESS_LOGIC. Parts imported or written by a person are kept.
document_dataset_incremental Writes OBJECT_TYPE='D' into FS_BUSINESS_DICTIONARY_OBJECTS, the five generated sections into FS_BUSINESS_DICTIONARY_SECTIONS, and propagated column docs into FS_BUSINESS_DICTIONARY_COLUMNS.
document_feature_store_incremental Calls both of the above for every catalogued process and dataset.

Why a sections table

A common RAG mistake is to store one giant text blob per object and rely on embedding-time chunking. With a (OBJECT_NAME, SECTION_NAME) key, every section is independently embeddable and retrievable. The consumer agent uses this granularity: it returns the right section for the asked intent (OVERVIEW for "summary", BUSINESS_QUESTIONS for "what can I ask about …", etc.) without ever splitting a section in the middle.

Sections: who writes them, who reads them

A section is a titled block of prose about one object (SECTION_NAME, up to 32,000 characters in SECTION_CONTENT). It holds what a one-line description or a column note cannot: what a dataset is for, its themes, the questions it answers, where a table comes from.

Who writes them

Writer Objects Sections
The LLM (document_dataset_incremental, called by build_dataset(document=True), upload_features, rebuild_documentation() and the app's Documentation actions) datasets only OVERVIEW, ENTITY, FEATURE_THEMES, BUSINESS_QUESTIONS, INTENDED_AUDIENCE, grounded in the documentation of the dataset's processes and features
A person any object any name
The package, as copies a view that exposes one table; a TimeManager clone the source's sections, marked PROPAGATED and recopied when the source changes
The package, as storage historian tables, attached or exposing views, feature groups the reserved sections below

No LLM writes sections for processes, views or source tables. A process's prose is its business logic and its feature descriptions (set_process_documentation). A source table's sections come from a person or from a data dictionary you already have.

A person writes sections in several ways:

  • tdfs4ds.set_dataset_documentation('DB.DATASET', sections={...}) for a dataset;
  • tdfs4ds.set_object_documentation('DB', 'TABLE', sections={...}) for any table or view;
  • upload_business_dictionary_sections(df) to load many at once;
  • the documentation workbook (Export the documentation, then import);
  • in the app, Documentation → Objects → Edit documentation.

These writes are marked MANUAL or IMPORTED, and an LLM run never overwrites them: it keeps them and uses them as context. release_manual_documentation hands a section back to the LLM.

What to write, per object

Object Advice
Dataset Let the LLM generate the five sections, then correct the ones that matter (usually BUSINESS_QUESTIONS and INTENDED_AUDIENCE). Your edits survive later runs.
Source table Write them yourself, since nothing else will. Useful names: SOURCE_SYSTEM, REFRESH, DATA_QUALITY, KNOWN_ISSUES. Everything built on the table benefits.
Process No sections: use its business logic and feature descriptions.
View that exposes a table Nothing: the table's sections are copied to it.

Name custom sections in upper case without spaces, like the standard ones.

Reserved sections

DEEP_LAYOUT, ATTACHED, EXPOSES and FEATURE_GROUPS hold JSON that the package writes (set_deep_table_documentation, attach_objects, exposed views, the consumer agent's feature groups). Every reader skips them. Never use these names for prose.

Who reads them

  • The consumer agent: its search reads sections, and its answers about a dataset are built from them.
  • The vector index: it has a sections collection, so a question such as "which dataset helps with churn?" can find a dataset through its BUSINESS_QUESTIONS.
  • The LLM, when it documents what reads this object: a table's sections are context for the views and processes built on it.
  • Documentation → Coverage in the app: it shows a dataset without its standard sections as partial, and an undocumented source table as missing.
  • The documentation and feature catalog exports.

Glossary of terms and acronyms

Acronyms are company knowledge that no column dictionary carries, and a model left alone expands them with a plausible wrong meaning, differently from one object to the next. The glossary keeps them once, per store and optionally per data domain (a domain entry wins over the store one).

import tdfs4ds

tdfs4ds.set_glossary_term('ABC', 'alpha beam coupler', synonyms=['alpha coupler'], author='A. Martin')
tdfs4ds.import_glossary('glossary.xlsx', dry_run=False)   # columns TERM, MEANING, SYNONYMS, DATA_DOMAIN, NOTES
tdfs4ds.get_glossary()

# One term in several data domains (one row per domain, one request); a DATA_DOMAIN cell of an import
# may hold "CLAIMS, PHARMACY". Objects outside the store use the terms of the domain(s) whose processes read them.
tdfs4ds.set_glossary_term('ABC', 'alpha beam coupler', data_domain=['CLAIMS', 'PHARMACY'])

It is stored in the optional valid-time table FS_GLOSSARY (history kept), as MANUAL or IMPORTED terms with the author and the database user. Documentation generation gives the model the terms found in an object's name, columns and SQL, with the rule never to expand an acronym that is not in the glossary, and replaces a generated expansion that contradicts the glossary (a WARNING names it). The consumer agent answers "what does ABC mean?" from the glossary and gives the terms of a question to the model. plan_migration lists the terms and migrate_objects copies the ones the target lacks. The documentation coverage report lists acronyms of object and column names the glossary does not know. With no glossary, nothing changes.

From Python every operation previews first: set_glossary_term(..., dry_run=True), remove_glossary_term(term, data_domain=None, dry_run=True), import_glossary(path, dry_run=True) (new, changed, unchanged and skipped rows; an import never deletes), export_glossary('glossary.xlsx'). A store-wide term has no data domain.

In the app, Documentation › Glossary lists the terms in force, with a text filter and a data-domain filter; terms of a read-only attached store are shown but cannot be changed there. The engineer and admin profiles can add, change or remove a term (term, data domain or all domains, meaning, synonyms, notes, and their name, recorded as the author): Preview shows what would be written and the meaning it replaces, Confirm writes it. Import reads an XLSX or CSV (columns TERM, MEANING, optionally SYNONYMS, DATA_DOMAIN, NOTES) and shows the plan before writing; Export downloads the same layout. Removing a term ends it; its history stays readable at a past valid time. If FS_GLOSSARY does not exist yet, the tab says so: setup() or connect() creates it.

A term is valid from the time it is written, like all metadata: the glossary describes the store as it is now, and documentation generation and the agent read it at the current time, whatever business date a question or a dataset uses. valid_from= gives an explicit start (for a store audited AS OF past dates), and a change to an existing term keeps the previous meaning as history. The sanity check glossary reports a term valid from a future time; tdfs4ds.backdate_glossary() (preview by default) remains as an opt-in repair for an audit read at past dates, not needed by the agent. The app never writes history.