Shared dbt macros and materializations for Fresha data engineering projects.
This package contains reusable dbt macros that can be shared across multiple Fresha dbt projects. It includes custom materializations and helper functions for working with Snowflake Iceberg tables.
Add to your packages.yml:
packages:
- git: "git@github.com:yourorg/dbt-shared.git"
revision: v1.0.0Then run:
dbt deps- materializations/ - Custom dbt materializations for Iceberg tables
- iceberg/ - Helper macros for Iceberg table operations
As of now, we require custom materializations due to the following limitations:
- Snowflake Iceberg REST catalog-linked databases
- They don't support
CREATE OR REPLACE ICEBERG TABLE→ must useDROP TABLE+CREATE TABLE)
- Lakekeeper
- It doesn't support
CREATE ICEBERG TABLE AS (SELECT ...)→ must useCREATE TABLE+INSERT)SQL Execution Error: Failed while committing transaction to external catalog. Error:'SQL Execution Error: Table does not exist in the external catalog. Details: 'Error getting tabular from catalog''
- Standard dbt adapter methods
- The adapter doesn't detect iceberg tables in catalog-linked databases → must use
SHOW ICEBERG TABLES
Full refresh table materialization for Iceberg tables.
Differences from core:
- uses
CREATE TABLE (columns)+INSERTinstead ofCREATE TABLE AS SELECT - Partitions temp table first, then fast copy to target (minimizes downtime)
- Fallback check for tables that
adapter.get_relation()misses
Incremental materialization for Iceberg tables.
Differences from core:
- Uses
CREATE TABLE (columns)+INSERTinstead ofCREATE TABLE AS SELECT - Fallback check for tables that
load_relation()misses
Helper macros are documented inline in macros/iceberg/helpers.sql with detailed args/returns information.
This project follows Semantic Versioning (MAJOR.MINOR.PATCH).
This is handled automatically by the CI/CD pipeline.
Always pin to a specific version tag in packages.yml:
# dbt-x/packages.yml
packages:
- git: "https://github.com/surgeventures/dbt-shared.git"
revision: v1.0.0Note
At the moment, to simplify the dbt Cloud deployment, this repo is publicly accessible.
Releases are automated:
- Update
versionindbt_project.yml - Merge to
main - GitHub Actions auto-creates the tag and release