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
ValueErrorwith 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
sectionscollection, so a question such as "which dataset helps with churn?" can find a dataset through itsBUSINESS_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.