dbt-firebolt 1.6.2__py3-none-any.whl → 1.6.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dbt/adapters/firebolt/__init__.py +1 -1
- dbt/include/firebolt/macros/adapters.sql +10 -11
- dbt/include/firebolt/macros/catalog.sql +15 -25
- dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +107 -5
- {dbt_firebolt-1.6.2.dist-info → dbt_firebolt-1.6.4.dist-info}/METADATA +1 -1
- {dbt_firebolt-1.6.2.dist-info → dbt_firebolt-1.6.4.dist-info}/RECORD +9 -9
- {dbt_firebolt-1.6.2.dist-info → dbt_firebolt-1.6.4.dist-info}/LICENSE +0 -0
- {dbt_firebolt-1.6.2.dist-info → dbt_firebolt-1.6.4.dist-info}/WHEEL +0 -0
- {dbt_firebolt-1.6.2.dist-info → dbt_firebolt-1.6.4.dist-info}/top_level.txt +0 -0
@@ -168,17 +168,16 @@
|
|
168
168
|
#}
|
169
169
|
{% call statement('list_tables_without_caching', fetch_result=True) %}
|
170
170
|
|
171
|
-
SELECT
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
FROM information_schema.views
|
171
|
+
SELECT
|
172
|
+
table_catalog AS "database",
|
173
|
+
table_name AS "name",
|
174
|
+
'{{ relation.schema }}' AS "schema",
|
175
|
+
CASE
|
176
|
+
WHEN table_type = 'VIEW' THEN 'view'
|
177
|
+
ELSE 'table'
|
178
|
+
END AS "type"
|
179
|
+
FROM
|
180
|
+
information_schema.tables
|
182
181
|
{% endcall %}
|
183
182
|
{% set info_table = load_result('list_tables_without_caching').table %}
|
184
183
|
{{ return(info_table) }}
|
@@ -3,31 +3,21 @@ the columns (for instance, `is_nullable` is missing) but more could be added lat
|
|
3
3
|
|
4
4
|
{% macro firebolt__get_catalog(information_schemas, schemas) -%}
|
5
5
|
{%- call statement('catalog', fetch_result=True) %}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
, views.table_schema as table_schema
|
22
|
-
, 'VIEW' AS table_type
|
23
|
-
, views.table_name as table_name
|
24
|
-
, cols.column_name AS column_name
|
25
|
-
, cols.data_type AS column_type
|
26
|
-
, 'VIEW' as relation_type
|
27
|
-
, cols.ordinal_position as column_index
|
28
|
-
FROM information_schema.views views
|
29
|
-
JOIN information_schema.columns cols
|
30
|
-
USING(table_name)
|
6
|
+
SELECT
|
7
|
+
tbls.table_catalog AS table_database,
|
8
|
+
tbls.table_schema as table_schema,
|
9
|
+
table_type,
|
10
|
+
tbls.table_name as table_name,
|
11
|
+
cols.column_name as column_name,
|
12
|
+
cols.data_type AS column_type,
|
13
|
+
CASE
|
14
|
+
WHEN table_type = 'VIEW' THEN 'VIEW'
|
15
|
+
ELSE 'TABLE'
|
16
|
+
END AS relation_type,
|
17
|
+
cols.ordinal_position as column_index
|
18
|
+
FROM
|
19
|
+
information_schema.tables tbls
|
20
|
+
JOIN information_schema.columns cols USING (table_name)
|
31
21
|
{% endcall -%}
|
32
22
|
{{ return(load_result('catalog').table) }}
|
33
23
|
{%- endmacro %}
|
@@ -1,4 +1,12 @@
|
|
1
1
|
{% macro firebolt__create_external_table(source_node) %}
|
2
|
+
{% if source_node.external.strategy == 'copy' %}
|
3
|
+
{{ firebolt__create_with_copy_from(source_node) }}
|
4
|
+
{% else %}
|
5
|
+
{{ firebolt__create_with_external_table(source_node) }}
|
6
|
+
{% endif %}
|
7
|
+
{% endmacro %}
|
8
|
+
|
9
|
+
{% macro firebolt__create_with_external_table(source_node) %}
|
2
10
|
{%- set external = source_node.external -%}
|
3
11
|
{%- if 'partitions' in external -%}
|
4
12
|
{%- set columns = adapter.make_field_partition_pairs(source_node.columns.values(),
|
@@ -7,7 +15,6 @@
|
|
7
15
|
{%- set columns = adapter.make_field_partition_pairs(source_node.columns.values(),
|
8
16
|
[]) -%}
|
9
17
|
{%- endif -%}
|
10
|
-
-- {%- set partitions = external.partitions -%}
|
11
18
|
{%- set credentials = external.credentials -%}
|
12
19
|
{# Leaving out "IF NOT EXISTS" because this should only be called by
|
13
20
|
if no DROP IF is necessary. #}
|
@@ -18,10 +25,16 @@
|
|
18
25
|
{% endfor -%}
|
19
26
|
)
|
20
27
|
{% if external.url %} URL = '{{external.url}}' {%- endif %}
|
21
|
-
{%- if credentials %}
|
28
|
+
{%- if credentials and credentials.internal_role_arn %}
|
22
29
|
CREDENTIALS = (AWS_ROLE_ARN = '{{credentials.internal_role_arn}}'
|
23
|
-
|
24
|
-
|
30
|
+
{%- if credentials.external_role_id %}
|
31
|
+
AWS_ROLE_EXTERNAL_ID = '{{credentials.external_role_id}}'
|
32
|
+
{%- endif -%}
|
33
|
+
)
|
34
|
+
{% elif credentials and credentials.aws_key_id %}
|
35
|
+
CREDENTIALS = (AWS_KEY_ID = '{{credentials.aws_key_id}}'
|
36
|
+
AWS_SECRET_KEY = '{{credentials.aws_secret_key}}')
|
37
|
+
{%- endif %}
|
25
38
|
{%- if external.object_pattern -%} OBJECT_PATTERN = '{{external.object_pattern}}' {%- endif %}
|
26
39
|
{% if external.object_patterns -%}
|
27
40
|
OBJECT_PATTERN =
|
@@ -30,6 +43,95 @@
|
|
30
43
|
{{- ',' if not loop.last }}
|
31
44
|
{%- endfor %}
|
32
45
|
{%- endif %}
|
33
|
-
{%- if external.compression -%} COMPRESSION = {{external.compression}} {%- endif
|
46
|
+
{%- if external.compression -%} COMPRESSION = {{external.compression}} {%- endif %}
|
34
47
|
TYPE = {{ external.type }}
|
35
48
|
{% endmacro %}
|
49
|
+
|
50
|
+
{% macro firebolt__create_with_copy_from(source_node) %}
|
51
|
+
{# COPY FROM is only available in Firebolt 2.0. #}
|
52
|
+
{%- set external = source_node.external -%}
|
53
|
+
{%- set credentials = external.credentials -%}
|
54
|
+
{%- set options = external.options -%}
|
55
|
+
{%- set csv_options = options.csv_options -%}
|
56
|
+
{%- set error_file_credentials = options.error_file_credentials -%}
|
57
|
+
|
58
|
+
{# There are no partitions, but this formats the columns correctly. #}
|
59
|
+
{%- if 'partitions' in external -%}
|
60
|
+
{%- set columns = adapter.make_field_partition_pairs(source_node.columns.values(),
|
61
|
+
external.partitions) -%}
|
62
|
+
{%- else -%}
|
63
|
+
{%- set columns = adapter.make_field_partition_pairs(source_node.columns.values(),
|
64
|
+
[]) -%}
|
65
|
+
{%- endif -%}
|
66
|
+
COPY INTO {{source(source_node.source_name, source_node.name)}}
|
67
|
+
{%- if columns and columns | length > 0 %}
|
68
|
+
(
|
69
|
+
{%- for column in columns -%}
|
70
|
+
{{ column.name }}
|
71
|
+
{%- if column.default is not none %} DEFAULT {{ column.default }}{% endif %}
|
72
|
+
{%- if column.source_column_name is not none %} {{ '$' ~ loop.index0 }}{% endif %}
|
73
|
+
{{- ',' if not loop.last }}
|
74
|
+
{%- endfor -%}
|
75
|
+
)
|
76
|
+
{%- endif %}
|
77
|
+
FROM '{{external.url}}'
|
78
|
+
{%- if options %}
|
79
|
+
WITH
|
80
|
+
{%- if options.object_pattern %}
|
81
|
+
PATTERN = '{{options.object_pattern}}'
|
82
|
+
{%- endif %}
|
83
|
+
{%- if options.type %}
|
84
|
+
TYPE = {{ options.type }}
|
85
|
+
{%- endif %}
|
86
|
+
{%- if options.auto_create is not none %}
|
87
|
+
AUTO_CREATE = {{ options.auto_create | upper }}
|
88
|
+
{%- endif %}
|
89
|
+
{%- if options.allow_column_mismatch is not none %}
|
90
|
+
ALLOW_COLUMN_MISMATCH = {{ options.allow_column_mismatch | upper }}
|
91
|
+
{%- endif %}
|
92
|
+
{%- if options.error_file %}
|
93
|
+
ERROR_FILE = '{{ options.error_file }}'
|
94
|
+
{%- endif %}
|
95
|
+
{%- if error_file_credentials %}
|
96
|
+
ERROR_FILE_CREDENTIALS = (AWS_KEY_ID = '{{ error_file_credentials.aws_key_id }}' AWS_SECRET_KEY = '{{ error_file_credentials.aws_secret_key }}')
|
97
|
+
{%- endif %}
|
98
|
+
{%- if options.max_errors_per_file %}
|
99
|
+
MAX_ERRORS_PER_FILE = {{ options.max_errors_per_file }}
|
100
|
+
{%- endif %}
|
101
|
+
{%- if csv_options %}
|
102
|
+
{%- if csv_options.header is not none %}
|
103
|
+
HEADER = {{ csv_options.header | upper }}
|
104
|
+
{%- endif %}
|
105
|
+
{%- if csv_options.delimiter %}
|
106
|
+
DELIMITER = '{{ csv_options.delimiter }}'
|
107
|
+
{%- endif %}
|
108
|
+
{%- if csv_options.newline %}
|
109
|
+
NEWLINE = '{{ csv_options.newline }}'
|
110
|
+
{%- endif %}
|
111
|
+
{%- if csv_options.quote %}
|
112
|
+
QUOTE = {{ csv_options.quote }}
|
113
|
+
{%- endif %}
|
114
|
+
{%- if csv_options.escape %}
|
115
|
+
ESCAPE = '{{ csv_options.escape }}'
|
116
|
+
{%- endif %}
|
117
|
+
{%- if csv_options.null_string %}
|
118
|
+
NULL_STRING = '{{ csv_options.null_string }}'
|
119
|
+
{%- endif %}
|
120
|
+
{%- if csv_options.empty_field_as_null is not none %}
|
121
|
+
EMPTY_FIELD_AS_NULL = {{ csv_options.empty_field_as_null | upper }}
|
122
|
+
{%- endif %}
|
123
|
+
{%- if csv_options.skip_blank_lines is not none %}
|
124
|
+
SKIP_BLANK_LINES = {{ csv_options.skip_blank_lines | upper }}
|
125
|
+
{%- endif %}
|
126
|
+
{%- if csv_options.date_format %}
|
127
|
+
DATE_FORMAT = '{{ csv_options.date_format }}'
|
128
|
+
{%- endif %}
|
129
|
+
{%- if csv_options.timestamp_format %}
|
130
|
+
TIMESTAMP_FORMAT = '{{ csv_options.timestamp_format }}'
|
131
|
+
{%- endif %}
|
132
|
+
{%- endif %}
|
133
|
+
{%- endif %}
|
134
|
+
{%- if credentials %}
|
135
|
+
CREDENTIALS = (AWS_KEY_ID = '{{credentials.aws_key_id}}' AWS_SECRET_KEY = '{{credentials.aws_secret_key}}')
|
136
|
+
{%- endif %}
|
137
|
+
{% endmacro %}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
dbt/adapters/firebolt/__init__.py,sha256=
|
1
|
+
dbt/adapters/firebolt/__init__.py,sha256=abhy1JQv7eRFwdEtR9pWsB6kYfmZMobu6HweuUPtpeQ,411
|
2
2
|
dbt/adapters/firebolt/__version__.py,sha256=zRlZGglif76ZVuWWSjsH_MMPgtVQqmj-SryYJW25FL4,69
|
3
3
|
dbt/adapters/firebolt/column.py,sha256=COo_wjhCFgS3GFcPIPcoq7WAWgzN6DB2XqG-gk51WBc,539
|
4
4
|
dbt/adapters/firebolt/connections.py,sha256=Sp2C03ynSqmRIQO9z2YGfVIimWZrygST7uKT0t5_RwU,7880
|
@@ -6,11 +6,11 @@ dbt/adapters/firebolt/impl.py,sha256=0Zn058iDxT6eVAP77vGC1sIyOYuW5FDALNns1ErPl_4
|
|
6
6
|
dbt/adapters/firebolt/relation.py,sha256=z-yv_ICJPZB33IIpnr3o_jusoULlKANLj6BlkaudQQ0,1152
|
7
7
|
dbt/include/firebolt/__init__.py,sha256=vBGWeG-dHHkimfnX8axBJ4IgAowFw8xADmo6Auzn2xc,52
|
8
8
|
dbt/include/firebolt/dbt_project.yml,sha256=uHJ-i0wD1D74DWSSSzsFKoKbAN1w4LBgVpnkm8e-M1g,76
|
9
|
-
dbt/include/firebolt/macros/adapters.sql,sha256=
|
10
|
-
dbt/include/firebolt/macros/catalog.sql,sha256=
|
9
|
+
dbt/include/firebolt/macros/adapters.sql,sha256=btDFso1_NJzHc7_RiuuDKVOmhsafFt0Ng3HuI0R6mhU,9663
|
10
|
+
dbt/include/firebolt/macros/catalog.sql,sha256=YCsHQEqA1-bo_expaF_pMorINhKAXOYs73Lj8Mf1GDY,843
|
11
11
|
dbt/include/firebolt/macros/adapters/apply_grants.sql,sha256=nEmyDs0K0HENxxMaY8v-5oifIXDMrysmuUb_bo9bCuY,1095
|
12
12
|
dbt/include/firebolt/macros/adapters/relation.sql,sha256=1nQZg_vwpGYwFI2EQvHJA5CqFWk7h3w3Yq2uvYXNR5E,2017
|
13
|
-
dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql,sha256=
|
13
|
+
dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql,sha256=x7awixF-k8neugbKp7_QVb7PhBlQnsaIvvdBtJEeJqE,6153
|
14
14
|
dbt/include/firebolt/macros/dbt_external_tables/dropif.sql,sha256=-kZzUVgC6Bcof7tZ9VcDK427agylMHeG-yA8NqSeWkw,167
|
15
15
|
dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql,sha256=BWNSuqB9t0hxbxL9CbIc0UFTBBarQMtGfHv9LLAbqSI,894
|
16
16
|
dbt/include/firebolt/macros/materializations/clone.sql,sha256=SKPc_tG0tF2HRKlo1-CQPvxVWGKHpXDwxvubsCwKTG8,79
|
@@ -39,8 +39,8 @@ dbt/include/firebolt/macros/utils/position.sql,sha256=WPo9_bhvNYJooEAsHC9OcnNAwU
|
|
39
39
|
dbt/include/firebolt/macros/utils/right.sql,sha256=_mm1_2MvlOH4O6CmYhgvVxMLfDxAvgv-EMwZ8OBOq-I,254
|
40
40
|
dbt/include/firebolt/macros/utils/split_part.sql,sha256=5dUlbx3Pt1iWWaIlxiXyYUwUqzXuLLXMB-1aGJHNk4o,464
|
41
41
|
dbt/include/firebolt/macros/utils/timestamps.sql,sha256=22g-QpJjBuBUQOHNpQ_TuMRa-cHxaxXPv8ItEUo-vEk,397
|
42
|
-
dbt_firebolt-1.6.
|
43
|
-
dbt_firebolt-1.6.
|
44
|
-
dbt_firebolt-1.6.
|
45
|
-
dbt_firebolt-1.6.
|
46
|
-
dbt_firebolt-1.6.
|
42
|
+
dbt_firebolt-1.6.4.dist-info/LICENSE,sha256=Nn0EGvW3qmoZpBV_JVM3iPukFf3RiNCIizrWe_2oTHk,11354
|
43
|
+
dbt_firebolt-1.6.4.dist-info/METADATA,sha256=P9bgeX1hBKX9qJbfs6eaTAFPt-0nvfupj07nZO90I6A,5034
|
44
|
+
dbt_firebolt-1.6.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
45
|
+
dbt_firebolt-1.6.4.dist-info/top_level.txt,sha256=B2YH4he17ajilEWOGCKHbRcEJlCuZKwCcgFcLPntLsE,4
|
46
|
+
dbt_firebolt-1.6.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|