The dbt-mariadb adapter lets you run dbt models against a MariaDB database by defining a profile, installing the adapter, and running dbt commands.
Create a dbt profile that points to your MariaDB host, install the dbt-mariadb
adapter, then run dbt debug
to confirm connectivity.
Run pip install dbt-mariadb~=1.7
. Version numbers must match your dbt-core major/minor release.
Place the profile under ~/.dbt/profiles.yml
. Supply type: mariadb
, host, user, password, port, and schema (database).Use a target called dev
for local work.
```yamlmy_shop: target: dev outputs: dev: type: mariadb server: mariadb.mycompany.com port: 3306 user: analytics password: "{{ env_var('DBT_MARIADB_PW') }}" schema: analytics threads: 4```
Inside your dbt project folder execute dbt debug --target dev
. All checks must return OK
before running models.
Yes.After connection, dbt run
compiles models to SQL that targets MariaDB tables such as Customers
, Orders
, and OrderItems
.
Create models/total_revenue.sql
: SELECT SUM(total_amount) AS total_revenue FROM Orders
.Then run dbt run -m total_revenue
.
Store passwords in environment variables and reference them with {{ env_var() }}
to avoid committing credentials.
dbt run
executes models, dbt test
enforces data quality, and dbt docs generate
builds searchable documentation—all against MariaDB.
Use dedicated analytics users, restrict write access, enable SSL, and manage schema evolution through pull requests.
.
No. The dbt-mariadb
adapter is community-maintained, but widely used in production.
Yes, but ensure target tables use a primary key and insert_overwrite
is supported in your MariaDB version.
Absolutely. CSV files in the data
folder load into MariaDB when you run dbt seed
.