Databricks to Snowflake Table Mirroring
This repository provides a utility to synchronize (mirror) Iceberg table metadata from Databricks Unity Catalog to Snowflake Horizon.
It automates the creation of:
- Snowflake Catalog Integrations
- External Iceberg Tables
Note: This library uses credential vending to access cloud storage. Snowflake External Volumes are not required.
Table of Contents
- Overview
- Snowflake Setup
- Databricks Setup
- How to Use
- Configuration
- Parameter Reference
- Example Usage
- Limitations
Overview
This utility automates the following tasks:
- Retrieves Iceberg metadata from Unity Catalog
- Generates Delta-based metadata tables in Databricks
- Creates Catalog Integrations in Snowflake
- Creates External Iceberg Tables in Snowflake
Snowflake Setup
This utility supports two usage patterns:
- Manual: Generate DDLs for execution in Snowflake
- Automated: Create Snowflake assets directly from Databricks
Required Snowflake permissions:
- Create Catalog Integrations
- Create External Iceberg Tables
Databricks Setup
Install the library:
pip install databricks_uniform_sync
Initialize the class:
from databricks_uniform_sync import DatabricksToSnowflakeMirror
d2s = DatabricksToSnowflakeMirror(
spark_session=spark,
dbx_workspace_url="https://dbcxyz.databricks.cloud.net",
dbx_workspace_pat="dapi...",
metadata_catalog="dbx_sf_mirror_catalog",
metadata_schema="dbx_sf_mirror_schema"
)
How to Use
1. Create or Refresh Metadata Tables
d2s.create_metadata_tables()
d2s.refresh_metadata_tables(catalog="your_catalog")
These methods are idempotent and safe to rerun.
If metadata tables do not exist, refresh_metadata_tables() will create them.
2. Add Unity Catalog Discovery Tags
d2s.refresh_uc_metadata_tags()
These tags are used to determine sync eligibility. Do not remove them.
3. Create Snowflake Catalog Integrations
Dry run (SQL only):
d2s.generate_create_sf_catalog_integrations_sql(
oauth_client_id="client-id",
oauth_client_secret="client-secret"
)
Execute directly:
d2s.create_sf_catalog_integrations(
sf_account_id="xyz-123",
sf_user="svc_name",
sf_private_key_file="rsa/rsa_key.p8",
sf_private_key_file_pwd="your-password",
oauth_client_id="client-id",
oauth_client_secret="client-secret"
)
4. Create Iceberg Tables in Snowflake
Dry run:
d2s.generate_create_sf_iceberg_tables_sql()
Execute directly:
d2s.create_sf_iceberg_tables_sql(
sf_account_id="xyz-123",
sf_user="svc_name",
sf_private_key_file="rsa/rsa_key.p8",
sf_private_key_file_pwd="your-password"
)
Configuration
Custom Metadata Table Name
d2s = DatabricksToSnowflakeMirror(
spark_session,
dbx_workspace_url,
dbx_workspace_pat,
metadata_catalog,
metadata_schema,
metadata_table_name="custom_table_name"
)
A corresponding view will also be created with a _vw suffix.
Custom Refresh Interval
d2s.create_sf_catalog_integrations(
...,
refresh_interval_seconds=120
)
Disable Auto-Refresh on Iceberg Tables
d2s.create_sf_iceberg_tables_sql(
...,
auto_refresh=False
)
Parameter Reference
Databricks Parameters
| Parameter | Description |
|---|---|
spark_session |
Active SparkSession in Databricks |
dbx_workspace_url |
URL of your Databricks workspace |
dbx_workspace_pat |
Personal Access Token for authentication |
metadata_catalog |
Unity Catalog catalog to store metadata |
metadata_schema |
Unity Catalog schema to store metadata |
metadata_table_name (optional) |
Custom name for metadata table |
Snowflake Parameters
| Parameter | Description |
|---|---|
sf_account_id |
Snowflake account identifier |
sf_user |
Snowflake user/service account |
sf_private_key_file |
Path to RSA private key |
sf_private_key_file_pwd |
Password to decrypt RSA key |
oauth_client_id |
Databricks OAuth client ID |
oauth_client_secret |
Databricks OAuth client secret |
refresh_interval_seconds (optional) |
Catalog Integration refresh interval |
auto_refresh (optional) |
Enable/disable automatic refresh on tables |
Example Usage
Coming soon.
A demo notebook or script will be added to show end-to-end execution.
Limitations
- Only supports Iceberg tables on S3
- Deleting tables in Unity Catalog does not remove them in Snowflake
- Only supports RSA key pair authentication (Snowflake MFA compliance)
Metadata
Release files for databricks-uniform-sync 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| databricks_uniform_sync-1.1.4.tar.gz | 19.8 kB | Without provenance | Details for databricks_uniform_sync-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| databricks_uniform_sync-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for databricks_uniform_sync-1.1.4-py3-none-any.whl |
Total release size: 47.8 kB
Release files / databricks_uniform_sync-1.1.4.tar.gz
| Download URL | databricks_uniform_sync-1.1.4.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4732b5528d58811d44896022dc6526803899d3da29353a37bab309b472f086a7
|
|
BLAKE2b-256 checksum How to use checksums |
28c69e884e6b679e57b8afb24b29a483e763baaa2e5cd8cf7c9d20b448f8cfda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / databricks_uniform_sync-1.1.4-py3-none-any.whl
| Download URL | databricks_uniform_sync-1.1.4-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
923d4ee1b513a18139997f065d98ead631fba5d60136d09ba70b111e99ba9a5a
|
|
BLAKE2b-256 checksum How to use checksums |
3befeb4c428dbf36b5bb68153a009259ac1927fa9a0846bebeb6cf921a319e4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for databricks-uniform-sync 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.