While not every query needs to be pushed down to dbt, when you do create a query where you want to promote the logic into dbt, you can do so within Omni.
Omni also supports editing existing models. You can run and compile dbt SQL with Jinja references and config settings, allowing you to interact with data as you build and eliminate the need for manual SQL substitutions when referencing existing models. Models authored in Omni can then be materialized through existing dbt workflows without requiring complex warehouse permissions for schema ownership.
Requirements
To follow the steps in this guide, you’ll need an Omni connection with a configured dbt integration.
Creating new dbt models from Omni queries
Open your query
In a workbook, open the query you want to use to convert to a dbt model.
Convert to dbt model
Click Model > Convert to dbt model. Omni will convert the query to dbt SQL.
Refine the model
Use the SQL editor to refine the model. You can run the query periodically to verify the output.
Push to dbt repo
Click Model > Push to dbt repo.
Configure the push
In the Push to dbt dialog:
- Model name — the filename for the new
.sql file. Make sure this is unique — if it matches an existing model name, it will overwrite that file.
- Git branch — the branch to push to
- Commit message — a description of the change
Click Push.If the push dialog shows a diff indicating changes to an existing file, check the model name field. Omni defaults to the name of your current query or view — if that name matches an existing dbt model, it will update that file. Rename the model in the dialog to create a new file instead.
Complete the pull request
You’ll be prompted to create a pull request in the dbt git repository. Complete the pull request process, following your organization’s process.
After the pull request is merged and the model is built in your warehouse, bring it into Omni by triggering a schema refresh.
Editing dbt models
While the dbt IDE is read-only, you can edit existing dbt models in a workbook and push changes back to the dbt repository.
Modeler permissions are required to edit dbt models.
Open the dbt IDE
Navigate to Develop, select your model, and click the dbt icon in the sidebar.
Select a model
Use the file picker to select the dbt model you want to edit.
Open in a workbook
Click the Open in workbook button near the top right corner of the page:
Edit the model
The model will open in a new workbook. Use the SQL editor to iterate on the model.
Push changes
When finished, click Model > Push to dbt repo and follow the same push flow as creating a new model.
After the model is rebuilt in your warehouse, bring in the updated version by triggering a schema refresh.
Next steps