dbt-expectations is a Shell library. dbt-expectations has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
Port(ish) of Great Expectations to dbt test macros
Support
Quality
Security
License
Reuse
Support
dbt-expectations has a low active ecosystem.
It has 722 star(s) with 88 fork(s). There are 15 watchers for this library.
It had no major release in the last 12 months.
There are 24 open issues and 104 have been closed. On average issues are closed in 28 days. There are 5 open pull requests and 0 closed requests.
It has a neutral sentiment in the developer community.
The latest version of dbt-expectations is 0.8.5
Quality
dbt-expectations has 0 bugs and 0 code smells.
Security
dbt-expectations has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
dbt-expectations is licensed under the Apache-2.0 License. This license is Permissive.
Permissive licenses have the least restrictions, and you can use them in most projects.
Reuse
dbt-expectations releases are available to install and integrate.
Installation instructions, examples and code snippets are available.
It has 97 lines of code, 0 functions and 1 files.
It has low code complexity. Code complexity directly impacts maintainability of the code.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework. Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dbt-expectations
Get all kandi verified functions for this library.
dbt-expectations Key Features
No Key Features are available at this moment for dbt-expectations.
dbt-expectations Examples and Code Snippets
No Code Snippets are available at this moment for dbt-expectations.
DBT - Test that column values verify specific date format
Asked 2021-Dec-23 at 02:37
I'm using DBT to transform data from source table whith all STRING fields to target table with TYPED fields (eg: DATE, INT, ...)
I would like to ensure (using dbt test command) that datatype conversion is possible before to launch the dbt run command. For instance on expected DATE fields (in STRING in my source table), an assert must be run on the whole column values to pass the test.
On dbt-expectations package, there are some useful tests like "expect_column_values_to_be_of_type", but this test checks the column datatype (in table's structure) instead of checking if all column values match a specific datatype.
Do you have any idea to avoid writing a custom test and use a native or packaged one?
EDIT: candidate should be "expect_column_values_to_match_regex", but perhaps a better one...
Thank you very much for help :)
...
ANSWER
Answered 2021-Dec-23 at 02:37
In the dbt package - dbt-expectations, I think that expect_column_values_to_match_regex and expect_column_values_to_not_match_regex are the best fit to your requirement.
Actually you can use dbt-utils.expression_is_true to write your own SQL. Also, you've asked about native, that's the way doing with native SQL.
dbt-expectations currently supports dbt 0.21.x. Check dbt Hub for the latest installation instructions, or read the docs for more information on installing packages. For latest release, see https://github.com/calogica/dbt-expectations/releases.
Support
Expect the specified column to exist. Expect the model to have rows that are at least as recent as the defined interval prior to the current timestamp. Optionally gives the possibility to apply filters on the results. Expect the model to have grouped rows that are at least as recent as the defined interval prior to the current timestamp. Use this to test whether there is recent data for each grouped row defined by group_by (which is a list of columns) and a timestamp_column. Optionally gives the possibility to apply filters on the results. Applies to: Model, Seed, Source. Expect the number of columns in a model to be between two values. Applies to: Model, Seed, Source. Expect the number of columns in a model to match another model. Applies to: Model, Seed, Source. Expect the columns in a model to contain a given list. Applies to: Model, Seed, Source. Expect the number of columns in a model to be equal to expected_number_of_columns. Applies to: Model, Seed, Source. Expect the columns to exactly match a specified list. Applies to: Model, Seed, Source. Expect the columns in a model to match a given list. Applies to: Model, Seed, Source. Expect the number of rows in a model to be between two values. Applies to: Model, Seed, Source. Expect the number of rows in a model match another model. Applies to: Model, Seed, Source. Expect the number of rows in a model to match another model times a preconfigured factor. Applies to: Model, Seed, Source. Expect the number of rows in a model to be equal to expected_number_of_rows. Applies to: Model, Seed, Source. Expect each column value to be unique. Expect column values to not be null. Expect column values to be null. Expect a column to be of a specified data type. Expect a column to be one of a specified type list. Expect each column value to be in a given set. Expect each column value to be between two values. Expect each column value not to be in a given set. Expect column values to be increasing. If strictly: True, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures. Expect column values to be decreasing. If strictly=True, then this expectation is only satisfied if each consecutive value is strictly increasing–equal values are treated as failures. Expect column entries to be strings with length between a min_value value and a max_value value (inclusive). Expect column entries to be strings with length equal to the provided value. Expect column entries to be strings that match a given regular expression. Valid matches can be found anywhere in the string, for example "[at]+" will identify the following strings as expected: "cat", "hat", "aa", "a", and "t", and the following strings as unexpected: "fish", "dog". Expect column entries to be strings that do NOT match a given regular expression. The regex must not match any portion of the provided string. For example, "[at]+" would identify the following strings as expected: "fish”, "dog”, and the following as unexpected: "cat”, "hat”. Expect the column entries to be strings that can be matched to either any of or all of a list of regular expressions. Matches can be anywhere in the string. Expect the column entries to be strings that do not match any of a list of regular expressions. Matches can be anywhere in the string. Expect column entries to be strings that match a given SQL like pattern. Expect column entries to be strings that do not match a given SQL like pattern. Expect the column entries to be strings that match any of a list of SQL like patterns. Expect the column entries to be strings that do not match any of a list of SQL like patterns. Expect the number of distinct column values to be equal to a given value. Expect the number of distinct column values to be greater than a given value. Expect the set of distinct column values to be contained by a given set. Expect the set of distinct column values to contain a given set. In contrast to expect_column_values_to_be_in_set this ensures not that all column values are members of the given set but that values from the set must be present in the column. Expect the set of distinct column values to equal a given set. In contrast to expect_column_distinct_values_to_contain_set this ensures not only that a certain set of values are present in the column but that these and only these values are present. Expect the number of distinct column values to be equal to number of distinct values in another model. Applies to: Model, Column, Seed, Source.