dbt-firebolt 1.6.3__py3-none-any.whl → 1.7.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. dbt/adapters/firebolt/__init__.py +1 -1
  2. dbt/adapters/firebolt/impl.py +21 -3
  3. dbt/adapters/firebolt/relation.py +20 -2
  4. dbt/adapters/firebolt/relation_configs/__init__.py +0 -0
  5. dbt/include/firebolt/macros/adapters.sql +10 -95
  6. dbt/include/firebolt/macros/catalog.sql +99 -29
  7. dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +106 -4
  8. dbt/include/firebolt/macros/materializations/materialized_view.sql +0 -45
  9. dbt/include/firebolt/macros/relations/materialized_view/alter.sql +11 -0
  10. dbt/include/firebolt/macros/relations/materialized_view/create.sql +3 -0
  11. dbt/include/firebolt/macros/relations/materialized_view/describe.sql +3 -0
  12. dbt/include/firebolt/macros/relations/materialized_view/drop.sql +3 -0
  13. dbt/include/firebolt/macros/relations/materialized_view/refresh.sql +3 -0
  14. dbt/include/firebolt/macros/relations/table/create.sql +74 -0
  15. dbt/include/firebolt/macros/relations/table/drop.sql +3 -0
  16. dbt/include/firebolt/macros/relations/table/rename.sql +6 -0
  17. dbt/include/firebolt/macros/relations/table/replace.sql +3 -0
  18. dbt/include/firebolt/macros/relations/view/create.sql +16 -0
  19. dbt/include/firebolt/macros/relations/view/drop.sql +3 -0
  20. dbt/include/firebolt/macros/relations/view/rename.sql +6 -0
  21. dbt/include/firebolt/macros/relations/view/replace.sql +3 -0
  22. {dbt_firebolt-1.6.3.dist-info → dbt_firebolt-1.7.0.dist-info}/METADATA +1 -1
  23. {dbt_firebolt-1.6.3.dist-info → dbt_firebolt-1.7.0.dist-info}/RECORD +26 -12
  24. {dbt_firebolt-1.6.3.dist-info → dbt_firebolt-1.7.0.dist-info}/LICENSE +0 -0
  25. {dbt_firebolt-1.6.3.dist-info → dbt_firebolt-1.7.0.dist-info}/WHEEL +0 -0
  26. {dbt_firebolt-1.6.3.dist-info → dbt_firebolt-1.7.0.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ from dbt.adapters.firebolt.connections import (
7
7
  from dbt.adapters.firebolt.impl import FireboltAdapter
8
8
  from dbt.include import firebolt
9
9
 
10
- __version__ = "1.6.3"
10
+ __version__ = "1.7.0"
11
11
 
12
12
  Plugin = AdapterPlugin(
13
13
  adapter=FireboltAdapter, # type: ignore
@@ -5,10 +5,17 @@ from datetime import datetime
5
5
  from typing import Any, List, Mapping, Optional, Union
6
6
 
7
7
  import agate
8
- from dbt.adapters.base import available
9
- from dbt.adapters.base.impl import AdapterConfig, ConstraintSupport
8
+ from dbt.adapters.base import available # type: ignore
9
+ from dbt.adapters.base.impl import AdapterConfig # type: ignore
10
+ from dbt.adapters.base.impl import ConstraintSupport
10
11
  from dbt.adapters.base.relation import BaseRelation
11
- from dbt.adapters.sql import SQLAdapter
12
+ from dbt.adapters.capability import (
13
+ Capability,
14
+ CapabilityDict,
15
+ CapabilitySupport,
16
+ Support,
17
+ )
18
+ from dbt.adapters.sql import SQLAdapter # type: ignore
12
19
  from dbt.contracts.graph.nodes import ConstraintType
13
20
  from dbt.dataclass_schema import ValidationError, dbtClassMixin
14
21
  from dbt.exceptions import (
@@ -114,6 +121,17 @@ class FireboltAdapter(SQLAdapter):
114
121
  ConstraintType.foreign_key: ConstraintSupport.NOT_SUPPORTED,
115
122
  }
116
123
 
124
+ _capabilities: CapabilityDict = CapabilityDict(
125
+ {
126
+ Capability.SchemaMetadataByRelations: CapabilitySupport(
127
+ support=Support.Full
128
+ ),
129
+ Capability.TableLastModifiedMetadata: CapabilitySupport(
130
+ support=Support.Unsupported
131
+ ),
132
+ }
133
+ )
134
+
117
135
  @classmethod
118
136
  def is_cancelable(cls) -> bool:
119
137
  return False
@@ -1,7 +1,9 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import Optional
2
+ from typing import Dict, FrozenSet, Optional
3
3
 
4
- from dbt.adapters.base.relation import BaseRelation, Policy
4
+ from dbt.adapters.base import RelationType # type: ignore
5
+ from dbt.adapters.base.relation import BaseRelation, Policy # type: ignore
6
+ from dbt.adapters.relation_configs import RelationConfigBase # type: ignore
5
7
  from dbt.exceptions import DbtRuntimeError
6
8
 
7
9
 
@@ -30,6 +32,22 @@ class FireboltRelation(BaseRelation):
30
32
  quote_character: str = '"'
31
33
  is_delta: Optional[bool] = None
32
34
  information: Optional[str] = None
35
+ relation_configs: Dict[RelationType, RelationConfigBase] = field(
36
+ default_factory=lambda: {}
37
+ )
38
+ # list relations that can be renamed (e.g. `RENAME my_relation TO my_new_name;`)
39
+ renameable_relations: FrozenSet[RelationType] = field(
40
+ default_factory=lambda: frozenset({})
41
+ )
42
+ # list relations that can be atomically replaced
43
+ # (e.g. `CREATE OR REPLACE my_relation..` versus `DROP` and `CREATE`)
44
+ replaceable_relations: FrozenSet[RelationType] = field(
45
+ default_factory=lambda: frozenset(
46
+ {
47
+ RelationType.View,
48
+ }
49
+ )
50
+ )
33
51
 
34
52
  def render(self) -> str:
35
53
  if self.include_policy.database and self.include_policy.schema:
File without changes
@@ -168,106 +168,21 @@
168
168
  #}
169
169
  {% call statement('list_tables_without_caching', fetch_result=True) %}
170
170
 
171
- SELECT '{{ relation.database }}' AS "database",
172
- table_name AS "name",
173
- '{{ relation.schema }}' AS "schema",
174
- 'table' AS type
175
- FROM information_schema.tables
176
- UNION ALL
177
- SELECT '{{ relation.database }}' AS "database",
178
- table_name AS "name",
179
- '{{ relation.schema }}' AS "schema",
180
- 'view' AS type
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) }}
185
184
  {% endmacro %}
186
185
 
187
-
188
- {% macro firebolt__create_table_as(temporary,
189
- relation,
190
- select_sql,
191
- language='sql') -%}
192
- {# Create table using CTAS
193
- Args:
194
- temporary (bool): Unused, included so macro signature matches
195
- that of dbt's default macro
196
- relation (dbt relation/dict)
197
- select_sql (string): The SQL query that will be used to generate
198
- the internal query of the CTAS
199
- language (string): sql or python models. Firebolt only supports sql.
200
- #}
201
- {%- if language == 'python' -%}
202
- {{ exceptions.raise_compiler_error("Firebolt does not currently support "
203
- "Python models.") }}
204
- {%- elif language not in ['python', 'sql'] -%}
205
- {{ exceptions.raise_compiler_error("Unexpected language parameter supplied: %s "
206
- "Must be either 'sql' or 'python'." % (language)) }}
207
- {%- endif -%}
208
-
209
- {%- set table_type = config.get('table_type', default='dimension') | upper -%}
210
- {%- set primary_index = config.get('primary_index') -%}
211
- {%- set incremental_strategy = config.get('incremental_strategy') -%}
212
- {%- set partitions = config.get('partition_by') %}
213
-
214
- CREATE {{ table_type }} TABLE IF NOT EXISTS {{ relation }}
215
- {%- set contract_config = config.get('contract') -%}
216
- {%- if contract_config.enforced -%}
217
- {{ get_assert_columns_equivalent(select_sql) }}
218
- {{ get_table_columns_and_constraints() }} ;
219
- insert into {{ relation }} (
220
- {{ adapter.dispatch('get_column_names', 'dbt')() }}
221
- )
222
- {%- set select_sql = get_select_subquery(select_sql) %}
223
- {% endif %}
224
- {%- if primary_index %}
225
- PRIMARY INDEX
226
- {% if primary_index is iterable and primary_index is not string %}
227
- {{ primary_index | join(', ') }}
228
- {%- else -%}
229
- {{ primary_index }}
230
- {%- endif -%}
231
- {%- endif -%}
232
- {% if partitions %}
233
- PARTITION BY
234
- {% if partitions is iterable and partitions is not string %}
235
- {{ partitions | join(', ') }}
236
- {%- else -%}
237
- {{ partitions }}
238
- {%- endif -%}
239
- {%- endif %}
240
- {%- if not contract_config.enforced %}
241
- AS (
242
- {% endif -%}
243
- {{ select_sql }}
244
- {% if not contract_config.enforced -%}
245
- )
246
- {%- endif -%}
247
- {% endmacro %}
248
-
249
-
250
- {% macro firebolt__create_view_as(relation, select_sql) %}
251
- {#-
252
- Return SQL string to create view.
253
- Args:
254
- relation (dict): dbt relation
255
- select_sql (string): The SQL query that will be used to generate
256
- the internal query of the CTAS
257
- #}
258
-
259
- CREATE OR REPLACE VIEW {{ relation.identifier }}
260
-
261
- {%- set contract_config = config.get('contract') -%}
262
- {%- if contract_config.enforced -%}
263
- {{ get_assert_columns_equivalent(select_sql) }}
264
- {%- endif %}
265
- AS (
266
- {{ select_sql }}
267
- )
268
- {% endmacro %}
269
-
270
-
271
186
  {% macro firebolt__truncate_relation(relation) -%}
272
187
  {#
273
188
  Truncate relation. Actual macro is drop_relation in ./adapters/relation.sql.
@@ -1,33 +1,103 @@
1
1
  {# This is for building docs. Right now it's an incomplete description of
2
2
  the columns (for instance, `is_nullable` is missing) but more could be added later. #}
3
3
 
4
- {% macro firebolt__get_catalog(information_schemas, schemas) -%}
5
- {%- call statement('catalog', fetch_result=True) %}
6
- SELECT tbls.table_catalog AS table_database
7
- , tbls.table_schema as table_schema
8
- , table_type
9
- , tbls.table_name as table_name
10
- , cols.column_name as column_name
11
- , cols.data_type AS column_type
12
- , UPPER(tbls.table_type) as relation_type
13
- , cols.ordinal_position as column_index
14
- FROM information_schema.tables tbls
15
- JOIN information_schema.columns cols
16
- USING(table_name)
17
-
18
- UNION ALL
19
-
20
- SELECT views.table_catalog AS table_database
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)
31
- {% endcall -%}
32
- {{ return(load_result('catalog').table) }}
4
+ {% macro firebolt__get_catalog(information_schema, schemas) -%}
5
+
6
+ {% set query %}
7
+ with tables as (
8
+ {{ firebolt__get_catalog_tables_sql(information_schema) }}
9
+ {{ firebolt__get_catalog_schemas_where_clause_sql(schemas) }}
10
+ ),
11
+ columns as (
12
+ {{ firebolt__get_catalog_columns_sql(information_schema) }}
13
+ {{ firebolt__get_catalog_schemas_where_clause_sql(schemas) }}
14
+ )
15
+ {{ firebolt__get_catalog_results_sql() }}
16
+ {%- endset -%}
17
+
18
+ {{ return(run_query(query)) }}
19
+
20
+ {%- endmacro %}
21
+
22
+ {% macro firebolt__get_catalog_relations(information_schema, relations) -%}
23
+
24
+ {% set query %}
25
+ with tables as (
26
+ {{ firebolt__get_catalog_tables_sql(information_schema) }}
27
+ {{ firebolt__get_catalog_relations_where_clause_sql(relations) }}
28
+ ),
29
+ columns as (
30
+ {{ firebolt__get_catalog_columns_sql(information_schema) }}
31
+ {{ firebolt__get_catalog_relations_where_clause_sql(relations) }}
32
+ )
33
+ {{ firebolt__get_catalog_results_sql() }}
34
+ {%- endset -%}
35
+
36
+ {{ return(run_query(query)) }}
37
+
38
+ {%- endmacro %}
39
+
40
+
41
+ {% macro firebolt__get_catalog_tables_sql(information_schema) -%}
42
+ SELECT
43
+ tbls.table_catalog AS table_database,
44
+ tbls.table_schema as table_schema,
45
+ table_type,
46
+ tbls.table_name as table_name,
47
+ CASE
48
+ WHEN table_type = 'VIEW' THEN 'VIEW'
49
+ ELSE 'TABLE'
50
+ END AS relation_type
51
+ FROM
52
+ information_schema.tables tbls
53
+ {%- endmacro %}
54
+
55
+
56
+ {% macro firebolt__get_catalog_columns_sql(information_schema) -%}
57
+ select
58
+ table_catalog as "table_database",
59
+ table_schema as "table_schema",
60
+ table_name as "table_name",
61
+ column_name as "column_name",
62
+ ordinal_position as "column_index",
63
+ data_type as "column_type"
64
+ from information_schema.columns
65
+ {%- endmacro %}
66
+
67
+ {% macro firebolt__get_catalog_results_sql() -%}
68
+ SELECT *
69
+ FROM tables
70
+ JOIN columns USING ("table_database", "table_schema", "table_name")
71
+ ORDER BY "column_index"
72
+ {%- endmacro %}
73
+
74
+
75
+ {% macro firebolt__get_catalog_schemas_where_clause_sql(schemas) -%}
76
+ WHERE ({%- for schema in schemas -%}
77
+ UPPER("table_schema") = UPPER('{{ schema }}'){%- if not loop.last %} OR {% endif -%}
78
+ {%- endfor -%})
79
+ {%- endmacro %}
80
+
81
+
82
+ {% macro firebolt__get_catalog_relations_where_clause_sql(relations) -%}
83
+ WHERE (
84
+ {%- for relation in relations -%}
85
+ {% if relation.schema and relation.identifier %}
86
+ (
87
+ UPPER("table_schema") = UPPER('{{ relation.schema }}')
88
+ AND UPPER("table_name") = UPPER('{{ relation.identifier }}')
89
+ )
90
+ {% elif relation.schema %}
91
+ (
92
+ UPPER("table_schema") = UPPER('{{ relation.schema }}')
93
+ )
94
+ {% else %}
95
+ {% do exceptions.raise_compiler_error(
96
+ '`get_catalog_relations` requires a list of relations, each with a schema'
97
+ ) %}
98
+ {% endif %}
99
+
100
+ {%- if not loop.last %} OR {% endif -%}
101
+ {%- endfor -%}
102
+ )
33
103
  {%- 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
- AWS_ROLE_EXTERNAL_ID = '{{credentials.external_role_id}}')
24
- {% endif %}
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 =
@@ -33,3 +46,92 @@
33
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,48 +1,3 @@
1
- {#
2
- All these macros are stubbed with compiler errors because Firebolt does not
3
- support materialized views.
4
- #}
5
- {% materialization materialized_view, adapter='firebolt' %}
6
-
7
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
8
-
9
- {% endmaterialization %}
10
-
11
- {% macro firebolt__get_alter_materialized_view_as_sql(
12
- relation,
13
- configuration_changes,
14
- sql,
15
- existing_relation,
16
- backup_relation,
17
- intermediate_relation
18
- ) %}
19
-
20
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
21
- {% endmacro %}
22
-
23
-
24
- {% macro firebolt__get_create_materialized_view_as_sql(relation, sql) %}
25
-
26
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
27
-
28
- {% endmacro %}
29
-
30
-
31
- {% macro firebolt__get_replace_materialized_view_as_sql(relation, sql, existing_relation, backup_relation, intermediate_relation) %}
32
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
33
- {% endmacro %}
34
-
35
-
36
1
  {% macro firebolt__get_materialized_view_configuration_changes(existing_relation, new_config) %}
37
2
  {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
38
3
  {% endmacro %}
39
-
40
-
41
- {% macro firebolt__refresh_materialized_view(relation) -%}
42
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
43
- {% endmacro %}
44
-
45
-
46
- {% macro firebolt__drop_materialized_view(relation) -%}
47
- {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
48
- {%- endmacro %}
@@ -0,0 +1,11 @@
1
+ {% macro firebolt__get_alter_materialized_view_as_sql(
2
+ relation,
3
+ configuration_changes,
4
+ sql,
5
+ existing_relation,
6
+ backup_relation,
7
+ intermediate_relation
8
+ ) %}
9
+
10
+ {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
11
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__get_create_materialized_view_as_sql(relation, sql) %}
2
+ {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
3
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro redshift__describe_materialized_view(relation) %}
2
+ {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
3
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__drop_materialized_view(relation) %}
2
+ {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
3
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__refresh_materialized_view(relation) %}
2
+ {{ exceptions.raise_compiler_error("Firebolt does not support materialized views") }}
3
+ {% endmacro %}
@@ -0,0 +1,74 @@
1
+ {% macro firebolt__create_table_as(
2
+ temporary,
3
+ relation,
4
+ select_sql,
5
+ language = 'sql'
6
+ ) -%}
7
+ {# Create table using CTAS
8
+ Args:
9
+ temporary (bool): Unused, included so macro signature matches
10
+ that of dbt's default macro
11
+ relation (dbt relation/dict)
12
+ select_sql (string): The SQL query that will be used to generate
13
+ the internal query of the CTAS
14
+ language (string): sql or python models. Firebolt only supports sql.
15
+ #}
16
+ {%- if language == 'python' -%}
17
+ {{ exceptions.raise_compiler_error(
18
+ "Firebolt does not currently support " "Python models."
19
+ ) }}
20
+
21
+ {%- elif language not in ['python', 'sql'] -%}
22
+ {{ exceptions.raise_compiler_error(
23
+ "Unexpected language parameter supplied: %s " "Must be either 'sql' or 'python'." % (language)
24
+ ) }}
25
+ {%- endif -%}
26
+
27
+ {%- set table_type = config.get(
28
+ 'table_type',
29
+ default = 'dimension'
30
+ ) | upper -%}
31
+ {%- set primary_index = config.get('primary_index') -%}
32
+ {%- set incremental_strategy = config.get('incremental_strategy') -%}
33
+ {%- set partitions = config.get('partition_by') %}
34
+ CREATE {{ table_type }} TABLE IF NOT EXISTS {{ relation }}
35
+
36
+ {%- set contract_config = config.get('contract') -%}
37
+ {%- if contract_config.enforced -%}
38
+ {{ get_assert_columns_equivalent(select_sql) }}
39
+ {{ get_table_columns_and_constraints() }};
40
+ INSERT INTO
41
+ {{ relation }}
42
+ (
43
+ {{ adapter.dispatch(
44
+ 'get_column_names',
45
+ 'dbt'
46
+ )() }}
47
+ ) {%- set select_sql = get_select_subquery(select_sql) %}
48
+ {% endif %}
49
+
50
+ {%- if primary_index %}
51
+ primary INDEX {% if primary_index is iterable and primary_index is not string %}
52
+ {{ primary_index | join(', ') }}
53
+ {%- else -%}
54
+ {{ primary_index }}
55
+ {%- endif -%}
56
+ {%- endif -%}
57
+
58
+ {% if partitions %}
59
+ PARTITION BY {% if partitions is iterable and partitions is not string %}
60
+ {{ partitions | join(', ') }}
61
+ {%- else -%}
62
+ {{ partitions }}
63
+ {%- endif -%}
64
+ {%- endif %}
65
+
66
+ {%- if not contract_config.enforced %}
67
+ AS (
68
+ {% endif -%}
69
+
70
+ {{ select_sql }}
71
+
72
+ {% if not contract_config.enforced -%})
73
+ {%- endif -%}
74
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {%- macro firebolt__drop_table(relation) -%}
2
+ DROP TABLE IF EXISTS {{ relation }} CASCADE
3
+ {%- endmacro -%}
@@ -0,0 +1,6 @@
1
+ {% macro firebolt__get_rename_table_sql(
2
+ relation,
3
+ new_name
4
+ ) %}
5
+ {{ exceptions.raise_compiler_error("Firebolt does not support table renames") }}
6
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__get_replace_table_sql(relation, sql) %}
2
+ {{ firebolt__create_table_as(False, relation, sql) }}
3
+ {% endmacro %}
@@ -0,0 +1,16 @@
1
+ {% macro firebolt__create_view_as(
2
+ relation,
3
+ select_sql
4
+ ) %}
5
+ CREATE
6
+ OR REPLACE VIEW {{ relation.identifier }}
7
+
8
+ {%- set contract_config = config.get('contract') -%}
9
+ {%- if contract_config.enforced -%}
10
+ {{ get_assert_columns_equivalent(select_sql) }}
11
+ {%- endif %}
12
+
13
+ AS (
14
+ {{ select_sql }}
15
+ )
16
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__get_drop_view_sql(relation) %}
2
+ DROP VIEW if EXISTS {{ relation }} CASCADE
3
+ {% endmacro %}
@@ -0,0 +1,6 @@
1
+ {% macro firebolt__get_rename_view_sql(
2
+ relation,
3
+ new_name
4
+ ) %}
5
+ {{ exceptions.raise_compiler_error("Firebolt does not support view renames") }}
6
+ {% endmacro %}
@@ -0,0 +1,3 @@
1
+ {% macro firebolt__get_replace_view_sql(relation, sql) %}
2
+ {{ firebolt__create_view_as(relation, sql) }}
3
+ {% endmacro %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt-firebolt
3
- Version: 1.6.3
3
+ Version: 1.7.0
4
4
  Summary: The Firebolt adapter plugin for dbt (data build tool)
5
5
  Home-page: https://github.com/firebolt-db/dbt-firebolt
6
6
  Author: Firebolt
@@ -1,20 +1,21 @@
1
- dbt/adapters/firebolt/__init__.py,sha256=wk7bkmHH5gMKcsD3GpZKZG_8-udblw302teqMaqj58M,411
1
+ dbt/adapters/firebolt/__init__.py,sha256=ifGIav8ks_A2VpLQpLvT6xkMMV0n0LOPE767T1DtlLI,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
5
- dbt/adapters/firebolt/impl.py,sha256=0Zn058iDxT6eVAP77vGC1sIyOYuW5FDALNns1ErPl_4,13435
6
- dbt/adapters/firebolt/relation.py,sha256=z-yv_ICJPZB33IIpnr3o_jusoULlKANLj6BlkaudQQ0,1152
5
+ dbt/adapters/firebolt/impl.py,sha256=dyqJvJwbs2CFouSFjOPosD8qY4uz2TufzBfRWlQmDnk,13957
6
+ dbt/adapters/firebolt/relation.py,sha256=HdzHsjYyP1djnUxOl9TB2OGMv7LJyeRXr2kgZRzsgZM,1937
7
+ dbt/adapters/firebolt/relation_configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
8
  dbt/include/firebolt/__init__.py,sha256=vBGWeG-dHHkimfnX8axBJ4IgAowFw8xADmo6Auzn2xc,52
8
9
  dbt/include/firebolt/dbt_project.yml,sha256=uHJ-i0wD1D74DWSSSzsFKoKbAN1w4LBgVpnkm8e-M1g,76
9
- dbt/include/firebolt/macros/adapters.sql,sha256=L6AVtG03-JByYyb5JwIdWTYII8H2SStCquqF_le5PdA,9800
10
- dbt/include/firebolt/macros/catalog.sql,sha256=Ung5LZF3Usm_xIrrTRs6sBP0LiPbGH4aQ99cC-6ol4M,1312
10
+ dbt/include/firebolt/macros/adapters.sql,sha256=NiTW87XQmC8gGahY6LCw7Fd6Brgin5qBO1qqVef9YWQ,6848
11
+ dbt/include/firebolt/macros/catalog.sql,sha256=LLhjI9oEoMEQKQfE3LJ5nWS9-u3bwBAYBz4ukrsg5T8,3350
11
12
  dbt/include/firebolt/macros/adapters/apply_grants.sql,sha256=nEmyDs0K0HENxxMaY8v-5oifIXDMrysmuUb_bo9bCuY,1095
12
13
  dbt/include/firebolt/macros/adapters/relation.sql,sha256=1nQZg_vwpGYwFI2EQvHJA5CqFWk7h3w3Yq2uvYXNR5E,2017
13
- dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql,sha256=ereBPmfAP0Xn92tftp_FtMGqY8a7dghuYMrzRMrxcC4,1668
14
+ dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql,sha256=x7awixF-k8neugbKp7_QVb7PhBlQnsaIvvdBtJEeJqE,6153
14
15
  dbt/include/firebolt/macros/dbt_external_tables/dropif.sql,sha256=-kZzUVgC6Bcof7tZ9VcDK427agylMHeG-yA8NqSeWkw,167
15
16
  dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql,sha256=BWNSuqB9t0hxbxL9CbIc0UFTBBarQMtGfHv9LLAbqSI,894
16
17
  dbt/include/firebolt/macros/materializations/clone.sql,sha256=SKPc_tG0tF2HRKlo1-CQPvxVWGKHpXDwxvubsCwKTG8,79
17
- dbt/include/firebolt/macros/materializations/materialized_view.sql,sha256=UAd2h-ZIsDbI45hPMIAXVNrQB8SCt0QfkMUs_GHe_kw,1538
18
+ dbt/include/firebolt/macros/materializations/materialized_view.sql,sha256=pdWGMP25o0RqNINx1hbn1Q4dTNcdk0Dgrlv3K8XQAbs,202
18
19
  dbt/include/firebolt/macros/materializations/seed.sql,sha256=O622lwmzRGeAfaNfRpjR183ARFltILteznwgXZfPXMA,1564
19
20
  dbt/include/firebolt/macros/materializations/table.sql,sha256=XY0D-df9EoWOBF3kCT3TCE3Rko7bvvfuztQT0-Pqlfs,1752
20
21
  dbt/include/firebolt/macros/materializations/test.sql,sha256=Wol19pNIfkPRTpVUYKAGbkipYOMZjixnAaoZ1chuP88,488
@@ -25,6 +26,19 @@ dbt/include/firebolt/macros/materializations/models/incremental/is_incremental.s
25
26
  dbt/include/firebolt/macros/materializations/models/incremental/merge.sql,sha256=YPryPkUfVVrKVk5bSdGt0eMa5NdFMMvJW1OuQ6o2umw,1311
26
27
  dbt/include/firebolt/macros/materializations/models/incremental/on_schema_change.sql,sha256=WxGhX22oJRhDVsR4nUWilCSIG-bb7efDC3AXcU8VbbQ,3933
27
28
  dbt/include/firebolt/macros/materializations/models/incremental/strategies.sql,sha256=8Xrr-XqWeTRTbgvbVuH7EikklCzooSl0tMtLvhNKT4A,5925
29
+ dbt/include/firebolt/macros/relations/materialized_view/alter.sql,sha256=QDMCFwJZZfz7mrx6UcyDICSWAS3zQTs52_urcsW8klU,286
30
+ dbt/include/firebolt/macros/relations/materialized_view/create.sql,sha256=xthF0oHCyC4xu8IKEtoLJIyWh3p-JGBS5Awc3J-sQ8Y,178
31
+ dbt/include/firebolt/macros/relations/materialized_view/describe.sql,sha256=uMJWY-9P-49YjhwH_F1Co4szia0oNAVYqJIv2IVGzM8,164
32
+ dbt/include/firebolt/macros/relations/materialized_view/drop.sql,sha256=Ya03cid5h05t3-SIF4JndKtMMIctD46OX9gPVt9jhVw,160
33
+ dbt/include/firebolt/macros/relations/materialized_view/refresh.sql,sha256=9s4e6cjT9Dx9nCCJPMlhV5SkzHX8574cdIJUhSfNmU8,163
34
+ dbt/include/firebolt/macros/relations/table/create.sql,sha256=4qK5r8EODXDjsBZwbHupLFfp3cDT4JkQkOuH94L9KVQ,2406
35
+ dbt/include/firebolt/macros/relations/table/drop.sql,sha256=3W0SMqmlDizmZqn-QZvqXeJ9lG2KtooiFvwac3WzSzQ,110
36
+ dbt/include/firebolt/macros/relations/table/rename.sql,sha256=5dmKvuiSnMTARuthnDJBUOORdQCIeEuGMLoyZlgQxVU,185
37
+ dbt/include/firebolt/macros/relations/table/replace.sql,sha256=bw08YDtLMhkM4dO4nYXZ32U50lcnTG5Axb-Lls7XpB0,132
38
+ dbt/include/firebolt/macros/relations/view/create.sql,sha256=WXXMS_WnHCoeWdYmyq7DWWeeoLag2ylXBxoltaCzIFA,333
39
+ dbt/include/firebolt/macros/relations/view/drop.sql,sha256=8m_CtJrFXY_vZM9EEYi7_7kCuXKtc0ql_9S_cmKVEb8,112
40
+ dbt/include/firebolt/macros/relations/view/rename.sql,sha256=3PkhAm3E4VscNSj2jM2kGGcSC9NGM9gJreSRS0rAFbI,183
41
+ dbt/include/firebolt/macros/relations/view/replace.sql,sha256=dszxLtQPuhZCEYeuqnuheu0HfN1RZoY05b34fMweEEg,123
28
42
  dbt/include/firebolt/macros/utils/array_append.sql,sha256=woAedZFXFYh6TYXwJQCxKj4o5yo71yXBdk-nxcF4Kss,117
29
43
  dbt/include/firebolt/macros/utils/array_concat.sql,sha256=Q9yY_rhcITJH0bS12MJOkBl5PXJ-ScgFZTBrqmQtdmw,117
30
44
  dbt/include/firebolt/macros/utils/array_construct.sql,sha256=C1I8STXIEN4-Ms6_b1Fw7QqzaAiesjC3M4RWa6e3pBY,105
@@ -39,8 +53,8 @@ dbt/include/firebolt/macros/utils/position.sql,sha256=WPo9_bhvNYJooEAsHC9OcnNAwU
39
53
  dbt/include/firebolt/macros/utils/right.sql,sha256=_mm1_2MvlOH4O6CmYhgvVxMLfDxAvgv-EMwZ8OBOq-I,254
40
54
  dbt/include/firebolt/macros/utils/split_part.sql,sha256=5dUlbx3Pt1iWWaIlxiXyYUwUqzXuLLXMB-1aGJHNk4o,464
41
55
  dbt/include/firebolt/macros/utils/timestamps.sql,sha256=22g-QpJjBuBUQOHNpQ_TuMRa-cHxaxXPv8ItEUo-vEk,397
42
- dbt_firebolt-1.6.3.dist-info/LICENSE,sha256=Nn0EGvW3qmoZpBV_JVM3iPukFf3RiNCIizrWe_2oTHk,11354
43
- dbt_firebolt-1.6.3.dist-info/METADATA,sha256=zh2q-_9upr0ci7WSk7b7uMu6foY_zs9OIb-NQdQqJvg,5034
44
- dbt_firebolt-1.6.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
45
- dbt_firebolt-1.6.3.dist-info/top_level.txt,sha256=B2YH4he17ajilEWOGCKHbRcEJlCuZKwCcgFcLPntLsE,4
46
- dbt_firebolt-1.6.3.dist-info/RECORD,,
56
+ dbt_firebolt-1.7.0.dist-info/LICENSE,sha256=Nn0EGvW3qmoZpBV_JVM3iPukFf3RiNCIizrWe_2oTHk,11354
57
+ dbt_firebolt-1.7.0.dist-info/METADATA,sha256=uKP4G9kpOgRj60f675-MUQSFPYynk9itGUei8HUH4oU,5034
58
+ dbt_firebolt-1.7.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
59
+ dbt_firebolt-1.7.0.dist-info/top_level.txt,sha256=B2YH4he17ajilEWOGCKHbRcEJlCuZKwCcgFcLPntLsE,4
60
+ dbt_firebolt-1.7.0.dist-info/RECORD,,