Skip to main content

The TiDB adapter plugin for dbt

Project description

dbt-tidb

PyPI PyPI - Python Version PyPI - Downloads Integration Test

The dbt-tidb package contains all of the code enabling dbt to work with TiDB.

This repository is partly based on dbt-mysql. Thanks to them for their excellent work.

Table of Contents

Installation

Compile by source code.

$ git clone https://github.com/pingcap/dbt-tidb.git
$ cd dbt-tidb
$ pip install .

Also, you can get it from pypi.

$ pip install dbt-tidb

Supported features

TiDB 4.X TiDB 5.0 ~ 5.2 TiDB >= 5.3 Feature
Table materialization
View materialization
Incremental materialization
Ephemeral materialization
Seeds
Sources
Custom data tests
Docs generate
Snapshots

Note:

  • TiDB 4.0 ~ 5.0 does not support CTE, you should avoid using WITH in your SQL code.
  • TiDB 4.0 ~ 5.2 does not support creating a temporary table or view.
  • TiDB 4.X does not support using SQL func in CREATE VIEW, avoid it in your SQL code. You can find more detail here.

Profile Configuration

TiDB targets should be set up using the following configuration in your profiles.yml file.

Example entry for profiles.yml:

your_profile_name:
  target: dev
  outputs:
    dev:
      type: tidb
      server: 127.0.0.1
      port: 4000
      schema: database_name
      username: tidb_username
      password: tidb_password
Option Description Required? Example
type The specific adapter to use Required tidb
server The server (hostname) to connect to Required yourorg.tidb.com
port The port to use Required 4000
schema Specify the schema (database) to build models into Required analytics
username The username to use to connect to the server Required dbt_admin
password The password to use for authenticating to the server Required correct-horse-battery-staple

Database User Privileges

Your database user would be able to have some abilities to read or write, such as SELECT, CREATE, and so on. You can find some help here with TiDB privileges management.

Required Privilege
SELECT
CREATE
CREATE TEMPORARY TABLE
CREATE VIEW
INSERT
DROP
SHOW DATABASE
SHOW VIEW
SUPER

Running Tests

See tests/README.md for details on running the integration tests.

Example

Click here to see a simple example about using dbt with dbt-tidb.

Contributing

Welcome to contribute for dbt-tidb. See Contributing Guide for more information.

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-tidb-1.1.1.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

dbt_tidb-1.1.1-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file dbt-tidb-1.1.1.tar.gz.

File metadata

  • Download URL: dbt-tidb-1.1.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for dbt-tidb-1.1.1.tar.gz
Algorithm Hash digest
SHA256 9f8a03af1c92d836f767ad08e0241a80914d13b956a107a15b8af5f090a93d86
MD5 afc3621e61c44abd28d0dc5ef89c60bf
BLAKE2b-256 1dd2dcc66ff7e8c89d0704b13c185db732fcb40cf417c614622e400bc2c28f7d

See more details on using hashes here.

File details

Details for the file dbt_tidb-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: dbt_tidb-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for dbt_tidb-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6aacc070cdb4a4204016d20dc035194ed58a2bf0696c579f93ea44e55470cc3
MD5 a70ebd84def3a584e3ba1b89a1be3888
BLAKE2b-256 ee63516a0d1a2416ac58a983268b14b2cbf97c71db7714f0b276445268b0b1db

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