Skip to main content

No project description provided

Project description

A test suite for adapter plugins.

Installation and use

pip install pytest-dbt-adapter

You'll need to install this package with pip install pytest-dbt-adapter and write a specfile, which is a yaml file ending in .dbtspec. See the included spark/postgres examples in specs. You can also write custom test sequences and override existing default projects.

After installing this package, you should be able to run your spec with pytest path/to/mytest.dbspec. You'll need dbt-core and your adapter plugin installed in the environment as well.

Specs

A spec is composed of a minimum of two things:

  • a target block
  • a sequences block
    • The keys are test names. You can select from these names with pytest's -k flag.
    • The values are test sequence definitions.

Optionally, there is also:

  • a projects block

Targets

A target block is just like a target block you'd use in dbt core. However, there is one special change: the schema field should include a {{ var('_dbt_random_suffix') }} somewhere that the test suite will insert.

Sequences

A sequence has a name (the sequence name), a project (the project name to use), and sequence (a collection of test steps). You can declare new sequences inline, or use the name of a builtin sequence. A sequence itself is just a list of steps. You can find examples in the form of the builtin sequences in the sequences/ folder.

You are encouraged to use as many sequences as you can from the built-in list without modification.

Projects

The minimum project contains only a name field. The value is the name of the project - sequences include a project name.

A project also has an optional paths block, where the keys are relative file paths (to a dbt_project.yml that will be written), and the values are the contents of those files.

There is a dbt_project_yml block, which should be a dictionary that will be updated into the default dbt_project.yml (which sets name, version, and config-version).

Instead of declaring a name field, a project definition may have an overrides field that names a builtin project. The test suite will update the named builtin project with those overrides, instead of overwriting the full project with a new one.

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

pytest-dbt-adapter-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_dbt_adapter-0.1.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-dbt-adapter-0.1.0.tar.gz.

File metadata

  • Download URL: pytest-dbt-adapter-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for pytest-dbt-adapter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dde14621134abe634328d8261ef2aa64f6da1d89c2113fabd209caac340b0fcc
MD5 6a8a698be7c5df7814cd7da3e8f5f049
BLAKE2b-256 7161adb0e23c1bef129d52e07fac9a13e64b04bd9a167533398f544e324f0689

See more details on using hashes here.

File details

Details for the file pytest_dbt_adapter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_dbt_adapter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for pytest_dbt_adapter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88c02c28dd56456f13b11176e2008cb0dc2be74483d4f4a5d32c6ac0faf8abdd
MD5 409d00516af4b466789f8217402a84cb
BLAKE2b-256 068cfdb9df04c03067ee5d63e929af44365ada9164723d1f67bb0dab67984074

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page