Transform Data with dbt
On this page
The dbt-singlestore
adapter can be used to connect with your SingleStore database to build data transformation pipelines using dbt.SELECT
statements.
Prerequisites
The dbt-singlestore
adapter is compatible with the the following versions:
SingleStore |
dbt |
---|---|
7. |
1. |
Download and Install the SingleStore dbt Adapter
You can download the dbt-singlestore
adapter from the Python Package Index repository (PyPI).
pip install dbt-singlestore
You can also install the package from GitHub:
pip install git+https://github.com/memsql/dbt-singlestore.git
Configure the SingleStore Profile
dbt uses the profiles.
default:outputs:dev:type: singlestorehost: <database_host>port: <database_port>user: <database_user>password: <database_user_password>database: <database_name> # requiredschema: <name_for_dbt_internal_processing> # requiredthreads: <number of threads> # default: 1target: dev
Note
Always specify the type
as singlestore
.type
either in profiles.
Configuration |
Description |
Required |
---|---|---|
|
The IP address or the hostname of the SingleStore cluster. |
No |
|
The SingleStore database username. |
No |
|
Password of the SingleStore user. |
No |
|
The name of the SingleStore database. |
Yes |
|
Yes |
|
|
The number of threads available to dbt. |
No |
Schema and Concurrent Development
In SingleStore, database and schema denote the same concepts.schema
in profile.
To support concurrent development, prefix the table names that dbt is building within the database with schema
.schema
:
{% macro generate_alias_name(custom_alias_name=none, node=none) -%}
{%- if custom_alias_name is none -%}
{{ node.schema }}__{{ node.name }}
{%- else -%}
{{ node.schema }}__{{ custom_alias_name | trim }}
{%- endif -%}
{%- endmacro %}
For example, if you have a model named customers
and schema
is set to dev
, without this macro, dbt creates a table named customers
in the database.dev_
.
See SingleStore Profile for more information.
Last modified: September 27, 2023