Package: dbt-materialize
dbt-materializedbtadapter forMaterialize.For a complete step-by-step guide on how to use dbt and Materialize, check thedocumentation.Installationdbt-materializeis available onPyPI. To install the latest version viapip(optionally using a virtual environment), run:python3 -m venv dbt-venv         # create the virtual environment
source dbt-venv/bin/activate     # activate the virtual environment
pip install dbt-materialize      # install the adapterRequirementsdbt-materializerequires Materialize v0.68.0+.Configuring your profileTo connect to a Materialize instance, use the referenceprofile configurationin your connection profile:dbt-materialize:
  target: dev
  outputs:
    dev:
      type: materialize
      threads: 1
      host: [host]
      port: [port]
      user: [user@domain.com]
      pass: [password]
      dbname: [database]
      schema: [dbt schema]
      cluster: [cluster] # default 'quickstart'
      sslmode: require
      keepalives_idle: 0 # default 0
      retries: 1  # default 1 retry on error/timeout when opening connections
      search_path: [optional, override the default search_path]Complete sample profiles can be found insample_profiles.yml.Supported FeaturesMaterializationsTypeSupported?DetailssourceYESCreates asource.viewYESCreates aview.materializedviewYES(Deprecated) Creates amaterialized view.materialized_viewYESCreates amaterialized view. Thematerializedviewlegacy materialization name is supported for backwards compatibility.tableYESCreates amaterialized view. (Actual table support pending#5266.)sinkYESCreates asink.ephemeralYESExecutes queries using CTEs.incrementalNOUse thematerialized_viewmaterialization instead! dbt's incremental models are valuable because they only spend your time and money transforming your new data as it arrives. Luckily, this is exactly what Materialize's materialized views were built to do! Better yet, our materialized views will always return up-to-date results without manual or configured refreshes. For more information, check outour documentation.IndexesUse the indexes option to define a list ofindexesonsource,view,tableormaterialized viewmaterializations. Each
Materialize index can have the following components:ComponentValueDescriptioncolumnslistOne or more columns on which the index is defined. To create an index that usesallcolumns, use thedefaultcomponent instead.namestringThe name for the index. If unspecified, Materialize will use the materialization name and column names provided.clusterstringThe cluster to use to create the index. If unspecified, indexes will be created in the cluster used to create the materialization.defaultboolDefault:False. If set toTrue, creates a default index that uses all columns.Additional macrosWe provide amaterialize-dbt-utilspackage with Materialize-specific
implementations of dispatched macros fromdbt-utils. To use this package in
your dbt project, check the latest installation instructions indbt Hub.HooksSupported.Custom SchemasSupported. Custom schemas in dbt might behave differently than you'd expect, so
make sure to read thedocumentation!SourcesYou can instruct dbt to create adbt sourcein Materialize using the customsourcematerialization, which allows for
injecting the complete source statement into your .sql file.source freshnessis not supported because using Materialize, your sources will
always be fresh.Documentationdbt docsis supported,
as well as--persist-docs.Testingdbt testis supported.If you set the optional--store-failuresflag orstore-failuresconfig,
dbt will save the results of a test query to amaterialized_view. To use aviewinstead, use thestore_failures_asconfig.These objects will be created in a schema suffixed or nameddbt_test__auditby
default. Change this value by setting aschemaconfig. If bothstore_failuresandstore_failures_asare specified,store_failures_astakes precedence.SnapshotsNot supported. Support is not planned for the near term.ContributorsA huge thank you toJosh Wills, who created the
original version of this adapter. 🤠