This dbt package contains macros that:
- can be (re)used across dbt projects running on Trino or Starburst databases
- define implementations of dispatched macros from other packages that can be used on Trino or Starburst databases
This package provides "shims" for:
- dbt_utils (partial)
Wherever a custom trino macro exists, dbt_utils adapter dispatch will pass to trino_utils. This means you can just do {{dbt_utils.hash('mycolumnname')}}
just like your friends with Snowflake.
To make use of these trino adaptations in your dbt project, you must do two things:
- Install both
trino_utils
and any of the compatible packages listed above by adding them to yourpackages.yml
packages: - package: dbt-labs/dbt_utils version: {SEE DBT HUB FOR NEWEST VERSION} - package: starburstdata/trino_utils version: {SEE DBT HUB FOR NEWEST VERSION}
- Tell the supported package to also look for the
trino_utils
macros by adding the relevantdispatches
to yourdbt_project.yml
dispatch: - macro_namespace: dbt_utils search_order: ['trino_utils', 'dbt_utils']
Check dbt Hub for the latest installation instructions, or read the docs for more information on installing packages.
Some helper macros have been added to simplfy development database cleanup. Usage is as follows:
Drop all schemas for each prefix with the provided prefix list (dev and myschema being a sample prefixes):
dbt run-operation trino__drop_schemas_by_prefixes --args "{prefixes: ['dev', 'myschema']}"
Drop all schemas with the single provided prefix (dev being a sample prefix):
dbt run-operation trino__drop_schemas_by_prefixes --args "{prefixes: myschema}"
Drop a schema with a specific name (myschema_seed being a sample schema name used in the project):
dbt run-operation trino__drop_schema_by_name --args "{schema_name: myschema_seed}"
Drop any models that are no longer included in the project (dependent on the current target):
dbt run-operation trino__drop_old_relations
or for a dry run to preview dropped models:
dbt run-operation trino__drop_old_relations --args "{dry_run: true}"