> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetsilicon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dbt

> Connect a dbt project to Silicon, keep it in sync, and use metrics defined in dbt

[dbt](https://docs.getdbt.com/docs/introduction?version=2) is the industry-standard tool for transforming data in your warehouse. You write modular transformations as plain SQL `select` statements, and dbt handles the dependencies between them, builds the resulting tables and views, and tests them.

Silicon reads a connected dbt project and builds your [semantic layer](https://docs.meetsilicon.com/semantic-layer) from it. Your dbt models define *what the tables are*; the Silicon metadata in their YAML defines *what they mean* -- which columns are dimensions, which aggregations are metrics, how models join.

dbt is not required. If you don't use it, define the same semantic layer in [Silicon YAML](https://docs.meetsilicon.com/semantic-layer/yaml.md) instead. This area covers the dbt integration itself: connecting a project, keeping it in sync, moving definitions between Silicon and your repository, and what changes when you upgrade dbt.

For how to shape models so they explore well, see [modeling strategies](https://docs.meetsilicon.com/semantic-layer/modeling-strategies.md).

## Set up a dbt project

Before you start, you need a dbt project on your machine and a Silicon account. If you haven't used dbt before, [follow dbt's getting started guide](https://docs.getdbt.com/tutorial/setting-up) first.

### Install and log in to the CLI

Install the Silicon CLI with [Homebrew](https://brew.sh) on macOS, Linux, or Windows through WSL:

```bash theme={null}
brew tap silicon/silicon
brew trust silicon/silicon
brew install silicon
silicon --version
```

For other install methods, such as a direct binary download or npm, see [Install the Silicon CLI](https://docs.meetsilicon.com/workflow/cli/install.md).

Silicon generates a personal access token for you during onboarding and shows the login command to copy into your terminal:

```bash theme={null}
silicon login https://{{ silicon_domain }} --token my-super-secret-token
```

`{{ silicon_domain }}` is the domain you use to open Silicon, for example `app.meetsilicon.com`. For other login methods, see [Authenticate the CLI](https://docs.meetsilicon.com/workflow/cli/authenticate.md).

### Generate your first Tables

If you use dbt Cloud, [clone your repository to your local machine](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) first.

From the folder that contains your `dbt_project.yml` file, run:

```bash theme={null}
silicon dbt run
```

The command documents every column in your models as a dimension and generates a Table for each model. For example, a `leads.yml` file becomes a Table called `Leads` with the dimensions `Lead id`, `User id`, and `Sdr`.

If you see `Error: Not a dbt project (or any of the parent directories). Missing dbt_project.yml file`, change into your dbt project folder and run the command again. To generate Tables for only some models, pass [dbt's model selection syntax](https://docs.getdbt.com/reference/node-selection/syntax). The examples under **Choose which models become Tables** below show common patterns.

### Create your project

Create the Silicon project and follow the link the CLI prints to start exploring:

```bash theme={null}
silicon deploy --create
```

Silicon creates the project with the connection details from your local `profiles.yml`. Next, [update your connection settings](https://docs.meetsilicon.com/integrations/connect-project.md) to switch to a service account and connect your version-controlled dbt project, so Silicon stays in sync with your repository. To compare CLI deploys with a git connection, see [Syncing dbt projects](https://docs.meetsilicon.com/integrations/dbt/projects.md#which-method-should-i-use).

## What are Tables?

Tables are the starting point for any data exploration in Silicon -- they're the data you can query. Silicon stays in sync with your dbt project, so Tables come from the dbt models defined in your project's YAML files. If a dbt model has a YAML definition, it shows up in Silicon as a Table.

> [!TIP]
>
> Not sure what a YAML file is? [Check out dbt's docs on model properties](https://docs.getdbt.com/reference/model-properties) to learn about adding YAML files for your dbt models.

### Choose which models become Tables

`silicon dbt run` documents every column in your models as a dimension and generates a Table for each one. It supports [dbt's model selection syntax](https://docs.getdbt.com/reference/node-selection/syntax), so you can generate Tables for your whole project at once or narrow to a subset -- for example, everything tagged `silicon`:

```bash theme={null}
silicon dbt run                                        # every model with a YAML definition
silicon dbt run -s tag:silicon                       # all models with the silicon tag
silicon dbt run -s payments                            # just payments
silicon dbt run -s payments+                           # payments and all children
silicon dbt run -s +payments                           # payments and all parents
silicon dbt run -s payments+ +customers tag:silicon  # mix and match
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.