Skip to main content
dbt pull converts dbt models into cubes. The Cube CLI drives it from any pipeline: it uploads the target/manifest.json your dbt job produced, so Cube needs no access to your dbt repository. These recipes cover the common setups. Every recipe assumes the CLI is installed and authenticated through environment variables, which is the usual setup in CI:
Each recipe also needs a dbt manifest. Any dbt command that parses the project writes one to target/manifest.json: dbt parse, dbt compile, dbt run, or dbt build.

Multiple dbt projects

Give every dbt project its own output folder and name prefix, and pull each one as an uploaded manifest. Multiple dbt projects explains why both are needed. When each project has its own repository and pipeline, add a job like this to each one, changing only PROJECT:
When the projects live in one repository, loop over them:
Each sync creates its own review branch, so a person can approve each project’s update separately. The branches change different folders and merge in any order.

Commit through your own pull requests

If your data model lives in your own Git repository, let your CI commit the cubes instead of Cube. cube dbt generate converts a manifest and writes the files into your working copy; it creates no Cube branch and commits nothing. generate never deletes files, so clear each project’s folder first. Its folder holds only generated cubes, so a cube whose dbt model was deleted disappears too:
Run it from the root of your data model repository: --out . is the project root, and --output-path is relative to it. With a single dbt project, drop the loop and the two flags; the cubes go to the deployment’s saved Output path. Clear only the files directly in that folder, as a pull does, so any per-project subfolders survive: find model/cubes/dbt -maxdepth 1 -type f -delete.

Gate pull requests on generated cubes

To fail a pull request whose committed cubes no longer match its dbt project, regenerate them in the checkout and fail if anything changed:
Clearing the folder first is what makes this catch a cube left behind by a deleted dbt model. generate --check writes nothing, but it only compares the files the run generated, so it misses those. Neither generate recipe sends a “dbt sync is ready for review” email, so both can run on every pull request.

CLI-mode deployments

A deployment in CLI deploy mode takes its data model from cube deploy rather than from Git. Regenerate the cubes in your project directory, then deploy it:
cube deploy uploads the whole directory and removes remote files that aren’t in it, so run it from a complete checkout of your data model, and keep the manifests outside that directory. Switch the deployment to CLI deploy mode once with cube deployments update DEPLOYMENT_ID -d '{"deployMode":"cli"}'.

Promote a sync once it compiles

When the dbt pipeline is already your review step, a sync can merge itself to production once its cubes compile:
A failed compile stops the script before the merge and keeps the sync branch for inspection. Without the --output-path and --name-prefix flags, this works the same for a deployment with a single dbt project.
This merges without a human review. Use it only when your dbt pipeline is the review gate, and give the job its own API key: dev mode is per credential, so concurrent runs sharing a key can re-point each other’s session. The key needs SchemaUpdate, SchemaRead, SchemaUpdateDevBranches, and DeploymentRead on the deployment.
To compile and query the generated cubes before merging, see dbt sync as a CI test gate.