Skip to main content

OpenDataDiscovery Action for dbt

Project description

OpenDataDiscovery dbt tests metadata collecting

PyPI version

CLI tool helps run and ingest dbt test to platform.

It can be used as separated CLI tool or within ODD CLI package which provides some useful additional features for working with OpenDataDiscovery.

Supported adapters

Adapter version
Snowflake ^1.6
Postgres ^1.6

Profiles inside the file looks different for each type of data source.

Snowflake host_settings value is created from field account. Field value should be <account_identifier> For example the URL for an account uses the following format: <account_identifier>.snowflakecomputing.com Example Snowflake account identifier hj1234.eu-central-1.

Supported tests types

  1. Generic tests
  2. Singular tests. Currently Singular tests are not supported.

Installation

pip install odd-dbt

To see all available commands

odd_dbt_test --help

Example

For each command that involves sending information to OpenDataDiscovery platform exists set of env variables:

  1. ODD_PLATFORM_HOST - Where you platform is
  2. ODD_PLATFORM_TOKEN - Token for ingesting data to platform (How to create token?)
  3. DBT_DATA_SOURCE_ODDRN - Unique oddrn string describes dbt source, i.e '//dbt/host/localhost'

It is recommended to add them as ENV variables or provide as flags to each command

export ODD_PLATFORM_HOST=http://localhost:8080
export ODD_PLATFORM_TOKEN=token***
export DBT_DATA_SOURCE_ODDRN=//dbt/host/localhost

Commands

create-datasource - helps to register dbt as data source at OpenDataDiscovery platform. User later for ingesting metadata.

odd_dbt_test create-datasource --name=my_local_dbt --dbt-host=localhost

ingest-test - Read results_run file under the target folder to parse and ingest metadata.

odd_dbt_test ingest-test --profile=my_profile

test - Proxy command to dbt test, then reads results_run file under the target folder to parse and ingest metadata.

odd_dbt_test test --profile=my_profile

Run commands programmatically

You could run that scrip to read, parse and ingest test results to the platform.

# ingest_test_result.py

from odd_dbt import config
from odd_dbt.domain.cli_args import CliArgs
from odd_dbt.libs.dbt import get_context
from odd_dbt.libs.odd import create_dbt_generator_from_oddrn
from odd_dbt.service.odd import ingest_entities
from odd_dbt.mapper.test_results import DbtTestMapper
from odd_dbt.mapper.lineage import DbtLineageMapper

cfg = config.Config()  # All fields can be set manually or read from ENV variables
client = config.create_odd_client(host=cfg.odd_platform_host, token=cfg.odd_platform_token)
generator = create_dbt_generator_from_oddrn(oddrn=cfg.dbt_data_source_oddrn)

cli_args = CliArgs.default()
context = get_context(cli_args=cli_args)

# Ingest lineage
data_entities = DbtLineageMapper(context=context, generator=generator).map()
ingest_entities(data_entities, client)

# Or ingest test results
data_entities = DbtTestMapper(context=context, generator=generator).map()
ingest_entities(data_entities, client)

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

odd_dbt-0.2.5.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

odd_dbt-0.2.5-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file odd_dbt-0.2.5.tar.gz.

File metadata

  • Download URL: odd_dbt-0.2.5.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.1 Linux/6.2.0-1011-azure

File hashes

Hashes for odd_dbt-0.2.5.tar.gz
Algorithm Hash digest
SHA256 c8ad8eac0b0f6c14f224fa2a93ab128186818de0eb47d620d13910969ef78ea1
MD5 37a912c2f98bd89b42c69bd0cdf9b7be
BLAKE2b-256 e184c696c386836fc4ba99c37d1d039027c6126d1b07542f6bd0051dad49c204

See more details on using hashes here.

File details

Details for the file odd_dbt-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: odd_dbt-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.1 Linux/6.2.0-1011-azure

File hashes

Hashes for odd_dbt-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 db8439452c8fd57b041ed34610e67bb4ffc9b72ad397719923cd308810f49628
MD5 c4641e6190481ef806d9f188ad31fd0b
BLAKE2b-256 ae9a77fb9d143c616d721b37ed1f60e70306caee0bd5cadd1882718e19846a3b

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