Skip to main content

Databricks

DataHub supports integration with Databricks ecosystem using a multitude of connectors, depending on your exact setup.

Databricks Hive

The simplest way to integrate is usually via the Hive connector. The Hive starter recipe has a section describing how to connect to your Databricks workspace.

Databricks Unity Catalog (new)

The recently introduced Unity Catalog provides a new way to govern your assets within the Databricks lakehouse. If you have enabled Unity Catalog, you can use the unity-catalog source (see below) to integrate your metadata into DataHub as an alternate to the Hive pathway.

Databricks Spark

To complete the picture, we recommend adding push-based ingestion from your Spark jobs to see real-time activity and lineage between your Databricks tables and your Spark jobs. Use the Spark agent to push metadata to DataHub using the instructions here.

Watch the DataHub Talk at the Data and AI Summit 2022

For a deeper look at how to think about DataHub within and across your Databricks ecosystem, watch the recording of our talk at the Data and AI Summit 2022.

IMAGE_ALT

Module unity-catalog

Incubating

Important Capabilities

CapabilityStatusNotes
Asset ContainersEnabled by default
Column-level LineageEnabled by default
DescriptionsEnabled by default
Detect Deleted EntitiesOptionally enabled via stateful_ingestion.remove_stale_metadata
DomainsSupported via the domain config field
Platform InstanceEnabled by default
Schema MetadataEnabled by default
Table-Level LineageEnabled by default

This plugin extracts the following metadata from Databricks Unity Catalog:

  • metastores
  • schemas
  • tables and column lineage

Prerequisities

CLI based Ingestion

Install the Plugin

pip install 'acryl-datahub[unity-catalog]'

Starter Recipe

Check out the following recipe to get started with ingestion! See below for full configuration options.

For general pointers on writing and running a recipe, see our main recipe guide.

source:
type: unity-catalog
config:
workspace_url: https://my-workspace.cloud.databricks.com
token: "mygenerated_databricks_token"
#metastore_id_pattern:
# deny:
# - 11111-2222-33333-44-555555
#catalog_pattern:
# allow:
# - my-catalog
#schema_pattern:
# deny:
# - information_schema
#table_pattern:
# allow:
# - test.lineagedemo.dinner
# First you have to create domains on Datahub by following this guide -> https://datahubproject.io/docs/domains/#domains-setup-prerequisites-and-permissions
#domain:
# urn:li:domain:1111-222-333-444-555:
# allow:
# - main.*

stateful_ingestion:
enabled: true

pipeline_name: acme-corp-unity


# sink configs if needed

Config Details

Note that a . is used to denote nested fields in the YAML recipe.

View All Configuration Options
Field [Required]TypeDescriptionDefaultNotes
token [✅]stringDatabricks personal access tokenNone
workspace_url [✅]stringDatabricks workspace urlNone
include_column_lineagebooleanOption to enable/disable lineage generation. Currently we have to call a rest call per column to get column level lineage due to the Databrick api which can slow down ingestion.True
include_table_lineagebooleanOption to enable/disable lineage generation.True
platform_instancestringThe instance of the platform that all assets produced by this recipe belong toNone
workspace_namestringName of the workspace. Default to deployment name present in workspace_urlNone
envstringThe environment that all assets produced by this connector belong toPROD
catalog_patternAllowDenyPatternRegex patterns for catalogs to filter in ingestion. Specify regex to match the catalog name{'allow': ['.*'], 'deny': [], 'ignoreCase': True}
catalog_pattern.allowarray(string)None
catalog_pattern.denyarray(string)None
catalog_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
domainmap(str,AllowDenyPattern)A class to store allow deny regexesNone
domain.key.allowarray(string)None
domain.key.denyarray(string)None
domain.key.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
metastore_id_patternAllowDenyPatternRegex patterns for metastore id to filter in ingestion.{'allow': ['.*'], 'deny': [], 'ignoreCase': True}
metastore_id_pattern.allowarray(string)None
metastore_id_pattern.denyarray(string)None
metastore_id_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
schema_patternAllowDenyPatternRegex patterns for schemas to filter in ingestion. Specify regex to only match the schema name. e.g. to match all tables in schema analytics, use the regex 'analytics'{'allow': ['.*'], 'deny': [], 'ignoreCase': True}
schema_pattern.allowarray(string)None
schema_pattern.denyarray(string)None
schema_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
table_patternAllowDenyPatternRegex patterns for tables to filter in ingestion. Specify regex to match the entire table name in catalog.schema.table format. e.g. to match all tables starting with customer in Customer catalog and public schema, use the regex 'Customer.public.customer.*'{'allow': ['.*'], 'deny': [], 'ignoreCase': True}
table_pattern.allowarray(string)None
table_pattern.denyarray(string)None
table_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
stateful_ingestionStatefulStaleMetadataRemovalConfigUnity Catalog Stateful Ingestion Config.None
stateful_ingestion.enabledbooleanThe type of the ingestion state provider registered with datahub.None
stateful_ingestion.ignore_new_statebooleanIf set to True, ignores the current checkpoint state.None
stateful_ingestion.ignore_old_statebooleanIf set to True, ignores the previous checkpoint state.None
stateful_ingestion.remove_stale_metadatabooleanSoft-deletes the entities present in the last successful run but missing in the current run with stateful_ingestion enabled.True

Troubleshooting

No data lineage captured or missing lineage

Check that you meet the Unity Catalog lineage requirements.

Also check the Unity Catalog limitations to make sure that lineage would be expected to exist in this case.

Lineage extraction is too slow

Currently, there is no way to get table or column lineage in bulk from the Databricks Unity Catalog REST api. Table lineage calls require one API call per table, and column lineage calls require one API call per column. If you find metadata extraction taking too long, you can turn off column level lineage extraction via the include_column_lineage config flag.

Code Coordinates

  • Class Name: datahub.ingestion.source.unity.source.UnityCatalogSource
  • Browse on GitHub

Questions

If you've got any questions on configuring ingestion for Databricks, feel free to ping us on our Slack