A small package
Project description
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
dbt
at the start. All dbt commands should be valid e.grun
,test
, et cetera.
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_run_api-0.0.6.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for dbt_run_api-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9a7a995f22f7b310849e3536680ad42ee6c4c7213e79af0feb5768df1b9b147 |
|
MD5 | 3c511f16448d05f823e56363f80f8060 |
|
BLAKE2b-256 | cc26bba453d2e69556427a3728bac31e18f59b7e06f15cdb9e6835bb26d30eec |