dbt-labs / dbt-codegen

Macros that generate dbt code
https://hub.getdbt.com/dbt-labs/codegen/latest/
Apache License 2.0
484 stars 106 forks source link

Source for specific tables #51

Closed rahulj51 closed 2 years ago

rahulj51 commented 2 years ago

This is a:

Description & motivation

Resolves #50 By default, generate_source generates the source definitions for all tables in a schema. With very big schemas, sometimes, you only wish to generate the schema for a selected set of tables. This PR adds an optional arg called table_names to generate_source that takes a list of tables.

Note on Testing

The instructions for testing locally were not clear but with some trial and error, the following steps were performed to run the integration tests

  1. Created a bigquery profile called integration_tests
  2. Ran the create_source_table operation using run-operation from console.
  3. Ran dbt sed to create the ...raw_data schema and the data__a_relation table within.
  4. Ran all integration tests
  5. Added a new test to check the added feature

Also tested on a real-life dbt project by including the package locally and running the generate_source command.

Checklist