dbt-firebolt 1.4.2__tar.gz → 1.4.4__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/PKG-INFO +1 -1
  2. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/__init__.py +1 -1
  3. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/column.py +1 -1
  4. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/connections.py +41 -4
  5. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/impl.py +1 -2
  6. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/merge.sql +6 -7
  7. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/on_schema_change.sql +13 -5
  8. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/cast_bool_to_text.sql +2 -2
  9. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/datediff.sql +1 -1
  10. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/PKG-INFO +1 -1
  11. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/requires.txt +2 -1
  12. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/setup.cfg +2 -1
  13. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/LICENSE +0 -0
  14. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/MANIFEST.in +0 -0
  15. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/README.md +0 -0
  16. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/__version__.py +0 -0
  17. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/adapters/firebolt/relation.py +0 -0
  18. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/__init__.py +0 -0
  19. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/dbt_project.yml +0 -0
  20. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters/apply_grants.sql +0 -0
  21. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters/relation.sql +0 -0
  22. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/adapters.sql +0 -0
  23. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/catalog.sql +0 -0
  24. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +0 -0
  25. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql +0 -0
  26. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql +0 -0
  27. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/column_helpers.sql +0 -0
  28. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/incremental.sql +0 -0
  29. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/is_incremental.sql +0 -0
  30. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/models/incremental/strategies.sql +0 -0
  31. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/seed.sql +0 -0
  32. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/table.sql +0 -0
  33. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/test.sql +0 -0
  34. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/materializations/view.sql +0 -0
  35. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_append.sql +0 -0
  36. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_concat.sql +0 -0
  37. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/array_construct.sql +0 -0
  38. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/bool_or.sql +0 -0
  39. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/dateadd.sql +0 -0
  40. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/except.sql +0 -0
  41. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/intersect.sql +0 -0
  42. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/listagg.sql +0 -0
  43. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/position.sql +0 -0
  44. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/right.sql +0 -0
  45. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/split_part.sql +0 -0
  46. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt/include/firebolt/macros/utils/timestamps.sql +0 -0
  47. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/SOURCES.txt +0 -0
  48. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/dependency_links.txt +0 -0
  49. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/dbt_firebolt.egg-info/top_level.txt +0 -0
  50. {dbt_firebolt-1.4.2 → dbt_firebolt-1.4.4}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt_firebolt
3
- Version: 1.4.2
3
+ Version: 1.4.4
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
@@ -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.4.2"
10
+ __version__ = "1.4.4"
11
11
 
12
12
  Plugin = AdapterPlugin(
13
13
  adapter=FireboltAdapter, # type: ignore
@@ -17,4 +17,4 @@ class FireboltColumn(Column):
17
17
  def from_description(cls, name: str, raw_data_type: str) -> Column:
18
18
  if raw_data_type.startswith('ARRAY'):
19
19
  return cls(name, raw_data_type)
20
- return Column.from_description(name, raw_data_type)
20
+ return super().from_description(name, raw_data_type)
@@ -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=UsernamePassword(credentials.user, credentials.password),
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
- {% for key in unique_key %}
10
- {{ target }}.{{ key }} in (select {{ key }} from {{ source }})
11
- {{ "and " if not loop.last }}
12
- {% endfor %}
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
- {% do exceptions.raise_compiler_error(
75
- 'Schema changes detected. Either revert the change or run the model with the ' ~
76
- '--full-refresh flag on the command line to recreate the model with the new ' ~
77
- 'schema definition. Running with the --full-refresh flag drops and recreates ' ~
78
- 'the database object.') %}
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']) }}
@@ -1,7 +1,7 @@
1
1
  {% macro firebolt__cast_bool_to_text(field) %}
2
2
  CASE
3
- WHEN {{ field }} = 0 THEN 'false'
4
- WHEN {{ field }} = 1 THEN 'true'
3
+ WHEN {{ field }} = false THEN 'false'
4
+ WHEN {{ field }} = true THEN 'true'
5
5
  ELSE NULL
6
6
  END
7
7
  {% endmacro %}
@@ -1,6 +1,6 @@
1
1
  {% macro firebolt__datediff(first_date, second_date, datepart) -%}
2
2
 
3
- datediff(
3
+ date_diff(
4
4
  '{{ datepart }}',
5
5
  {{ first_date }} :: TIMESTAMP,
6
6
  {{ second_date }} :: TIMESTAMP
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt-firebolt
3
- Version: 1.4.2
3
+ Version: 1.4.4
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,7 +1,8 @@
1
1
  dbt-core~=1.4
2
- firebolt-sdk>=0.10.0
2
+ firebolt-sdk>=1.1.0
3
3
 
4
4
  [dev]
5
+ allure-pytest==2.*
5
6
  dbt-tests-adapter~=1.4
6
7
  mypy==0.910
7
8
  pre-commit==2.15.0
@@ -24,7 +24,7 @@ project_urls =
24
24
  packages = find_namespace:
25
25
  install_requires =
26
26
  dbt-core~=1.4
27
- firebolt-sdk>=0.10.0
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