Catalog
kelp.catalog
¶
Unity Catalog Sync
create_metric_views
¶
Create specified metric views in the remote catalog.
Creates metric views in Databricks Unity Catalog. If no specific view names are provided, all metric views from the catalog are created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_names
|
list[str] | None
|
List of metric view names to create. If None, creates all views. |
None
|
filter_by_meta
|
dict[str, Any] | None
|
Optional dict filter applied against each object's |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of SQL queries executed to create metric views. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a specified metric view name is not found in the catalog. |
Exception
|
If metric view creation fails (see UnityCatalogAdapter for details). |
Source code in src/kelp/catalog/api.py
sync_abac_policies
¶
Synchronize specified ABAC policies to the remote catalog.
Source code in src/kelp/catalog/api.py
sync_catalog
¶
sync_catalog(
sync_functions=False,
sync_metric_views=True,
sync_tables=True,
sync_abacs=True,
filter_by_meta=None,
profile=None,
)
Synchronize all tables and metric views to remote Databricks catalog.
Synchronizes the entire local catalog (tables and metric views) to the remote Databricks Unity Catalog, applying any configuration such as tags and properties based on the remote_catalog_config settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sync_functions
|
bool
|
If True, syncs all functions to remote catalog. |
False
|
sync_metric_views
|
bool
|
If True, syncs all metric views to remote catalog. |
True
|
sync_tables
|
bool
|
If True, syncs all tables to remote catalog. |
True
|
sync_abacs
|
bool
|
If True, syncs all ABAC policies to remote catalog. |
True
|
filter_by_meta
|
dict[str, Any] | None
|
Optional dict filter applied against each object's |
None
|
profile
|
str | None
|
Databricks CLI profile to use for remote metadata lookups. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of SQL queries executed for synchronization. |
Raises:
| Type | Description |
|---|---|
Exception
|
If catalog synchronization fails (see UnityCatalogAdapter for details). |
Source code in src/kelp/catalog/api.py
sync_functions
¶
Synchronize specified functions to the remote catalog.
Functions are pre-applied entities and are synced via CREATE OR REPLACE DDL.
Source code in src/kelp/catalog/api.py
sync_metric_views
¶
Synchronize specified metric views to the remote catalog.
Synchronizes metric views from the local catalog to Databricks Unity Catalog. If no specific view names are provided, all metric views are synchronized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_names
|
list[str] | None
|
List of metric view names to sync. If None, syncs all views. |
None
|
filter_by_meta
|
dict[str, Any] | None
|
Optional dict filter applied against each object's |
None
|
profile
|
str | None
|
Databricks CLI profile to use for remote metadata lookups. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of SQL queries executed for synchronization. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a specified metric view name is not found in the catalog. |
Exception
|
If metric view sync fails (see UnityCatalogAdapter for details). |
Source code in src/kelp/catalog/api.py
sync_tables
¶
Synchronize specified tables to the remote catalog.
Synchronizes tables from the local catalog to Databricks Unity Catalog, applying configuration such as tags and properties based on remote_catalog_config. If no specific table names are provided, all tables are synchronized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_names
|
list[str] | None
|
List of table names to sync. If None, syncs all tables. |
None
|
filter_by_meta
|
dict[str, Any] | None
|
Optional dict filter applied against each object's |
None
|
profile
|
str | None
|
Databricks CLI profile to use for remote metadata lookups. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of SQL queries executed for synchronization. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If a specified table name is not found in the catalog. |
Exception
|
If table sync fails (see UnityCatalogAdapter for details). |
Source code in src/kelp/catalog/api.py
init
¶
init(
project_file_path=None,
target=None,
init_vars=None,
manifest_file_path=None,
refresh=False,
store_in_global=True,
run_policy_checks=False,
log_level=None,
)
Initialize kelp runtime context from current directory.
When manifest_file_path is provided (or resolved from KELP_MANIFEST_FILE
environment variable), the context is loaded directly from a pre-built
manifest JSON file, skipping all project discovery, Jinja rendering, and
metadata loading.
When policy_config.enabled is True in the project settings, metadata
governance policies are evaluated immediately after loading. Warn-severity
violations are logged; error-severity violations raise a RuntimeError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_file_path
|
str | None
|
Path to project file or directory. |
None
|
target
|
str | None
|
Target environment name. |
None
|
init_vars
|
dict[str, Any] | None
|
Runtime variable overrides. |
None
|
manifest_file_path
|
str | None
|
Path to a manifest JSON file. When provided, skips source file loading. Also resolved from KELP_MANIFEST_FILE env var. |
None
|
refresh
|
bool
|
If True, recreate context even if one already exists. |
False
|
store_in_global
|
bool
|
Whether to store context globally. |
True
|
run_policy_checks
|
bool
|
Whether to run policy checks. |
False
|
log_level
|
str | None
|
Optional log level to configure. |
None
|
Returns:
| Type | Description |
|---|---|
MetaRuntimeContext
|
The initialized MetaRuntimeContext. |