-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add clickhouse and greenplum support (#460)
Co-authored-by: Grace Goheen <[email protected]> Co-authored-by: Benoit Perigaud <[email protected]>
- Loading branch information
1 parent
eaf8386
commit 34209f6
Showing
35 changed files
with
169 additions
and
76 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
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
2 changes: 1 addition & 1 deletion
2
integration_tests/exclude_package/models/staging/excluded_model.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,2 +1,2 @@ | ||
-- {{ source('fake_source', 'fake_source') }} | ||
select 1 as id | ||
select 1 as id |
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 |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
) | ||
}} | ||
|
||
-- {{ ref('int_model_5') }} | ||
select * from {{ ref('stg_model_4') }} | ||
-- {{ ref('int_model_5') }} |
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,54 @@ | ||
{%- macro clickhouse__type_string() -%} | ||
{{ 'Nullable(String)' }} | ||
{%- endmacro %} | ||
|
||
{%- macro clickhouse__type_int() -%} | ||
{{ 'Nullable(Int32)' }} | ||
{%- endmacro %} | ||
|
||
{%- macro clickhouse__type_float() -%} | ||
{{ 'Nullable(Float32)' }} | ||
{%- endmacro %} | ||
|
||
{%- macro clickhouse__type_boolean() -%} | ||
{{ 'Nullable(Bool)' }} | ||
{%- endmacro %} | ||
|
||
{% macro clickhouse__replace(string_text, pattern, replacement) -%} | ||
replaceAll(assumeNotNull({{string_text}}), {{pattern}}, {{replacement}}) | ||
{%- endmacro %} | ||
|
||
{% macro clickhouse__split_part(string_text, delimiter_text, part_number) -%} | ||
splitByChar({{delimiter_text}}, assumeNotNull({{string_text}}))[{{part_number}}] | ||
{%- endmacro %} | ||
|
||
{% macro clickhouse__listagg(measure, delimiter_text, order_by_clause, limit_num) -%} | ||
{% if order_by_clause and ' by ' in order_by_clause -%} | ||
{% set order_by_field = order_by_clause.split(' by ')[1] %} | ||
{% set arr = "arrayMap(x -> x.1, arrayReverseSort(x -> x.2, arrayZip(array_agg({}), array_agg({}))))".format(arr, order_by_field) %} | ||
{% else -%} | ||
{% set arr = "array_agg({})".format(measure) %} | ||
{%- endif %} | ||
|
||
{% if limit_num -%} | ||
arrayStringConcat(arraySlice({{ arr }}, 1, {{ limit_num }}), {{delimiter_text}}) | ||
{% else -%} | ||
arrayStringConcat({{ arr }}, {{delimiter_text}}) | ||
{%- endif %} | ||
{%- endmacro %} | ||
|
||
{% macro clickhouse__load_csv_rows(model, agate_table) %} | ||
{% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %} | ||
{% set data_sql = adapter.get_csv_data(agate_table) %} | ||
|
||
{% if data_sql %} | ||
{% set sql -%} | ||
insert into {{ this.render() }} ({{ cols_sql }}) | ||
{{ adapter.get_model_query_settings(model) }} | ||
format CSV | ||
{{ data_sql }} | ||
{%- endset %} | ||
|
||
{% do adapter.add_query(sql, bindings=agate_table, abridge_sql_log=True) %} | ||
{% 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
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
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
Oops, something went wrong.