Skip to main content

The dbt adapter plugin for connecting to MindsDB

Project description

🚧 dbt-mindsdb 🚧

The dbt-mindsdb package allows dbt to connect to MindsDB.

Installation

Atm, can only be installed from source:

git clone git@github.com:mindsdb/dbt-mindsdb.git
python setup.py develop

There is an dependency issue with latest dbt-core, so make sure to run:

pip install markupsafe==2.0.1

Configurations

Basic profile.yml for connecting to MindsDB:

mindsdb:
  outputs:
    dev:
      database: 'mindsdb'
      host: '127.0.0.1'
      password: ''
      port: 47335
      schema: 'mindsdb'
      type: mindsdb
      username: 'mindsdb'
  target: dev
Key Required Description Example
type ✔️ The specific adapter to use mindsdb
host ✔️ The MindsDB (hostname) to connect to cloud.mindsdb.com
port ✔️ The port to use 3306 or 47335
schema ✔️ Specify the schema (database) to build models into The MindsDB datasource
username ✔️ The username to use to connect to the server mindsdb or mindsdb cloud user
password ✔️ The password to use for authenticating to the server `pass

Usage

  • Create dbt project, choose mindsdb database and set up connection
    dbt init <project_name>
  • To create predictor add dbt model with "predictor" materialization: Name of the model is used as name of predictor. Parameters:
    • integration - name of used integration to get data from and save result to. In has to be created in mindsdb beforehand
    • predict - field for prediction
    • predict_alias [optional] - alias for predicted field
    • using [optional] - options for configure trained model
    {{
        config(
            materialized='predictor',
            integration='photorep',
            predict='name',
            predict_alias='name',
            using={
                'encoders.location.module': 'CategoricalAutoEncoder',
                'encoders.rental_price.module': 'NumericEncoder'
            }
        )
    }}
      select * from stores
  • To apply predictor add dbt model with "table" materialization. It creates or replaces table in selected integration with results of predictor. Name of the model is used as name of the table to store prediction results. If you need to specify schema you can do it with dot separator: schema_name.table_name.sql
    Parameters:
    • predictor_name - name of using predictor. It has to be created in mindsdb
    • integration - name of used integration to get data from and save result to. In has to be created in mindsdb beforehand
    {{ config(materialized='table', predictor_name='TEST_PREDICTOR_NAME', integration='int1') }}
        select a, bc from ddd where name > latest

Testing

  • Install dev requirements
  pip install -r dev_requirements.txt
  • Run pytest
  python -m pytest tests/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt-mindsdb-1.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

dbt_mindsdb-1.0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file dbt-mindsdb-1.0.2.tar.gz.

File metadata

  • Download URL: dbt-mindsdb-1.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for dbt-mindsdb-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1687eacabab346c9f70366051036285a255a870df5fa5d8b6d24ab1d73c1cf79
MD5 d5a1237b91fa410fbb5b0b6dde3774cd
BLAKE2b-256 e7d1ea3b5d6b20db204c7ae331a2a25f2ab5ed8b8303dfeff3b95d7f72ace04a

See more details on using hashes here.

File details

Details for the file dbt_mindsdb-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: dbt_mindsdb-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for dbt_mindsdb-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb4264410abbc357710b34cf049c9576d6f5640f43c8449c322335a44337c46a
MD5 665d67acc5bc68a6f275abb3e2f116a2
BLAKE2b-256 6ba90ffa00532cc31a6b67241f19d4dadc5de911d6d2e0150af4160c4cc912ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page