dbt-firebolt 1.4.3__tar.gz → 1.4.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/PKG-INFO +1 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/__init__.py +1 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/connections.py +41 -4
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/impl.py +1 -2
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/merge.sql +6 -7
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/on_schema_change.sql +13 -5
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/cast_bool_to_text.sql +2 -2
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/datediff.sql +1 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/PKG-INFO +1 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/requires.txt +2 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/setup.cfg +2 -1
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/LICENSE +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/MANIFEST.in +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/README.md +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/__version__.py +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/column.py +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/relation.py +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/__init__.py +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/dbt_project.yml +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters/apply_grants.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters/relation.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/catalog.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/column_helpers.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/incremental.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/is_incremental.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/strategies.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/seed.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/table.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/test.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/view.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_append.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_concat.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_construct.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/bool_or.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/dateadd.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/except.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/intersect.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/listagg.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/position.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/right.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/split_part.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/timestamps.sql +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/SOURCES.txt +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/dependency_links.txt +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/top_level.txt +0 -0
- {dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/pyproject.toml +0 -0
@@ -14,7 +14,7 @@ from dbt.contracts.connection import (
|
|
14
14
|
from dbt.events import AdapterLogger # type: ignore
|
15
15
|
from dbt.exceptions import DbtRuntimeError
|
16
16
|
from firebolt.client import DEFAULT_API_URL
|
17
|
-
from firebolt.client.auth import UsernamePassword
|
17
|
+
from firebolt.client.auth import Auth, ClientCredentials, UsernamePassword
|
18
18
|
from firebolt.db import connect as sdk_connect
|
19
19
|
from firebolt.db.connection import Connection as SDKConnection
|
20
20
|
from firebolt.db.cursor import Cursor
|
@@ -27,14 +27,33 @@ logger = AdapterLogger('Firebolt')
|
|
27
27
|
@dataclass
|
28
28
|
class FireboltCredentials(Credentials):
|
29
29
|
# These values all come from either profiles.yml or dbt_project.yml.
|
30
|
-
user: str
|
31
|
-
password: str
|
30
|
+
user: Optional[str] = None
|
31
|
+
password: Optional[str] = None
|
32
|
+
# New way to authenticate
|
33
|
+
client_id: Optional[str] = None
|
34
|
+
client_secret: Optional[str] = None
|
32
35
|
api_endpoint: Optional[str] = DEFAULT_API_URL
|
33
36
|
driver: str = 'com.firebolt.FireboltDriver'
|
34
37
|
engine_name: Optional[str] = None
|
35
38
|
account_name: Optional[str] = None
|
36
39
|
retries: int = 1
|
37
40
|
|
41
|
+
def __post_init__(self) -> None:
|
42
|
+
# If user and password are not provided, assume client_id and client_secret
|
43
|
+
# are provided instead
|
44
|
+
if not self.user and not self.password:
|
45
|
+
if not self.client_id or not self.client_secret:
|
46
|
+
raise dbt.exceptions.DbtProfileError(
|
47
|
+
'Either user and password or client_id and client_secret'
|
48
|
+
' must be provided'
|
49
|
+
)
|
50
|
+
else:
|
51
|
+
if self.client_id or self.client_secret:
|
52
|
+
raise dbt.exceptions.DbtProfileError(
|
53
|
+
'Either user and password or client_id and client_secret'
|
54
|
+
' must be provided'
|
55
|
+
)
|
56
|
+
|
38
57
|
@property
|
39
58
|
def type(self) -> str:
|
40
59
|
return 'firebolt'
|
@@ -94,10 +113,11 @@ class FireboltConnectionManager(SQLConnectionManager):
|
|
94
113
|
if connection.state == 'open':
|
95
114
|
return connection
|
96
115
|
credentials = connection.credentials
|
116
|
+
auth: Auth = _determine_auth(credentials)
|
97
117
|
|
98
118
|
def connect() -> SDKConnection:
|
99
119
|
handle = sdk_connect(
|
100
|
-
auth=
|
120
|
+
auth=auth,
|
101
121
|
engine_name=credentials.engine_name,
|
102
122
|
database=credentials.database,
|
103
123
|
api_endpoint=credentials.api_endpoint,
|
@@ -162,3 +182,20 @@ class FireboltConnectionManager(SQLConnectionManager):
|
|
162
182
|
raise dbt.exceptions.NotImplementedError(
|
163
183
|
'`cancel` is not implemented for this adapter!'
|
164
184
|
)
|
185
|
+
|
186
|
+
|
187
|
+
def _determine_auth(credentials: FireboltCredentials) -> Auth:
|
188
|
+
if credentials.client_id and credentials.client_secret:
|
189
|
+
return ClientCredentials(credentials.client_id, credentials.client_secret)
|
190
|
+
elif '@' in credentials.user: # type: ignore # checked in the dataclass
|
191
|
+
# email auth can only be used with UsernamePassword
|
192
|
+
return UsernamePassword(
|
193
|
+
credentials.user, # type: ignore[arg-type]
|
194
|
+
credentials.password, # type: ignore[arg-type]
|
195
|
+
)
|
196
|
+
else:
|
197
|
+
# assume user provided id and secret in the user/password fields
|
198
|
+
return ClientCredentials(
|
199
|
+
credentials.user, # type: ignore[arg-type]
|
200
|
+
credentials.password, # type: ignore[arg-type]
|
201
|
+
)
|
@@ -14,7 +14,6 @@ from dbt.exceptions import (
|
|
14
14
|
CompilationError,
|
15
15
|
DbtRuntimeError,
|
16
16
|
NotImplementedError,
|
17
|
-
validator_error_message,
|
18
17
|
)
|
19
18
|
|
20
19
|
from dbt.adapters.firebolt.column import FireboltColumn
|
@@ -91,7 +90,7 @@ class FireboltIndexConfig(dbtClassMixin):
|
|
91
90
|
)
|
92
91
|
return index_config
|
93
92
|
except ValidationError as exc:
|
94
|
-
msg = validator_error_message(exc)
|
93
|
+
msg = DbtRuntimeError('').validator_error_message(exc)
|
95
94
|
raise CompilationError(f'Could not parse index config: {msg}.')
|
96
95
|
return None
|
97
96
|
|
@@ -5,17 +5,16 @@
|
|
5
5
|
{% if unique_key %}
|
6
6
|
{% if unique_key is sequence and unique_key is not string %}
|
7
7
|
delete from {{ target }}
|
8
|
-
where
|
9
|
-
{
|
10
|
-
|
11
|
-
{{
|
12
|
-
|
8
|
+
where
|
9
|
+
({{ get_quoted_csv(unique_key) }}) in (
|
10
|
+
select {{ get_quoted_csv(unique_key) }}
|
11
|
+
from {{ source }}
|
12
|
+
)
|
13
13
|
{% if incremental_predicates %}
|
14
14
|
{% for predicate in incremental_predicates %}
|
15
15
|
and {{ predicate }}
|
16
16
|
{% endfor %}
|
17
|
-
{% endif %}
|
18
|
-
);
|
17
|
+
{% endif %};
|
19
18
|
{% else %}
|
20
19
|
delete from {{ target }}
|
21
20
|
where (
|
@@ -71,11 +71,19 @@
|
|
71
71
|
{% do exceptions.raise_compiler_error(
|
72
72
|
'A schema change was detected and `on_schema_change` was set to "fail".') %}
|
73
73
|
{% else %}
|
74
|
-
{%
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
{% set fail_msg %}
|
75
|
+
Schema changes detected on this incremental!
|
76
|
+
Either revert the change or run the model with the --full-refresh flag
|
77
|
+
on the command line to recreate the model with the new schema definition.
|
78
|
+
Running with the --full-refresh flag drops and recreates the database object.
|
79
|
+
|
80
|
+
Additional troubleshooting context:
|
81
|
+
Source columns not in target: {{ schema_changes_dict['source_not_in_target'] }}
|
82
|
+
Target columns not in source: {{ schema_changes_dict['target_not_in_source'] }}
|
83
|
+
New column types: {{ schema_changes_dict['new_target_types'] }}
|
84
|
+
{% endset %}
|
85
|
+
|
86
|
+
{% do exceptions.raise_compiler_error(fail_msg) %}
|
79
87
|
{% endif %}
|
80
88
|
{% endif %}
|
81
89
|
{{ return(schema_changes_dict['common_columns']) }}
|
@@ -24,7 +24,7 @@ project_urls =
|
|
24
24
|
packages = find_namespace:
|
25
25
|
install_requires =
|
26
26
|
dbt-core~=1.4
|
27
|
-
firebolt-sdk>=
|
27
|
+
firebolt-sdk>=1.1.0
|
28
28
|
python_requires = >=3.7
|
29
29
|
include_package_data = True
|
30
30
|
package_dir =
|
@@ -36,6 +36,7 @@ include = dbt, dbt.*
|
|
36
36
|
|
37
37
|
[options.extras_require]
|
38
38
|
dev =
|
39
|
+
allure-pytest==2.*
|
39
40
|
dbt-tests-adapter~=1.4
|
40
41
|
mypy==0.910
|
41
42
|
pre-commit==2.15.0
|
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.4.3 → dbt_firebolt-1.4.4}/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.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/seed.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/table.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/test.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/view.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_append.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_concat.sql
RENAMED
File without changes
|
{dbt_firebolt-1.4.3 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_construct.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
|