-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-2917] Add ability to use csv file fixtures for inputs/expected in addition to inline yaml dict/csv #8290
Comments
This capability should probably also be available for Here's a first stab at what this spec could look like:
But its worth considering whether the
either way, should a single test case be able to use multiple different input formats? for example, |
A few thoughts here, in somewhat of a random order: The default for I'm curious about the implications for using something other than How do you feel about specifying the path to the csv file (ex: I think there could be some confusion with specifying the file path - is it the relative path? the path from the root directory? Should we havea unit-paths config in the I think we should definitely support
In the same vein, is the #dbt_project.yml
unit:
format: csv_file I do think we should support variability of |
|
Split out the |
From refinement: If I have a csv file -
This feels similar to how defined_in for model versions work: Note: this means that fixture names must be unique. |
Notes from refinement:
|
resolved by #9044 |
Description
The initial implement of unit testing specifies input rows and expected rows via yaml dictionaries or inline csv. Some users of this feature would prefer to use csv files, particularly for tables with many columns. Enable a "fixture" specifier for
format: csv
and implement ingesting and running csv files as unit test inputs.Fixtures are csv files in the
tests/fixtures
folder (or whatever you've configured for test-paths).If I have a csv file -
tests/fixtures/my_model_a_fixture.csv
- this is the definition of my fixture namedmy_model_a_fixture
(similar to how if I have a sql filemodels/my_model_a.sql
that is the definition of my model namedmy_model_a
), and I can reference that fixture in my yml with the fixture name:Note: this means fixture names must be unique, but they do not need to be the same name as the corresponding model
For test coverage purposes, we may want to store the column names somewhere. It may also be necessary or useful to specify the column data types.
Acceptance Criteria
Impact to Other Teams
None
Will backports be required?
No
Context
Note: This ticket will not handle data types, that will be covered in #8649
The text was updated successfully, but these errors were encountered: