dbt-firebolt 1.8.3__tar.gz → 1.9.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/PKG-INFO +2 -2
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/README.md +1 -1
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/__init__.py +1 -1
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/impl.py +36 -5
- dbt_firebolt-1.9.0/dbt/include/firebolt/macros/materializations/snapshot_merge.sql +19 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/create.sql +6 -2
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt_firebolt.egg-info/PKG-INFO +2 -2
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt_firebolt.egg-info/SOURCES.txt +1 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/LICENSE +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/MANIFEST.in +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/__version__.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/column.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/connections.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/relation.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/relation_configs/__init__.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/__init__.py +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/dbt_project.yml +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/adapters/apply_grants.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/adapters/relation.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/adapters.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/catalog.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/clone.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/materialized_view.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/column_helpers.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/incremental.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/is_incremental.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/merge.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/on_schema_change.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/models/incremental/strategies.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/seed.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/table.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/test.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/view.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/materialized_view/alter.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/materialized_view/create.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/materialized_view/describe.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/materialized_view/drop.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/materialized_view/refresh.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/drop.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/rename.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/replace.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/create.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/drop.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/rename.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/replace.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_append.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_concat.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_construct.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/bool_or.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/cast_bool_to_text.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/dateadd.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/datediff.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/except.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/intersect.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/listagg.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/position.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/right.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/split_part.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/timestamps.sql +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt_firebolt.egg-info/dependency_links.txt +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt_firebolt.egg-info/requires.txt +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt_firebolt.egg-info/top_level.txt +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/pyproject.toml +0 -0
- {dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dbt_firebolt
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.9.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
|
@@ -69,7 +69,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
|
|
69
69
|
| Incremental materializations - insert_overwrite | :white_check_mark: |
|
70
70
|
| Incremental materializations - delete+insert | :white_check_mark: |
|
71
71
|
| Incremental materializations - merge | :x: |
|
72
|
-
| Snapshots | :
|
72
|
+
| Snapshots | :white_check_mark: |
|
73
73
|
| Seeds | :white_check_mark: |
|
74
74
|
| Tests | :white_check_mark: |
|
75
75
|
| Documentation | :white_check_mark: |
|
@@ -46,7 +46,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
|
|
46
46
|
| Incremental materializations - insert_overwrite | :white_check_mark: |
|
47
47
|
| Incremental materializations - delete+insert | :white_check_mark: |
|
48
48
|
| Incremental materializations - merge | :x: |
|
49
|
-
| Snapshots | :
|
49
|
+
| Snapshots | :white_check_mark: |
|
50
50
|
| Seeds | :white_check_mark: |
|
51
51
|
| Tests | :white_check_mark: |
|
52
52
|
| Documentation | :white_check_mark: |
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
import time
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from datetime import datetime
|
5
4
|
from typing import Any, List, Mapping, Optional, Union
|
6
5
|
|
7
6
|
import agate
|
@@ -29,21 +28,45 @@ from dbt.adapters.firebolt.connections import FireboltConnectionManager
|
|
29
28
|
from dbt.adapters.firebolt.relation import FireboltRelation
|
30
29
|
|
31
30
|
|
31
|
+
def quote_columns(columns: Union[str, List[str]]) -> Union[str, List[str]]:
|
32
|
+
if isinstance(columns, str):
|
33
|
+
return f'"{columns}"'
|
34
|
+
quoted_columns = []
|
35
|
+
for col in columns:
|
36
|
+
if col.startswith('"') and col.endswith('"'):
|
37
|
+
quoted_columns.append(col)
|
38
|
+
else:
|
39
|
+
quoted_columns.append(f'"{col}"')
|
40
|
+
return quoted_columns
|
41
|
+
|
42
|
+
|
32
43
|
@dataclass
|
33
44
|
class FireboltIndexConfig(dbtClassMixin):
|
34
45
|
index_type: str
|
46
|
+
index_name: Optional[str] = None
|
35
47
|
join_columns: Optional[Union[str, List[str]]] = None
|
36
48
|
key_columns: Optional[Union[str, List[str]]] = None
|
37
49
|
dimension_column: Optional[Union[str, List[str]]] = None
|
38
50
|
aggregation: Optional[Union[str, List[str]]] = None
|
39
51
|
|
52
|
+
def __post_init__(self) -> None:
|
53
|
+
# quote unquoted columns
|
54
|
+
if self.join_columns:
|
55
|
+
self.join_columns = quote_columns(self.join_columns)
|
56
|
+
if self.key_columns:
|
57
|
+
self.key_columns = quote_columns(self.key_columns)
|
58
|
+
if self.dimension_column:
|
59
|
+
self.dimension_column = quote_columns(self.dimension_column)
|
60
|
+
|
40
61
|
def render_name(self, relation: FireboltRelation) -> str:
|
41
62
|
"""
|
42
63
|
Name an index according to the following format, joined by `_`:
|
43
64
|
index type, relation name, key/join columns, timestamp (unix & UTC)
|
44
65
|
example index name: join_my_model_customer_id_1633504263.
|
45
66
|
"""
|
46
|
-
|
67
|
+
if self.index_name:
|
68
|
+
return self.index_name
|
69
|
+
now_unix = str(int(time.time()))
|
47
70
|
# If column_names is a list with > 1 members, join with _,
|
48
71
|
# otherwise do not. We were getting index names like
|
49
72
|
# join__idx__emf_customers__f_i_r_s_t___n_a_m_e__165093112.
|
@@ -51,14 +74,23 @@ class FireboltIndexConfig(dbtClassMixin):
|
|
51
74
|
spine_col = (
|
52
75
|
'_'.join(column_names) if isinstance(column_names, list) else column_names
|
53
76
|
)
|
77
|
+
# Additional hash to ensure uniqueness after spaces are removed
|
78
|
+
column_hash = str(hash(spine_col))[:5]
|
54
79
|
inputs = [
|
55
80
|
f'{self.index_type}_idx',
|
56
81
|
relation.identifier,
|
57
82
|
spine_col,
|
83
|
+
column_hash,
|
58
84
|
now_unix,
|
59
85
|
]
|
60
|
-
|
61
|
-
|
86
|
+
index_name = '__'.join([x for x in inputs if x is not None])
|
87
|
+
if len(index_name) > 255:
|
88
|
+
# Firebolt index names must be <= 255 characters.
|
89
|
+
# If the index name is too long, hash it.
|
90
|
+
return f'{self.index_type}_idx_{hash(index_name)}'
|
91
|
+
# Remove any spaces or quotes from the index name.
|
92
|
+
index_name = index_name.replace(' ', '_').replace('"', '')
|
93
|
+
return index_name
|
62
94
|
|
63
95
|
@classmethod
|
64
96
|
def parse(cls, raw_index: Optional[Mapping]) -> Optional['FireboltIndexConfig']:
|
@@ -274,7 +306,6 @@ class FireboltAdapter(SQLAdapter):
|
|
274
306
|
columns: the number of rows that are different between the two
|
275
307
|
relations and the number of mismatched rows.
|
276
308
|
"""
|
277
|
-
# This method only really exists for test reasons.
|
278
309
|
names: List[str]
|
279
310
|
if column_names is None:
|
280
311
|
columns = self.get_columns_in_relation(relation_a)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{% macro firebolt__snapshot_merge_sql(target, source, insert_cols) -%}
|
2
|
+
{%- set insert_cols_csv = insert_cols | join(', ') -%}
|
3
|
+
|
4
|
+
UPDATE {{ target.render() }} AS DBT_INTERNAL_DEST
|
5
|
+
SET dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to
|
6
|
+
FROM {{ source }} AS DBT_INTERNAL_SOURCE
|
7
|
+
WHERE DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id
|
8
|
+
AND DBT_INTERNAL_DEST.dbt_valid_to IS NULL
|
9
|
+
AND DBT_INTERNAL_SOURCE.dbt_change_type IN ('update', 'delete');
|
10
|
+
|
11
|
+
INSERT INTO {{ target.render() }} ({{ insert_cols_csv }})
|
12
|
+
SELECT {{ insert_cols_csv }}
|
13
|
+
FROM {{ source }} AS DBT_INTERNAL_SOURCE
|
14
|
+
WHERE DBT_INTERNAL_SOURCE.dbt_scd_id NOT IN (
|
15
|
+
SELECT dbt_scd_id FROM {{ target.render() }}
|
16
|
+
)
|
17
|
+
AND DBT_INTERNAL_SOURCE.dbt_change_type = 'insert';
|
18
|
+
|
19
|
+
{% endmacro %}
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/create.sql
RENAMED
@@ -24,6 +24,10 @@
|
|
24
24
|
) }}
|
25
25
|
{%- endif -%}
|
26
26
|
|
27
|
+
{%- if temporary -%}
|
28
|
+
{%- do adapter.drop_relation(relation) -%}
|
29
|
+
{%- endif -%}
|
30
|
+
|
27
31
|
{%- set table_type = config.get(
|
28
32
|
'table_type',
|
29
33
|
default = 'dimension'
|
@@ -49,9 +53,9 @@
|
|
49
53
|
|
50
54
|
{%- if primary_index %}
|
51
55
|
primary INDEX {% if primary_index is iterable and primary_index is not string %}
|
52
|
-
{{ primary_index | join(', ') }}
|
56
|
+
"{{ primary_index | join('", "') }}"
|
53
57
|
{%- else -%}
|
54
|
-
{{ primary_index }}
|
58
|
+
"{{ primary_index }}"
|
55
59
|
{%- endif -%}
|
56
60
|
{%- endif -%}
|
57
61
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dbt-firebolt
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.9.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
|
@@ -69,7 +69,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
|
|
69
69
|
| Incremental materializations - insert_overwrite | :white_check_mark: |
|
70
70
|
| Incremental materializations - delete+insert | :white_check_mark: |
|
71
71
|
| Incremental materializations - merge | :x: |
|
72
|
-
| Snapshots | :
|
72
|
+
| Snapshots | :white_check_mark: |
|
73
73
|
| Seeds | :white_check_mark: |
|
74
74
|
| Tests | :white_check_mark: |
|
75
75
|
| Documentation | :white_check_mark: |
|
@@ -22,6 +22,7 @@ setup.cfg
|
|
22
22
|
./dbt/include/firebolt/macros/materializations/clone.sql
|
23
23
|
./dbt/include/firebolt/macros/materializations/materialized_view.sql
|
24
24
|
./dbt/include/firebolt/macros/materializations/seed.sql
|
25
|
+
./dbt/include/firebolt/macros/materializations/snapshot_merge.sql
|
25
26
|
./dbt/include/firebolt/macros/materializations/table.sql
|
26
27
|
./dbt/include/firebolt/macros/materializations/test.sql
|
27
28
|
./dbt/include/firebolt/macros/materializations/view.sql
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/adapters/firebolt/relation_configs/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/adapters/apply_grants.sql
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql
RENAMED
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/clone.sql
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/seed.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/table.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/test.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/materializations/view.sql
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/drop.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/rename.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/table/replace.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/create.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/drop.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/rename.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/relations/view/replace.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_append.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_concat.sql
RENAMED
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/array_construct.sql
RENAMED
File without changes
|
File without changes
|
{dbt_firebolt-1.8.3 → dbt_firebolt-1.9.0}/dbt/include/firebolt/macros/utils/cast_bool_to_text.sql
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|