The TiDB adapter plugin for dbt
Project description
dbt-tidb
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
- Supported features
- Profile Configuration
- Database User Privileges
- Running Tests
- Example
- Contributing
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dbt-tidb-1.1.2.tar.gz
.
File metadata
- Download URL: dbt-tidb-1.1.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c245458f1e35292b4e1250ccf10586b6f668c95042783ccd4c5f215217fa07e |
|
MD5 | 39f35716a522aed7ddaecfe0c9fdd7a1 |
|
BLAKE2b-256 | 4fe9be1d5fb7233296ebd0c1a843e09310a3f721543a2463e0cb3a9b144b6448 |
File details
Details for the file dbt_tidb-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: dbt_tidb-1.1.2-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e44a78ef4bc823c98c355a7792c8d8accce868c4dd4cd8bc81859fbef0fd9406 |
|
MD5 | ec02330caebb1758fc1c78918658c911 |
|
BLAKE2b-256 | db7e03a0f5b787de6565a544b102ba010e61fd66ca652adaa3928d58c4c9ef71 |