← Back to Blog

Using Compiler Options in Dataform

Published on April 16, 2025

Compiler options can be used to set things like table prefix, schema & dataset suffix and adding variables the the query compilation or execution.

1. To add the table prefix `AA` in all tables, you can run:
dataform compile --table-prefix=AA

your-project.your-dataset.your-table would become your-project.your-dataset.AA_your-table

2. To add the schema suffix to `AA`, you can run:
dataform compile --schema-suffix=AA

your-project.your-dataset.your-table would become your-project.your-dataset_AA.your-table . Note, that schema is dataform cli translates to BigQuery database

3. To add the databse suffix to `AA`, you can run:
dataform compile --database-suffix=AA

your-project.your-dataset.your-table would become your-project_AA.your-dataset.your-table . Note, that database is dataform cli translates to BigQuery project

Compiler options can also be used with `dataform run` to add the table prefix to a specific execution as follows:
dataform run --actions "your-project.your-dataset.your-table" --table-prefix=AA

You can use table prefixes to isolate your development work from production tables. For example, use dev_ for development and prod_ for production tables.

[!TIP] In Dataform Tools VSCode extension, you can set the table prefix directly in the compiled query webview by adding --table-prefix=AA to the text box.

Available compiler options can be seen by running dataform compile --help in your terminal:


Positionals:
  project-dir  The Dataform project directory.  [default: "."]

Options:
  --help              Show help  [boolean]
  --version           Show version number  [boolean]
  --watch             Whether to watch the changes in the project directory.  [boolean] [default: false]
  --json              Outputs a JSON representation of the compiled project.  [boolean] [default: false]
  --timeout           Duration to allow project compilation to complete. Examples: '1s', '10m', etc.  [string] [default: null]
  --default-database  The default database to use, equivalent to Google Cloud Project ID. If unset, the value from workflow_settings.yaml is used.  [string]
  --default-schema    Override for the default schema name. If unset, the value from workflow_settings.yaml is used.
  --default-location  The default location to use. See https://cloud.google.com/bigquery/docs/locations for supported values. If unset, the value from workflow_settings.yaml is used.
  --assertion-schema  Default assertion schema. If unset, the value from workflow_settings.yaml is used.
  --vars              Override for variables to inject via '--vars=someKey=someValue,a=b', referenced by `dataform.projectConfig.vars.someValue`.  If unset, the value from workflow_settings.yaml is used.  [string] [default: null]
  --database-suffix   Default assertion schema. If unset, the value from workflow_settings.yaml is used.
  --schema-suffix     A suffix to be appended to output schema names. If unset, the value from workflow_settings.yaml is used.
  --table-prefix      Adds a prefix for all table names. If unset, the value from workflow_settings.yaml is used.