dbt-rpc-client
A python SDK for interacting with a dbt rpc server.
Installation
$ pip install dbt-rpc-client
Basic Usage
from dbt_rpc_client import DbtRpcClient
import requests
rpc = DbtRpcClient(hostname="0.0.0.0", port=8580)
# Getting the current status of the dbt rpc server.
response = rpc.status()
assert isinstance(response, requests.Response)
assert response.ok
# Running dbt models via CLI command.
response = rpc.cli(cli_args="dbt run --models @model1 +model2+")
assert response.ok
# Running dbt models via `run` method.
response = rpc.run(models=["@model1", "+model2+"])
assert response.ok
# Polling a dbt rpc operation.
response = rpc.poll(request_token=response.get("id"))
assert response.ok
print(response.get("result").get("status"))
# Compiling/Running a SQL query.
sql = """
select 1
from {{ ref("my_dbt_model") }}
"""
response = rpc.compile_sql(sql=sql, name="my_sql_query")
assert response.ok
response = rpc.run_sql(sql=sql, name="my_sql_query")
assert response.ok
Contributing
- The first step to contributing is getting a copy of the source code. First, fork
dbt-rpc-clienton GitHub. Then,cdinto the directory where you want your copy of the source code to live and clone the source code:
$ cd repos
$ git clone git@github.com:YourGitHubName/dbt-rpc-client.git
- Now that you have a copy of the source code on your machine, create and activate a virtual envionment for
dbt-rpc-client:
$ python3 -mvenv ~/.venvs/dbt-rpc-client
$ source ~/.venvs/dbt-rpc-client/bin/activate
- Once inside the virtual environment, run
make dev_installat the root of the repository:
$ (dbt-rpc-client) make dev_install
- Run the tox testing suite in the appropriate python environment to ensure things are working properly:
$ (dbt-rpc-client) tox -e py37
To format your code using isort and flake8 before commiting changes, run the following commands:
$ (dbt-rpc-client) make isort
$ (dbt-rpc-client) make flake8
Once you've confirmed that your changes work and the testing suite passes, feel free to put out a PR!
Metadata
Release files for dbt-rpc-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dbt_rpc_client-0.1.0.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dbt_rpc_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / dbt_rpc_client-0.1.0.tar.gz
| Download URL | dbt_rpc_client-0.1.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f85e85b89a33439da47046bbb7a07ec62ef832e542e77c137f83fe929bb4d02
|
|
BLAKE2b-256 checksum How to use checksums |
33110057d0f3d78c4738f7d5464aec4e415f536c438097cb861542a4196f115e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.5
|
Release files / dbt_rpc_client-0.1.0-py3-none-any.whl
| Download URL | dbt_rpc_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0674ea01278c61d76af2fdaec54ce50fc1e6c2767cc7a8bc2a050c31e4bfab6
|
|
BLAKE2b-256 checksum How to use checksums |
3fd9b4ab8c4327cd0f8cc962296ac03dd2f3609b4625ada6160eb10c5a8b3c67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.5
|
Security for dbt-rpc-client 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.