dbt-firebolt 1.6.4__py3-none-any.whl → 1.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dbt/adapters/firebolt/__init__.py +1 -1
- dbt/adapters/firebolt/connections.py +15 -13
- dbt/adapters/firebolt/impl.py +24 -6
- dbt/adapters/firebolt/relation.py +21 -3
- dbt/adapters/firebolt/relation_configs/__init__.py +0 -0
- dbt/include/firebolt/macros/adapters.sql +0 -84
- dbt/include/firebolt/macros/catalog.sql +89 -9
- dbt/include/firebolt/macros/materializations/materialized_view.sql +0 -45
- dbt/include/firebolt/macros/relations/materialized_view/alter.sql +11 -0
- dbt/include/firebolt/macros/relations/materialized_view/create.sql +3 -0
- dbt/include/firebolt/macros/relations/materialized_view/describe.sql +3 -0
- dbt/include/firebolt/macros/relations/materialized_view/drop.sql +3 -0
- dbt/include/firebolt/macros/relations/materialized_view/refresh.sql +3 -0
- dbt/include/firebolt/macros/relations/table/create.sql +74 -0
- dbt/include/firebolt/macros/relations/table/drop.sql +3 -0
- dbt/include/firebolt/macros/relations/table/rename.sql +6 -0
- dbt/include/firebolt/macros/relations/table/replace.sql +3 -0
- dbt/include/firebolt/macros/relations/view/create.sql +16 -0
- dbt/include/firebolt/macros/relations/view/drop.sql +3 -0
- dbt/include/firebolt/macros/relations/view/rename.sql +6 -0
- dbt/include/firebolt/macros/relations/view/replace.sql +3 -0
- {dbt_firebolt-1.6.4.dist-info → dbt_firebolt-1.8.0.dist-info}/METADATA +4 -3
- {dbt_firebolt-1.6.4.dist-info → dbt_firebolt-1.8.0.dist-info}/RECORD +26 -12
- {dbt_firebolt-1.6.4.dist-info → dbt_firebolt-1.8.0.dist-info}/LICENSE +0 -0
- {dbt_firebolt-1.6.4.dist-info → dbt_firebolt-1.8.0.dist-info}/WHEEL +0 -0
- {dbt_firebolt-1.6.4.dist-info → dbt_firebolt-1.8.0.dist-info}/top_level.txt +0 -0
@@ -1,19 +1,23 @@
|
|
1
1
|
from contextlib import contextmanager
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from datetime import datetime
|
4
|
+
from multiprocessing.context import SpawnContext
|
4
5
|
from typing import Generator, Optional, Tuple, Union
|
5
6
|
|
6
|
-
|
7
|
-
from dbt.adapters.base import Credentials
|
8
|
-
from dbt.adapters.sql import SQLConnectionManager
|
9
|
-
from dbt.contracts.connection import (
|
7
|
+
from dbt.adapters.contracts.connection import (
|
10
8
|
AdapterRequiredConfig,
|
11
9
|
AdapterResponse,
|
12
10
|
Connection,
|
11
|
+
Credentials,
|
13
12
|
QueryComment,
|
14
13
|
)
|
15
|
-
from dbt.events import AdapterLogger
|
16
|
-
from dbt.
|
14
|
+
from dbt.adapters.events.logging import AdapterLogger
|
15
|
+
from dbt.adapters.sql.connections import SQLConnectionManager
|
16
|
+
from dbt_common.exceptions import (
|
17
|
+
DbtConfigError,
|
18
|
+
DbtRuntimeError,
|
19
|
+
NotImplementedError,
|
20
|
+
)
|
17
21
|
from firebolt.client import DEFAULT_API_URL
|
18
22
|
from firebolt.client.auth import Auth, ClientCredentials, UsernamePassword
|
19
23
|
from firebolt.db import ARRAY, DECIMAL
|
@@ -45,13 +49,13 @@ class FireboltCredentials(Credentials):
|
|
45
49
|
# are provided instead
|
46
50
|
if not self.user and not self.password:
|
47
51
|
if not self.client_id or not self.client_secret:
|
48
|
-
raise
|
52
|
+
raise DbtConfigError(
|
49
53
|
'Either user and password or client_id and client_secret'
|
50
54
|
' must be provided'
|
51
55
|
)
|
52
56
|
else:
|
53
57
|
if self.client_id or self.client_secret:
|
54
|
-
raise
|
58
|
+
raise DbtConfigError(
|
55
59
|
'Either user and password or client_id and client_secret'
|
56
60
|
' must be provided'
|
57
61
|
)
|
@@ -99,13 +103,13 @@ class FireboltConnectionManager(SQLConnectionManager):
|
|
99
103
|
|
100
104
|
TYPE = 'firebolt'
|
101
105
|
|
102
|
-
def __init__(self, profile: AdapterRequiredConfig):
|
106
|
+
def __init__(self, profile: AdapterRequiredConfig, mp_context: SpawnContext):
|
103
107
|
# Query comment in appent mode only
|
104
108
|
# This allows clearer view of queries in query_history
|
105
109
|
if not hasattr(profile, 'query_comment'):
|
106
110
|
setattr(profile, 'query_comment', QueryComment())
|
107
111
|
profile.query_comment.append = True
|
108
|
-
super().__init__(profile)
|
112
|
+
super().__init__(profile, mp_context)
|
109
113
|
|
110
114
|
def __str__(self) -> str:
|
111
115
|
return 'FireboltConnectionManager()'
|
@@ -181,9 +185,7 @@ class FireboltConnectionManager(SQLConnectionManager):
|
|
181
185
|
|
182
186
|
def cancel(self, connection: Connection) -> None:
|
183
187
|
"""Cancel the last query on the given connection."""
|
184
|
-
raise
|
185
|
-
'`cancel` is not implemented for this adapter!'
|
186
|
-
)
|
188
|
+
raise NotImplementedError('`cancel` is not implemented for this adapter!')
|
187
189
|
|
188
190
|
@classmethod
|
189
191
|
def data_type_code_to_name( # type: ignore[override] # FIR-29423
|
dbt/adapters/firebolt/impl.py
CHANGED
@@ -5,13 +5,20 @@ 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
|
9
|
-
from dbt.adapters.base.
|
8
|
+
from dbt.adapters.base.impl import ConstraintSupport
|
9
|
+
from dbt.adapters.base.meta import available
|
10
10
|
from dbt.adapters.base.relation import BaseRelation
|
11
|
-
from dbt.adapters.
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
from dbt.adapters.capability import (
|
12
|
+
Capability,
|
13
|
+
CapabilityDict,
|
14
|
+
CapabilitySupport,
|
15
|
+
Support,
|
16
|
+
)
|
17
|
+
from dbt.adapters.protocol import AdapterConfig
|
18
|
+
from dbt.adapters.sql.impl import SQLAdapter
|
19
|
+
from dbt_common.contracts.constraints import ConstraintType
|
20
|
+
from dbt_common.dataclass_schema import ValidationError, dbtClassMixin
|
21
|
+
from dbt_common.exceptions import (
|
15
22
|
CompilationError,
|
16
23
|
DbtRuntimeError,
|
17
24
|
NotImplementedError,
|
@@ -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,8 +1,10 @@
|
|
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
|
5
|
-
from dbt.
|
4
|
+
from dbt.adapters.base.relation import BaseRelation
|
5
|
+
from dbt.adapters.contracts.relation import Policy, RelationType
|
6
|
+
from dbt.adapters.relation_configs.config_base import RelationConfigBase
|
7
|
+
from dbt_common.exceptions import DbtRuntimeError
|
6
8
|
|
7
9
|
|
8
10
|
@dataclass
|
@@ -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
|
@@ -183,90 +183,6 @@
|
|
183
183
|
{{ return(info_table) }}
|
184
184
|
{% endmacro %}
|
185
185
|
|
186
|
-
|
187
|
-
{% macro firebolt__create_table_as(temporary,
|
188
|
-
relation,
|
189
|
-
select_sql,
|
190
|
-
language='sql') -%}
|
191
|
-
{# Create table using CTAS
|
192
|
-
Args:
|
193
|
-
temporary (bool): Unused, included so macro signature matches
|
194
|
-
that of dbt's default macro
|
195
|
-
relation (dbt relation/dict)
|
196
|
-
select_sql (string): The SQL query that will be used to generate
|
197
|
-
the internal query of the CTAS
|
198
|
-
language (string): sql or python models. Firebolt only supports sql.
|
199
|
-
#}
|
200
|
-
{%- if language == 'python' -%}
|
201
|
-
{{ exceptions.raise_compiler_error("Firebolt does not currently support "
|
202
|
-
"Python models.") }}
|
203
|
-
{%- elif language not in ['python', 'sql'] -%}
|
204
|
-
{{ exceptions.raise_compiler_error("Unexpected language parameter supplied: %s "
|
205
|
-
"Must be either 'sql' or 'python'." % (language)) }}
|
206
|
-
{%- endif -%}
|
207
|
-
|
208
|
-
{%- set table_type = config.get('table_type', default='dimension') | upper -%}
|
209
|
-
{%- set primary_index = config.get('primary_index') -%}
|
210
|
-
{%- set incremental_strategy = config.get('incremental_strategy') -%}
|
211
|
-
{%- set partitions = config.get('partition_by') %}
|
212
|
-
|
213
|
-
CREATE {{ table_type }} TABLE IF NOT EXISTS {{ relation }}
|
214
|
-
{%- set contract_config = config.get('contract') -%}
|
215
|
-
{%- if contract_config.enforced -%}
|
216
|
-
{{ get_assert_columns_equivalent(select_sql) }}
|
217
|
-
{{ get_table_columns_and_constraints() }} ;
|
218
|
-
insert into {{ relation }} (
|
219
|
-
{{ adapter.dispatch('get_column_names', 'dbt')() }}
|
220
|
-
)
|
221
|
-
{%- set select_sql = get_select_subquery(select_sql) %}
|
222
|
-
{% endif %}
|
223
|
-
{%- if primary_index %}
|
224
|
-
PRIMARY INDEX
|
225
|
-
{% if primary_index is iterable and primary_index is not string %}
|
226
|
-
{{ primary_index | join(', ') }}
|
227
|
-
{%- else -%}
|
228
|
-
{{ primary_index }}
|
229
|
-
{%- endif -%}
|
230
|
-
{%- endif -%}
|
231
|
-
{% if partitions %}
|
232
|
-
PARTITION BY
|
233
|
-
{% if partitions is iterable and partitions is not string %}
|
234
|
-
{{ partitions | join(', ') }}
|
235
|
-
{%- else -%}
|
236
|
-
{{ partitions }}
|
237
|
-
{%- endif -%}
|
238
|
-
{%- endif %}
|
239
|
-
{%- if not contract_config.enforced %}
|
240
|
-
AS (
|
241
|
-
{% endif -%}
|
242
|
-
{{ select_sql }}
|
243
|
-
{% if not contract_config.enforced -%}
|
244
|
-
)
|
245
|
-
{%- endif -%}
|
246
|
-
{% endmacro %}
|
247
|
-
|
248
|
-
|
249
|
-
{% macro firebolt__create_view_as(relation, select_sql) %}
|
250
|
-
{#-
|
251
|
-
Return SQL string to create view.
|
252
|
-
Args:
|
253
|
-
relation (dict): dbt relation
|
254
|
-
select_sql (string): The SQL query that will be used to generate
|
255
|
-
the internal query of the CTAS
|
256
|
-
#}
|
257
|
-
|
258
|
-
CREATE OR REPLACE VIEW {{ relation.identifier }}
|
259
|
-
|
260
|
-
{%- set contract_config = config.get('contract') -%}
|
261
|
-
{%- if contract_config.enforced -%}
|
262
|
-
{{ get_assert_columns_equivalent(select_sql) }}
|
263
|
-
{%- endif %}
|
264
|
-
AS (
|
265
|
-
{{ select_sql }}
|
266
|
-
)
|
267
|
-
{% endmacro %}
|
268
|
-
|
269
|
-
|
270
186
|
{% macro firebolt__truncate_relation(relation) -%}
|
271
187
|
{#
|
272
188
|
Truncate relation. Actual macro is drop_relation in ./adapters/relation.sql.
|
@@ -1,23 +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(
|
5
|
-
|
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) -%}
|
6
42
|
SELECT
|
7
43
|
tbls.table_catalog AS table_database,
|
8
44
|
tbls.table_schema as table_schema,
|
9
45
|
table_type,
|
10
46
|
tbls.table_name as table_name,
|
11
|
-
cols.column_name as column_name,
|
12
|
-
cols.data_type AS column_type,
|
13
47
|
CASE
|
14
48
|
WHEN table_type = 'VIEW' THEN 'VIEW'
|
15
49
|
ELSE 'TABLE'
|
16
|
-
END AS relation_type
|
17
|
-
cols.ordinal_position as column_index
|
50
|
+
END AS relation_type
|
18
51
|
FROM
|
19
52
|
information_schema.tables tbls
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
+
)
|
23
103
|
{%- 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,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,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 %}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dbt-firebolt
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.8.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
|
@@ -16,8 +16,9 @@ Classifier: Programming Language :: Python :: 3.9
|
|
16
16
|
Requires-Python: >=3.8
|
17
17
|
Description-Content-Type: text/markdown
|
18
18
|
License-File: LICENSE
|
19
|
-
Requires-Dist: dbt-
|
20
|
-
Requires-Dist:
|
19
|
+
Requires-Dist: dbt-adapters <2.0,>=1.0
|
20
|
+
Requires-Dist: dbt-core >=1.8.0
|
21
|
+
Requires-Dist: firebolt-sdk >=1.5.0
|
21
22
|
Requires-Dist: pydantic >=0.23
|
22
23
|
Provides-Extra: dev
|
23
24
|
Requires-Dist: allure-pytest ==2.* ; extra == 'dev'
|
@@ -1,20 +1,21 @@
|
|
1
|
-
dbt/adapters/firebolt/__init__.py,sha256=
|
1
|
+
dbt/adapters/firebolt/__init__.py,sha256=AB2VNoocItpC4GQIktvgs5c-CtwkwOGYZb867DFkJh0,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
|
-
dbt/adapters/firebolt/connections.py,sha256=
|
5
|
-
dbt/adapters/firebolt/impl.py,sha256=
|
6
|
-
dbt/adapters/firebolt/relation.py,sha256=
|
4
|
+
dbt/adapters/firebolt/connections.py,sha256=OWnvf7HNy_MKhJEBzj37_21sZNRzgRM-J5w4eXCr7hM,7934
|
5
|
+
dbt/adapters/firebolt/impl.py,sha256=vHK7AfpmMdZMCHaky3IEufl18IYFPs9mdvdmTpMrUh4,13939
|
6
|
+
dbt/adapters/firebolt/relation.py,sha256=Xg3Nrjw3UrF_qwnuGbPT97rSXRiDP1GlIAoBF4b7QnY,1922
|
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=
|
10
|
-
dbt/include/firebolt/macros/catalog.sql,sha256=
|
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
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=
|
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.
|
43
|
-
dbt_firebolt-1.
|
44
|
-
dbt_firebolt-1.
|
45
|
-
dbt_firebolt-1.
|
46
|
-
dbt_firebolt-1.
|
56
|
+
dbt_firebolt-1.8.0.dist-info/LICENSE,sha256=Nn0EGvW3qmoZpBV_JVM3iPukFf3RiNCIizrWe_2oTHk,11354
|
57
|
+
dbt_firebolt-1.8.0.dist-info/METADATA,sha256=Kw1aynZcI6HQabCP44_A1bbWTKqD7qBV0ZbbWLb_TTQ,5070
|
58
|
+
dbt_firebolt-1.8.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
59
|
+
dbt_firebolt-1.8.0.dist-info/top_level.txt,sha256=B2YH4he17ajilEWOGCKHbRcEJlCuZKwCcgFcLPntLsE,4
|
60
|
+
dbt_firebolt-1.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|