Skip to content

Python API

The DataMuru class wraps the same engine used by the CLI.

from datamuru.api import DataMuru

dm = DataMuru("datamuru.yml")
issues = dm.validate()
report = dm.doctor()
plan = dm.plan(target="catalog:analytics")

Constructor

DataMuru(config_path: str | Path, environment: str | None = None)

Methods

Method Result
validate() validation issues
doctor() DoctorReport
edition_summary() EditionSummary
state_backend_report() state backend readiness report
enterprise_activation_report() activation readiness report
enterprise_activation_purchase_request() redacted purchase/license activation request
enterprise_activation_evidence_report() redacted activation audit evidence report
enterprise_activation_handoff_package(output_dir) redacted activation handoff package manifest
enterprise_control_plane_contract() hosted control plane handoff contract
enterprise_tenant_entitlement_record() immutable redacted tenant entitlement record
enterprise_control_plane_architecture() hosted control plane reference architecture
DataMuru.fulfill_enterprise_activation(...) config-independent offline fulfillment result
write_enterprise_activation_bundle(output_path) redacted activation handoff bundle path
write_enterprise_activation_purchase_request(output_path) redacted purchase/license activation request path
write_enterprise_activation_evidence(output_path) redacted activation audit evidence path
write_enterprise_activation_handoff_package(output_dir) redacted activation handoff package manifest
write_enterprise_control_plane_contract(output_path) redacted hosted control plane contract path
write_enterprise_tenant_entitlement_record(output_path) tenant entitlement record path
write_enterprise_control_plane_architecture(output_path) hosted control plane architecture path
plan(target=None) Plan
save_plan(output_path, target=None) saved-plan result
apply(target=None) ApplyResult
apply_saved_plan(plan_path) ApplyResult
destroy(target=None) ApplyResult
import_discover(include_system=False, catalogs=None, progress=None) ImportDiscoveryReport
import_generate(...) generated workspace configuration result
import_adopt(targets=[...], commit=False) ImportAdoptionResult
import_databricks_to_snowflake_mapping(...) review-only Databricks-to-Snowflake mapping result
import_snowflake_to_databricks_mapping(...) review-only Snowflake-to-Databricks mapping result
metadata_inventory() MetadataInventory from read-only provider discovery
write_metadata_inventory(output_path, replace=False) MetadataPublicationResult with created, unchanged, or replaced status

progress is an optional callback that receives dictionaries such as {"message": "...", "total": 12, "completed": 5}. CLI text output uses this to render import progress while keeping JSON output machine-readable.

Reverse mapping example:

mapping = dm.import_snowflake_to_databricks_mapping(
    databases=["FINANCE"],
    target_workspace="databricks-dev",
    target_cloud="azure",
    catalog_prefix="sf",
    identifier_case="lower",
)

The method returns SnowflakeToDatabricksMappingResult. Its YAML is a draft; the call does not move data or invoke provider mutation methods.

Example: guarded apply

from datamuru.api import DataMuru

dm = DataMuru("datamuru.yml")

if not dm.doctor().success:
    raise RuntimeError("Provider diagnostics failed")

plan = dm.plan(target="catalog:analytics")
destructive = [change for change in plan.changes if change.action == "destroy"]
if destructive:
    raise RuntimeError("Review destroy actions before apply")

result = dm.apply(target="catalog:analytics")

Offline fulfillment

Offline fulfillment does not require a project configuration:

from datamuru.api import DataMuru

result = DataMuru.fulfill_enterprise_activation(
    ".datamuru/activation/purchase-request.json",
    ".datamuru/activation/fulfillment",
    decision="approve",
    operator="licensing@datamuru.com",
    decision_reference="CRM-1234",
)

The result contains a versioned decision record and, for approval, an activation receipt. Both are offline evidence rather than signed licenses or hosted tenant provisioning results.

The Python contracts are alpha APIs. Pin the package version and test upgrades.

Metadata inventory

from datamuru.api import DataMuru

dm = DataMuru("datamuru.yml")
inventory = dm.metadata_inventory()
result = dm.write_metadata_inventory(
    ".datamuru/metadata-inventory.json",
    replace=False,
)

The inventory uses schema datamuru.metadata_inventory.v1. Asset IDs remain stable for the same provider, environment, native type, and native name components, including components that contain dots. Dots within a native component are percent-encoded in the published qualified_name, while dots between hierarchy components remain readable. The writer is atomic, treats semantically identical content as unchanged even when observation timestamps differ, and blocks different or concurrently created content unless replace=True is explicit. Neither method returns or persists provider credentials.

The hierarchy is catalog|database -> schema -> table|view -> column. Relations include only native type metadata; columns include only available ordinal position, type text, and nullability. Discovery is bounded to 1,000 relations and 10,000 columns and fails without publication when either limit is exceeded. Public method signatures and schema datamuru.metadata_inventory.v1 remain compatible with the previous alpha.