You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This macro generates the unit testing YAML for a given model with all references included as `given` inputs (along with their columns), plus the columns within the expected output.
403
+
404
+
### Arguments:
405
+
406
+
-`model_name` (required): The model you wish to generate unit testing YAML for.
407
+
-`inline_columns` (optional, default=False): Whether you want all columns on the same line.
408
+
409
+
### Usage:
410
+
411
+
1. Create a model with your original SQL query
412
+
2. Call the macro as an [operation](https://docs.getdbt.com/docs/using-operations):
3. The new YAML - with all given inputs included - will be logged to the command line
419
+
420
+
```yaml
421
+
unit_tests:
422
+
- name: unit_test_order_items
423
+
model: order_items
424
+
425
+
given:
426
+
- input: ref("stg_order_items")
427
+
rows:
428
+
- col_a:
429
+
col_b:
430
+
431
+
expect:
432
+
rows:
433
+
- id:
434
+
```
435
+
436
+
4. Create a new YAML file with the compiled or logged code.
437
+
5. Add column values for the given inputs and expected output.
438
+
397
439
## Contributing
398
440
399
441
To contirbute code to this package, please follow the steps outlined in the `integration_tests` directory's [README](https://github.com/dbt-labs/dbt-codegen/blob/main/integration_tests/README.md) file.
0 commit comments