Skip to main content

The Infer adapter plugin for dbt

Project description

Infer logo dbt logo

Unit Tests Badge

dbt-infer

The dbt adapter for Infer. dbt-infer allows you to connect your dbt instance to Infer and use SQL-inf syntax in your dbt models.

dbt-infer acts as a layer between your existing data warehouse and your dbt instance, enabling you to perform advanced analytics and machine learning within your dbt models.

SQL-inf

SQL-inf is an extension of SQL that introduces machine learning primitives to SQL. These primitives can be used within any part of your SQL queries, or DBT models, and allow you to build advanced analytics use cases using them as building blocks.

Read more about SQL-inf here.

Examples

Some illustrative examples based on an idealised table users with some simple demographic data, whether the user has churned or not, their lifetime value(LTV) and a text field with customer feedback.

More examples and tutorials here.

Predict column has_churn from the other columns in the table users.

SELECT * FROM users PREDICT(has_churned)

Understand what columns drive values of has_churned

SELECT * FROM users EXPLAIN(PREDICT(has_churned))

Predict and understand the LTV in column ltv from table users.

SELECT * FROM users PREDICT(ltv)
SELECT * FROM users EXPLAIN(PREDICT(ltv))

Perform text analysis, sentiment and topic analysis, on user feedback

SELECT * FROM users SENTIMENT(feedback)
SELECT * FROM users TOPICS(feedback)

Create user segmentations on demographics

SELECT age, location, gender, job, education FROM users CLUSTER()

Find the sizes of the user segmentations

SELECT cluster_id, COUNT(*) as size FROM (
    SELECT age, location, gender, job, education FROM users CLUSTER()
) GROUP BY cluster_id

Find users similar to the user with user_id=123

SELECT * FROM users SIMILAR_TO(user_id=123)

Analyse what, if any, demographic features drive feedback sentiment

SELECT age, location, gender, job, education, prediction FROM (
    SELECT * FROM users SENTIMENT(feedback)
) EXPLAIN(PREDICT(prediction))

Installation

Detailed installation and setup guide here.

Requirements

You should be using dbt 1.2 or later.

Setup Infer account

First you need to setup your Infer account and generate your api key.

Read about how to do that here.

Install dbt-infer

pip install dbt-infer

Setting up dbt-infer

Setup a target in your profile for dbt-infer with the following shape

<target_name>:
  url: <infer-api-endpoint>
  username: <infer-api-username>
  apikey: <infer-apikey>
  type: infer
  data_config:
    <here goes your normal data warehouse config>

where data_config contains the profile settings for your underlying data warehouse.

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-infer-1.2.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

dbt_infer-1.2.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file dbt-infer-1.2.1.tar.gz.

File metadata

  • Download URL: dbt-infer-1.2.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.11

File hashes

Hashes for dbt-infer-1.2.1.tar.gz
Algorithm Hash digest
SHA256 a8dfa330a92a73611147a2fbb48f12d10ffbe184d869bf0fa52f1e3a73677290
MD5 fa82c11192b4cb0e5fe1764cea3e2a2d
BLAKE2b-256 e0c3653efc1cf5efb831a65652550fc69bd5c7ecf78416fc6f247a1802484579

See more details on using hashes here.

File details

Details for the file dbt_infer-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: dbt_infer-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.11

File hashes

Hashes for dbt_infer-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16f400ce694e8e28e18d3c7491774f276bd902c75bfe35a1c24e8913e18966cc
MD5 cfdb076ec4f83ca0abc30f4a70f6c143
BLAKE2b-256 4a68d4cf07f358e3006d27b0ddf70bcdc4cc24f278d9fa45dcb63f58380dd1fd

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