Tables
kelp.tables
¶
Generic model metadata API for use in any Spark job.
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. |
Source code in src/kelp/config/config.py
columns
¶
ddl
¶
func
¶
Get the fully qualified name for a Unity Catalog function.
get_model
¶
ref
¶
schema
¶
Get the Spark schema DDL for a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Model name. |
required |
exclude
|
list[str] | None
|
Column names to exclude from the schema. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Spark schema DDL string, or |
Source code in src/kelp/tables/api.py
schema_lite
¶
Get the raw Spark schema without constraints or generated columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Model name. |
required |
exclude
|
list[str] | None
|
Column names to exclude from the schema. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Spark schema DDL string, or |
Source code in src/kelp/tables/api.py
source
¶
source_options
¶
kelp.service.model_manager.KelpModel
dataclass
¶
KelpModel(
name,
table_type=None,
comment=None,
table_properties=None,
spark_conf=None,
path=None,
partition_cols=None,
cluster_by_auto=None,
cluster_by=None,
row_filter=None,
fqn=None,
schema=None,
schema_lite=None,
dqx_checks=None,
validation_table=None,
quarantine_table=None,
target_table=None,
root_model=None,
)
get_dqx_check_obj
¶
get_ddl
¶
Source code in src/kelp/service/model_manager.py
kelp.service.model_manager.KelpSdpModel
dataclass
¶
KelpSdpModel(
name,
table_type=None,
comment=None,
table_properties=None,
spark_conf=None,
path=None,
partition_cols=None,
cluster_by_auto=None,
cluster_by=None,
row_filter=None,
fqn=None,
schema=None,
schema_lite=None,
dqx_checks=None,
validation_table=None,
quarantine_table=None,
target_table=None,
root_model=None,
expect_all=None,
expect_all_or_fail=None,
expect_all_or_drop=None,
expect_all_or_quarantine=None,
)
Bases: KelpModel