How to Set Up an Infer Account for dbt Models?
To use SQL-inf in dbt models, it is essential to set up an Infer account and generate an API key for the connection. This process is thoroughly explained in the Getting Started Guide. Additionally, the adapter package for the underlying data warehouse needs to be installed. For instance, if the data warehouse is BigQuery, the dbt-bigquery package is required.
pip install dbt-bigquery
The above code is an example of how to install the dbt-bigquery package using pip, a package installer for Python. This step is crucial if your data warehouse is BigQuery.
- Keyword: Infer Account - An account on Infer is required to connect dbt models with SQL-inf.
- Keyword: API Key - A unique identifier required to establish a connection between Infer and dbt.
- Keyword: dbt-bigquery package - A necessary package if the underlying data warehouse is BigQuery.
How to Connect to Infer from Your dbt Instance?
To establish a connection to Infer from your dbt instance, a correct profile in your profiles.yml needs to be set up. This profile will contain the necessary details for the connection.
profiles.yml:
target: dev
outputs:
dev:
type: bigquery
method: service-account
project: my-project
dataset: my-dataset
threads: 1
timeout_seconds: 300
location: US
priority: interactive
retries: 1
The above code is an example of how to set up a profile in profiles.yml for a BigQuery data warehouse. It includes the necessary parameters like project, dataset, location, etc. required for the connection.
- Keyword: profiles.yml - A YAML file where the profile for the connection to Infer is set up.
- Keyword: Connection - The link established between the dbt instance and Infer using the profiles.yml.
What is the Ref Function in dbt?
The ref function in dbt is used to infer dependencies, ensuring that models are built in the correct order. It is a critical part of managing the build order of dbt models.
{{ ref('my_model') }}
The above code is an example of how to use the ref function in dbt. 'my_model' is the name of the model whose dependencies are to be inferred.
- Keyword: ref function - A function in dbt used to infer dependencies between models.
- Keyword: Dependencies - The order in which models are built in dbt.
What is dbt-infer?
dbt-infer is an adaptor that allows you to connect your dbt instance to Infer and use SQL-inf syntax in your dbt models. It is an essential tool for integrating Infer with dbt.
pip install dbt-infer
The above code is an example of how to install the dbt-infer adaptor using pip. This adaptor is necessary to use SQL-inf syntax in dbt models.
- Keyword: dbt-infer - An adaptor that enables the use of SQL-inf syntax in dbt models.
- Keyword: SQL-inf syntax - The syntax used in dbt models when connected to Infer.
How to Set Up a dbt Cloud Job?
A dbt Cloud job needs to be set up to run your dbt project. The "Generate docs on run" option should be enabled, and the token should have the "read metadata" permission. This setup allows the dbt project to be run and documented correctly.
dbt Cloud:
job:
name: my_job
enabled: true
generate_docs_on_run: true
token_permission: read_metadata
The above code is an example of how to set up a dbt Cloud job. It includes the necessary parameters like job name, whether it's enabled or not, whether to generate docs on run, and the token permission.
- Keyword: dbt Cloud job - A job set up in dbt Cloud to run a dbt project.
- Keyword: Generate docs on run - An option that needs to be enabled for proper documentation of the dbt project.
- Keyword: read metadata - A permission required for the token in the dbt Cloud job.