Skip to content

Python API

Catalog

python
Catalog(
    *,
    app_path=None,
    metadata_path=None,
    depth="value",
    refresh=False,
    freq_threshold=100,
    auto_enumerations=True,
    csv_encoding=None,
    sample_size=100_000,
    preview_rows=100,
    csv_skip_copy=False,
    app_config=None,
    quiet=False,
    verbose=False,
    log_file=None,
)
AttributeTypeDescription
app_pathstr | Path | NonePath for standalone app export; if it already contains data/db, it is reused for incremental scans
metadata_pathstr | Path | list[str | Path] | NoneMetadata source folder, database URI, or list of sources
depth"dataset" | "variable" | "stat" | "value"Default scan depth (default: "value")
refreshboolForce full rescan ignoring cache (default: False)
freq_thresholdintMax distinct values for frequency and automatic enumeration detection. Strings above this threshold get pattern frequencies instead
auto_enumerationsboolCreate automatic enumerations from value frequencies and attach them to variables (default: True)
csv_encodingstr | NoneDefault CSV encoding (utf-8, cp1252, etc.)
sample_sizeint | NoneDefault sample size for frequency and automatic enumeration detection (default: 100_000)
preview_rowsint | Literal[False]Default max rows exported in dataset previews at stat/value depth (default: 100; 0 or false disables)
csv_skip_copyboolSkip UTF-8 temp copy for local CSV (default: False)
app_configdict[str, str] | NoneKey-value config for the web app
quietboolSuppress progress logging (default: False)
verboseboolShow full tracebacks on errors (default: False)
log_filestr | Path | NoneWrite full scan log to file (truncated each run)
folderTable[Folder]Folder table (.all(), .count, .get_by(...))
datasetTable[Dataset]Dataset table
variableTable[Variable]Variable table
enumerationTable[Enumeration]Enumeration table
valueTable[Value]Enumeration value table
frequencyTable[Frequency]Frequency table (computed)
organizationTable[Organization]Organization table
tagTable[Tag]Tag table
docTable[Doc]Document table
conceptTable[Concept]Business glossary concept table
configTable[Config]Web app config key-value table

Catalog.add_folder()

python
catalog.add_folder(
    path,
    metadata=None,
    *,
    depth=None,
    include=None,
    exclude=None,
    recursive=True,
    csv_encoding=None,
    sample_size=None,
    auto_enumerations=None,
    preview_rows=None,
    csv_skip_copy=None,
    storage_options=None,
    refresh=None,
    quiet=None,
    time_series=True,
    create_folders=True,
    on_unmatched="warn",
)
ParameterTypeDefaultDescription
pathstr | Path | list[str | Path]requiredDirectory or list of directories to scan
metadataEntityMetadata | NoneNoneIdentity, parent linkage, and metadata for the root folder
depth"dataset" | "variable" | "stat" | "value" | NoneNoneScan depth (uses catalog.depth if None)
includelist[str] | NoneNoneGlob patterns to include
excludelist[str] | NoneNoneGlob patterns to exclude
recursiveboolTrueScan subdirectories
csv_encodingstr | NoneNoneOverride CSV encoding
sample_sizeint | NoneNoneSample rows for frequency and automatic enumeration detection (overrides catalog)
auto_enumerationsbool | NoneNoneCreate automatic enumerations from value frequencies for this folder (overrides catalog)
preview_rowsint | Literal[False] | NoneNoneMax preview rows for datasets found in this folder (overrides catalog; 0 or false disables)
csv_skip_copybool | NoneNoneSkip UTF-8 temp copy (overrides catalog)
storage_optionsdict | NoneNoneOptions for remote storage (passed to fsspec)
refreshbool | NoneNoneForce rescan (overrides catalog setting)
quietbool | NoneNoneOverride catalog quiet setting
time_seriesboolTrueGroup files with temporal patterns
create_foldersboolTrueIf False, do not create folders from disk; rely on metadata_path for structure (metadata-first)
on_unmatched"skip" | "warn" | "error""warn"Policy when a scanned file has no metadata match (only when create_folders=False)

Catalog.add_dataset()

python
catalog.add_dataset(
    path,
    *,
    metadata=None,
    depth=None,
    csv_encoding=None,
    sample_size=None,
    auto_enumerations=None,
    preview_rows=None,
    csv_skip_copy=None,
    storage_options=None,
    refresh=None,
    quiet=None,
)
ParameterTypeDefaultDescription
pathstr | Path | list[str | Path]requiredFile(s) or partitioned directory (local/remote)
metadataEntityMetadata | NoneNoneDataset identity, parent linkage, and metadata
depth"dataset" | "variable" | "stat" | "value" | NoneNoneScan depth (uses catalog.depth if None)
csv_encodingstr | NoneNoneOverride CSV encoding
sample_sizeint | NoneNoneSample rows for frequency and automatic enumeration detection (overrides catalog)
auto_enumerationsbool | NoneNoneCreate automatic enumerations from value frequencies for this dataset (overrides catalog)
preview_rowsint | Literal[False] | NoneNoneMax preview rows for this dataset (overrides catalog; 0 or false disables)
csv_skip_copybool | NoneNoneSkip UTF-8 temp copy (overrides catalog)
storage_optionsdict | NoneNoneOptions for remote storage (passed to fsspec)
refreshbool | NoneNoneForce rescan (overrides catalog setting)
quietbool | NoneNoneOverride catalog quiet setting

Catalog.add_database()

python
catalog.add_database(
    connection,
    metadata=None,
    *,
    depth=None,
    schema=None,
    include=None,
    exclude=None,
    sample_size=None,
    auto_enumerations=None,
    preview_rows=None,
    group_by_prefix=True,
    prefix_min_tables=2,
    time_series=True,
    storage_options=None,
    refresh=None,
    quiet=None,
    oracle_client_path=None,
    ssh_tunnel=None,
)
ParameterTypeDefaultDescription
connectionstr | ibis.BaseBackendrequiredConnection string or ibis backend object
metadataEntityMetadata | NoneNoneIdentity, parent linkage, and metadata for the root folder
depth"dataset" | "variable" | "stat" | "value" | NoneNoneScan depth (uses catalog.depth if None)
schemastr | list[str] | NoneNoneSchema(s) to scan
includelist[str] | NoneNoneGlob patterns matched against table names to include
excludelist[str] | NoneNoneGlob patterns matched against table names to exclude
sample_sizeint | NoneNoneSample rows for frequency and automatic enumeration detection (overrides catalog)
auto_enumerationsbool | NoneNoneCreate automatic enumerations from value frequencies for scanned tables (overrides catalog)
preview_rowsint | Literal[False] | NoneNoneMax preview rows for scanned table datasets (overrides catalog; 0 or false disables)
group_by_prefixbool | strTrueGroup tables by prefix into subfolders
prefix_min_tablesint2Min tables to form a prefix group
time_seriesboolTrueDetect temporal table patterns
storage_optionsdict | NoneNoneOptions for remote SQLite/GeoPackage
refreshbool | NoneNoneForce rescan (overrides catalog setting)
quietbool | NoneNoneOverride catalog quiet setting
oracle_client_pathstr | NoneNonePath to Oracle Instant Client libraries
ssh_tunneldict | NoneNoneSSH tunnel config (host, user, port, etc.)

Catalog.add_geodatabase()

python
catalog.add_geodatabase(
    path,
    metadata=None,
    *,
    depth=None,
    include=None,
    exclude=None,
    auto_enumerations=None,
    preview_rows=None,
    quiet=None,
    refresh=None,
    storage_options=None,
)
ParameterTypeDefaultDescription
pathstr | PathrequiredPath or remote URL of the .gdb directory
metadataEntityMetadata | NoneNoneIdentity, parent linkage, and metadata for the container folder
depth"dataset" | "variable" | "stat" | "value" | NoneNoneScan depth (uses catalog.depth if None)
includelist[str] | NoneNoneGlob patterns matched against layer names to include
excludelist[str] | NoneNoneGlob patterns matched against layer names to exclude
auto_enumerationsbool | NoneNoneCreate automatic enumerations from value frequencies for scanned layers (overrides catalog)
preview_rowsint | Literal[False] | NoneNoneMax preview rows for scanned layer datasets (overrides catalog; 0 or false disables)
quietbool | NoneNoneOverride catalog quiet setting
refreshbool | NoneNoneForce rescan (overrides catalog setting)
storage_optionsdict | NoneNoneOptions for remote storage (passed to fsspec)

Catalog.export_db()

python
catalog.export_db(
    output_dir=None,
    *,
    track_evolution=True,
    copy_assets=None,
    base_dir=None,
    export_size_report=False,
    quiet=None,
)
ParameterTypeDefaultDescription
output_dirstr | Path | NoneNoneOutput directory (uses app_path if None)
track_evolutionboolTrueTrack changes between exports
copy_assetsdict | list[dict] | NoneNoneCopy extra local files/directories into the export using the same rules as copy_assets()
base_dirstr | Path | NoneNoneBase directory for relative copy_assets.from paths (defaults to current working directory)
export_size_reportboolFalsePrint a per-table export size report, including estimated gzipped .json sizes
quietbool | NoneNoneOverride catalog quiet setting

Exports JSON metadata files. Calls finalize() automatically when data has been scanned.

Catalog.export_app()

python
catalog.export_app(
    output_dir=None,
    *,
    open_browser=False,
    track_evolution=True,
    update_app=False,
    copy_assets=None,
    base_dir=None,
    export_size_report=False,
    quiet=None,
)
ParameterTypeDefaultDescription
output_dirstr | Path | NoneNoneOutput directory (uses app_path if None)
open_browserboolFalseOpen app in browser after export
track_evolutionboolTrueTrack changes between exports
update_appboolFalseRefresh bundled front-end app files when the app already exists
copy_assetsdict | list[dict] | NoneNoneCopy extra local files/directories into the exported app using the same rules as copy_assets()
base_dirstr | Path | NoneNoneBase directory for relative copy_assets.from paths (defaults to current working directory)
export_size_reportboolFalsePrint a per-table export size report for data/db, including estimated gzipped .json sizes
quietbool | NoneNoneOverride catalog quiet setting

Exports complete standalone datannur app with data. Uses app_path by default if set at init. Existing apps update data/db by default; pass update_app=True to refresh bundled front-end files.

Catalog.finalize()

python
catalog.finalize()

Advanced lifecycle method. Removes entities no longer seen during scan.

In normal usage, you usually do not need to call it directly: export_db() and export_app() call it automatically after scanning.

run_config()

python
from datannurpy import run_config

catalog = run_config(path)
ParameterTypeDefaultDescription
pathstr | PathrequiredYAML configuration file to load and execute

Runs a catalog.yml workflow and returns the resulting Catalog.

Top-level YAML keys recognized by run_config():

KeyTypeDescription
addlist[dict]Scan steps to execute with shorthand entries such as folder, dataset, or database
envdict[str, str]Environment variables to inject before expanding YAML values
env_filestr | Path | list[str | Path]One or more dotenv files to load before expansion
output_dirstr | Path | NoneExport JSON metadata only to this directory instead of exporting a full app
open_browserboolOpen the generated app in the browser after app export
copy_assetsdict | list[dict] | NoneCopy extra local files or directories into the export
track_evolutionboolEnable or disable evolution.json generation during export
export_size_reportboolEnable the per-table export size report after writing the database
update_appboolRefresh bundled front-end app files when exporting to an existing app_path
post_exportstr | list[str] | NoneRun Python scripts after export completes

All other non-reserved top-level keys are passed through to Catalog(...) using the same parameter names, such as app_path, metadata_path, depth, refresh, sample_size, auto_enumerations, preview_rows, app_config, quiet, verbose, and log_file.

To keep this API page concise, detailed YAML behavior is documented in the thematic guides:

  • export options such as output_dir, open_browser, track_evolution, update_app, copy_assets, and post_export: see Output & exports
  • metadata and config options such as metadata_path, env, env_file, and app_config: see Metadata & configuration

Path-based values are resolved relative to the YAML file directory unless documented otherwise in those guides.

copy_assets()

python
from datannurpy import copy_assets

copy_assets(output_dir, rules, *, base_dir=None, quiet=False)
ParameterTypeDefaultDescription
output_dirstr | PathrequiredExport directory to populate
rulesdict | list[dict]requiredCopy rules using the same shape as YAML copy_assets
base_dirstr | Path | NoneNoneBase directory for relative from paths (defaults to current working directory)
quietboolFalseSuppress copy progress logging

Each rule accepts from, to, optional include, and optional clean.

Catalog.export_db() and Catalog.export_app() also accept copy_assets= and base_dir= as convenience wrappers around this helper.

EntityMetadata

python
EntityMetadata(
    id=None,
    parent_id=None,
    manager_organization_id=None,
    owner_organization_id=None,
    tag_ids=None,
    doc_ids=None,
    name=None,
    description=None,
    license=None,
    type=None,
    link=None,
    localisation=None,
    start_date=None,
    end_date=None,
    updating_each=None,
    no_more_update=None,
)
ParameterTypeDescription
idstr | NoneExplicit entity ID. If omitted, scan-derived defaults are used.
parent_idstr | NoneParent folder ID (Folder.parent_id for folders, Dataset.folder_id for datasets).
manager_organization_idstr | NoneManaging organization ID.
owner_organization_idstr | NoneOwning organization ID.
tag_idslist[str] | NoneRelated tag IDs.
doc_idslist[str] | NoneRelated document IDs.
namestr | NoneDisplay name.
descriptionstr | NoneDescription text.
licensestr | NoneLicense string.
typestr | NoneEntity type/category.
linkstr | NoneExternal reference URL.
localisationstr | NoneGeographic coverage.
start_datestr | NoneCovered period start.
end_datestr | NoneCovered period end.
updating_eachstr | NoneUpdate frequency.
no_more_updatestr | NoneMarker that no further updates are expected.

In YAML configs, the same metadata is usually written as top-level keys on an add entry:

yaml
add:
  - folder: ./data
    id: source
    name: Source data
    description: Curated files used by the analytics team.

  - dataset: ./data/sales.csv
    id: source---sales
    folder_id: source
    name: Sales
    description: Monthly sales by product and region.

EntityMetadata is the Python API equivalent of those YAML metadata keys.

ID helpers

python
from datannurpy import sanitize_id, build_dataset_id, build_variable_id
FunctionDescriptionExample
sanitize_id(s)Clean string for use as ID"My File (v2)" → "My File v2"
build_dataset_id(folder_id, dataset_name)Build dataset ID("src", "sales") → "src---sales"
build_variable_id(folder_id, dataset_name, var)Build variable ID("src", "sales", "amount") → "src---sales---amount"