Skip to content
  • There are no suggestions because the search field is empty.

Deployment Options (Project)

Applies to
Platform: Microsoft SQL Server · Snowflake · Databricks · Fabric Lakehouse · Fabric Warehouse · Oracle

Deployment Options (DeploymentOptions) select which optional statements the generated deployment scripts contain. They decide whether a deployment drops and recreates tables and whether it creates schemas.

The dbt generators do not offer the property.

Values

Select one or more values in the Deployment group of the Additional Settings in Project Settings:

  • Generate Drop Table Statements: the table scripts drop and recreate each table. Without it, a table is created only when it does not exist. On Microsoft SQL Server, the option also adds the statements that drop the foreign keys referencing a table before it is dropped.
  • Generate Drop Load Control Schema (Snowflake only): the load control deployment starts with DROP SCHEMA IF EXISTS for the load control schema, with CASCADE.
  • Generate Create Schema If Not Exists Statements (Databricks, Fabric Lakehouse): each layer header runs CREATE SCHEMA IF NOT EXISTS. It applies only with Use Unity Catalog true on Databricks and with Target Platform Fabric on Fabric Lakehouse. With Use Unity Catalog false or Target Platform Azure Synapse, the header runs CREATE DATABASE IF NOT EXISTS instead, whether the option is selected or not.
  • Generate Alter View Body Statements (Databricks only): the deployment alters a view that already exists with ALTER VIEW and creates it otherwise. Without it, views are created with CREATE OR REPLACE VIEW.

Deployment group of Project Settings in a Databricks project with Deployment Options open: Generate Drop Table Statements and Generate Create Schema If Not Exists Statements selected, Generate Alter View Body Statements cleared

Defaults

  • Microsoft SQL Server, Fabric Warehouse, Oracle: Generate Drop Table Statements.
  • Snowflake: Generate Drop Table Statements and Generate Drop Load Control Schema.
  • Databricks, Fabric Lakehouse: Generate Drop Table Statements and Generate Create Schema If Not Exists Statements.

With Generate Drop Table Statements, the default on every platform, each deployment deletes the data in the generated tables. The table scripts drop an existing table and create it empty: DROP TABLE and CREATE TABLE on Microsoft SQL Server and Fabric Warehouse, DROP TABLE ... CASCADE CONSTRAINTS PURGE on Oracle, and CREATE OR REPLACE TABLE on Snowflake, Databricks and Fabric Lakehouse. Clear the option before you deploy to tables whose data you want to keep.

On Databricks and Fabric Lakehouse, the option also applies to the load control log tables execution_log and deployment_log: with it, the load control deployment replaces them with CREATE OR REPLACE TABLE; without it, the deployment creates them with CREATE TABLE IF NOT EXISTS. On Microsoft SQL Server, the load control tables do not depend on Deployment Options: with Deploy LoadControl true, each deployment drops and creates them again.

To deploy a changed project into a target that already holds data, follow Redeploy and keep data in the Deployment article of your platform: Microsoft SQL Server, Snowflake, Databricks, Fabric Lakehouse, Fabric Warehouse, Oracle.

Example

On Microsoft SQL Server without Generate Drop Table Statements, the table script of a Link starts with:

IF OBJECT_ID(N'[<schema>].[RDV_LNK_single_customer_hub_lnk]', N'U') IS NULL
BEGIN
    CREATE TABLE [<schema>].[RDV_LNK_single_customer_hub_lnk] (
    ...

With the option, the script drops the table first and then creates it.

Release differences

  • Generator 2.2: Generate Create Schema If Not Exists Statements is added.
  • Generator 2.0: Generate Alter View Body Statements and Generate Drop Load Control Schema are added.

Related articles