-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add column data types * Update tests to include data_type field * Update macros to produce lowercase strings * Update generate_source_yaml to lower data_type field * Add include_data_types arg to generate_model_yaml Set to true as default; update tests * Update default include_data_types in generate_source * Update README and changelog * source -> model * Use dbt.formt_column or fall back to vendored version * Fix typo * Add missing spaces * Remove args from text_type_value and integer_type_value * Final newline * We need these parentheses * snowflake wants varchar * elif * Vendor the `format_column` macro from dbt-core into dbt-codegen * Completely rely on vendored version of the `format_column` macro * Default `include_data_types=True` for the `generate_source` macro * Alert to change in behaviors for `generate_source` * Fix example by using a boolean instead of a string that will not work * Example how to configure `include_data_types` to align with previous behavior * Standardize formatting of default values * Fix format_column is undefined error * Enable custom overrides of data type formatting via multiple dispatch --------- Co-authored-by: Lin Taylor <[email protected]> Co-authored-by: Doug Beatty <[email protected]> Co-authored-by: Doug Beatty <[email protected]>
- Loading branch information
1 parent
8cee762
commit da3731b
Showing
14 changed files
with
97 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{%- macro integer_type_value() -%} | ||
{%- if target.type == "snowflake" -%} | ||
NUMBER(38,0) | ||
number | ||
{%- elif target.type == "bigquery" -%} | ||
INT64 | ||
int64 | ||
{%- else -%} | ||
INTEGER | ||
integer | ||
{%- endif -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{%- macro text_type_value(text_length) -%} | ||
{%- if target.type == "redshift" -%} | ||
CHARACTER VARYING({{ text_length }}) | ||
{%- macro text_type_value() -%} | ||
{%- if target.type == "redshift"-%} | ||
character varying | ||
{%- elif target.type == "snowflake" -%} | ||
CHARACTER VARYING(16777216) | ||
varchar | ||
{%- elif target.type == "bigquery" -%} | ||
STRING | ||
string | ||
{%- else -%} | ||
TEXT | ||
text | ||
{%- endif -%} | ||
{%- endmacro -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
integration_tests/tests/test_generate_model_yaml_multiple_models.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
integration_tests/tests/test_generate_model_yaml_upstream_descriptions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% macro format_column(column) -%} | ||
{% set data_type = column.dtype %} | ||
{% set formatted = column.column.lower() ~ " " ~ data_type %} | ||
{{ return({'name': column.name, 'data_type': data_type, 'formatted': formatted}) }} | ||
{%- endmacro -%} |