-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/224/distkey-error-message
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Support DISTSTYLE for seeds | ||
time: 2023-08-03T11:11:46.571996-06:00 | ||
custom: | ||
Author: WillAyd | ||
Issue: "255" |
24 changes: 24 additions & 0 deletions
24
dbt/include/redshift/macros/materializations/seeds/helpers.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
{% macro redshift__create_csv_table(model, agate_table) %} | ||
{%- set column_override = model['config'].get('column_types', {}) -%} | ||
{%- set quote_seed_column = model['config'].get('quote_columns', None) -%} | ||
{%- set _dist = model['config'].get('dist', None) -%} | ||
|
||
{% set sql %} | ||
create table {{ this.render() }} ( | ||
{%- for col_name in agate_table.column_names -%} | ||
{%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%} | ||
{%- set type = column_override.get(col_name, inferred_type) -%} | ||
{%- set column_name = (col_name | string) -%} | ||
{{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%} | ||
{%- endfor -%} | ||
) | ||
{{ dist(_dist) }} | ||
{% endset %} | ||
|
||
{% call statement('_') -%} | ||
{{ sql }} | ||
{%- endcall %} | ||
|
||
{{ return(sql) }} | ||
{% endmacro %} | ||
|
||
{% macro redshift__get_batch_size() %} | ||
{{ return(500) }} | ||
{% 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