dbt-run-api
Once installed allows DBT commands to be sent via an api call.
Installation:
pip install dbt-run-api
NOTE: currently the package comes with dbt-postgres. If you need another adapter then it would have to be install separately
Set up:
After installing the package ensure your DBT project is set up correctly with all needed profile variables either explicitly defined or available as ENV-variables.
Execution:
Run server while in the same directory as your `dbt_project.yml':
uvicorn dbt_run_api:app
Ensure you DBT project has access to the database you have defined in profile.yml
Send call to endpoint:
curl --header 'Content-Type: application/json' \
--request POST \
http://localhost:8000/dbt \
--data \
'{ "cmd": "run", "vars": {"test_var": "1", "date": "20240423"}, "target": "dev", "threads" : 8, "project-dir": "wab", "profiles-dir": "wab", "full-refresh": true}'
curl --header 'Content-Type: application/json' \
--request POST \
http://localhost:8000/dbt \
--data \
'{ "cmd": "test"}'
Notes:
- commands are passed without
dbtat the start. All dbt commands should be valid e.grun,test, et cetera.
Metadata
Release files for dbt-run-api 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dbt_run_api-0.2.2.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbt_run_api-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / dbt_run_api-0.2.2.tar.gz
| Download URL | dbt_run_api-0.2.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b013fd555f2cecd240f0beb540b125c905b2bd8084c08d442c1b74faf7ee5613
|
|
BLAKE2b-256 checksum How to use checksums |
aa6b676608e3147d8d66ef0ff816cc26efcf222d18807fe042703d7eb6b142c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / dbt_run_api-0.2.2-py3-none-any.whl
| Download URL | dbt_run_api-0.2.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34fce974145313cad56a2722288b600e369724fd23553a3ea94c846748352f00
|
|
BLAKE2b-256 checksum How to use checksums |
076840713d8417cab735f7d337ce60c8ca0359ebbc6a2fb72cb990ba62fba2c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|