dbt-firebolt 1.9.4__tar.gz → 1.11.0__tar.gz

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.
Files changed (67) hide show
  1. {dbt_firebolt-1.9.4/dbt_firebolt.egg-info → dbt_firebolt-1.11.0}/PKG-INFO +3 -3
  2. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/README.md +1 -1
  3. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/__init__.py +1 -1
  4. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/connections.py +56 -28
  5. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/impl.py +2 -1
  6. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/strategies.sql +2 -0
  7. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/seed.sql +7 -1
  8. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/table/create.sql +3 -1
  9. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0/dbt_firebolt.egg-info}/PKG-INFO +3 -3
  10. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt_firebolt.egg-info/requires.txt +1 -1
  11. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/setup.cfg +1 -1
  12. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/LICENSE +0 -0
  13. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/MANIFEST.in +0 -0
  14. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/__version__.py +0 -0
  15. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/column.py +0 -0
  16. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/relation.py +0 -0
  17. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/adapters/firebolt/relation_configs/__init__.py +0 -0
  18. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/__init__.py +0 -0
  19. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/dbt_project.yml +0 -0
  20. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/adapters/apply_grants.sql +0 -0
  21. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/adapters/relation.sql +0 -0
  22. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/adapters.sql +0 -0
  23. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/catalog.sql +0 -0
  24. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/dbt_external_tables/create_external_table.sql +0 -0
  25. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/dbt_external_tables/dropif.sql +0 -0
  26. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/dbt_external_tables/get_external_build_plan.sql +0 -0
  27. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/clone.sql +0 -0
  28. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/materialized_view.sql +0 -0
  29. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/column_helpers.sql +0 -0
  30. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/incremental.sql +0 -0
  31. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/is_incremental.sql +0 -0
  32. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/merge.sql +0 -0
  33. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/models/incremental/on_schema_change.sql +0 -0
  34. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/snapshot_merge.sql +0 -0
  35. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/table.sql +0 -0
  36. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/test.sql +0 -0
  37. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/materializations/view.sql +0 -0
  38. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/materialized_view/alter.sql +0 -0
  39. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/materialized_view/create.sql +0 -0
  40. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/materialized_view/describe.sql +0 -0
  41. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/materialized_view/drop.sql +0 -0
  42. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/materialized_view/refresh.sql +0 -0
  43. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/table/drop.sql +0 -0
  44. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/table/rename.sql +0 -0
  45. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/table/replace.sql +0 -0
  46. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/view/create.sql +0 -0
  47. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/view/drop.sql +0 -0
  48. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/view/rename.sql +0 -0
  49. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/relations/view/replace.sql +0 -0
  50. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/array_append.sql +0 -0
  51. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/array_concat.sql +0 -0
  52. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/array_construct.sql +0 -0
  53. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/bool_or.sql +0 -0
  54. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/cast_bool_to_text.sql +0 -0
  55. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/dateadd.sql +0 -0
  56. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/datediff.sql +0 -0
  57. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/except.sql +0 -0
  58. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/intersect.sql +0 -0
  59. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/listagg.sql +0 -0
  60. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/position.sql +0 -0
  61. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/right.sql +0 -0
  62. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/split_part.sql +0 -0
  63. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt/include/firebolt/macros/utils/timestamps.sql +0 -0
  64. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt_firebolt.egg-info/SOURCES.txt +0 -0
  65. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt_firebolt.egg-info/dependency_links.txt +0 -0
  66. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/dbt_firebolt.egg-info/top_level.txt +0 -0
  67. {dbt_firebolt-1.9.4 → dbt_firebolt-1.11.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt_firebolt
3
- Version: 1.9.4
3
+ Version: 1.11.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
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: dbt-adapters<2.0,>=1.0
23
23
  Requires-Dist: dbt-core>=1.8.0
24
- Requires-Dist: firebolt-sdk>=1.8.1
24
+ Requires-Dist: firebolt-sdk>=1.13.0
25
25
  Requires-Dist: pydantic>=0.23
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: allure-pytest==2.*; extra == "dev"
@@ -77,7 +77,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
77
77
  | Incremental materializations - append | :white_check_mark: |
78
78
  | Incremental materializations - insert_overwrite | :white_check_mark: |
79
79
  | Incremental materializations - delete+insert | :white_check_mark: |
80
- | Incremental materializations - merge | :x: |
80
+ | Incremental materializations - merge | :white_check_mark: |
81
81
  | Snapshots | :white_check_mark: |
82
82
  | Seeds | :white_check_mark: |
83
83
  | Tests | :white_check_mark: |
@@ -45,7 +45,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
45
45
  | Incremental materializations - append | :white_check_mark: |
46
46
  | Incremental materializations - insert_overwrite | :white_check_mark: |
47
47
  | Incremental materializations - delete+insert | :white_check_mark: |
48
- | Incremental materializations - merge | :x: |
48
+ | Incremental materializations - merge | :white_check_mark: |
49
49
  | Snapshots | :white_check_mark: |
50
50
  | Seeds | :white_check_mark: |
51
51
  | Tests | :white_check_mark: |
@@ -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.9.4"
10
+ __version__ = "1.11.0"
11
11
 
12
12
  Plugin = AdapterPlugin(
13
13
  adapter=FireboltAdapter, # type: ignore
@@ -19,7 +19,12 @@ from dbt_common.exceptions import (
19
19
  NotImplementedError,
20
20
  )
21
21
  from firebolt.client import DEFAULT_API_URL
22
- from firebolt.client.auth import Auth, ClientCredentials, UsernamePassword
22
+ from firebolt.client.auth import (
23
+ Auth,
24
+ ClientCredentials,
25
+ FireboltCore,
26
+ UsernamePassword,
27
+ )
23
28
  from firebolt.db import ARRAY, DECIMAL, ExtendedType
24
29
  from firebolt.db import connect as sdk_connect
25
30
  from firebolt.db.connection import Connection as SDKConnection
@@ -41,6 +46,7 @@ class FireboltCredentials(Credentials):
41
46
  api_endpoint: Optional[str] = DEFAULT_API_URL
42
47
  engine_name: Optional[str] = None
43
48
  account_name: Optional[str] = None
49
+ url: Optional[str] = None
44
50
  retries: int = 1
45
51
 
46
52
  _ALIASES = {
@@ -48,26 +54,14 @@ class FireboltCredentials(Credentials):
48
54
  }
49
55
 
50
56
  def __post_init__(self) -> None:
51
- # If user and password are not provided, assume client_id and client_secret
52
- # are provided instead
53
- if not self.user and not self.password:
54
- if not self.client_id or not self.client_secret:
55
- raise DbtConfigError(
56
- 'Either user and password or client_id and client_secret'
57
- ' must be provided'
58
- )
59
- else:
60
- if self.client_id or self.client_secret:
61
- raise DbtConfigError(
62
- 'Either user and password or client_id and client_secret'
63
- ' must be provided'
64
- )
57
+ # Check the credentials are valid and we can determine the auth method
58
+ _determine_auth(self)
65
59
 
66
60
  @property
67
61
  def type(self) -> str:
68
62
  return 'firebolt'
69
63
 
70
- def _connection_keys(self) -> Tuple[str, str, str, str, str, str, str]:
64
+ def _connection_keys(self) -> Tuple[str, str, str, str, str, str, str, str]:
71
65
  """
72
66
  Return tuple of keys (i.e. not values) to display
73
67
  in the `dbt debug` output.
@@ -80,6 +74,7 @@ class FireboltCredentials(Credentials):
80
74
  'database',
81
75
  'engine_name',
82
76
  'params',
77
+ 'url',
83
78
  )
84
79
 
85
80
  @property
@@ -222,17 +217,50 @@ class FireboltConnectionManager(SQLConnectionManager):
222
217
 
223
218
 
224
219
  def _determine_auth(credentials: FireboltCredentials) -> Auth:
225
- if credentials.client_id and credentials.client_secret:
226
- return ClientCredentials(credentials.client_id, credentials.client_secret)
227
- elif '@' in credentials.user: # type: ignore # checked in the dataclass
228
- # email auth can only be used with UsernamePassword
229
- return UsernamePassword(
230
- credentials.user, # type: ignore[arg-type]
231
- credentials.password, # type: ignore[arg-type]
232
- )
233
- else:
234
- # assume user provided id and secret in the user/password fields
220
+ """Determine the appropriate authentication method based on provided credentials."""
221
+
222
+ def _has_client_credentials() -> bool:
223
+ return bool(credentials.client_id and credentials.client_secret)
224
+
225
+ def _has_user_password() -> bool:
226
+ return bool(credentials.user and credentials.password)
227
+
228
+ def _is_email_auth() -> bool:
229
+ return bool(credentials.user and '@' in credentials.user)
230
+
231
+ # Handle Firebolt Core authentication (no other credentials allowed)
232
+ if credentials.url:
233
+ if _has_client_credentials() or _has_user_password():
234
+ raise DbtConfigError(
235
+ 'If url is provided, do not provide user, password, '
236
+ 'client_id, or client_secret.'
237
+ )
238
+ return FireboltCore()
239
+
240
+ # Handle client credentials authentication
241
+ if _has_client_credentials():
235
242
  return ClientCredentials(
236
- credentials.user, # type: ignore[arg-type]
237
- credentials.password, # type: ignore[arg-type]
243
+ credentials.client_id, # type: ignore[arg-type]
244
+ credentials.client_secret, # type: ignore[arg-type]
238
245
  )
246
+
247
+ # Handle username/password authentication
248
+ if _has_user_password():
249
+ if _is_email_auth():
250
+ return UsernamePassword(
251
+ credentials.user, # type: ignore[arg-type]
252
+ credentials.password, # type: ignore[arg-type]
253
+ )
254
+ else:
255
+ return ClientCredentials(
256
+ credentials.user, # type: ignore[arg-type]
257
+ credentials.password, # type: ignore[arg-type]
258
+ )
259
+
260
+ # If we reach here, no valid authentication method was found
261
+ raise DbtConfigError(
262
+ 'No valid authentication method found. Provide either:\n'
263
+ '- client_id and client_secret\n'
264
+ '- user and password\n'
265
+ '- or use url for Firebolt Core connection'
266
+ )
@@ -313,7 +313,8 @@ class FireboltAdapter(SQLAdapter):
313
313
  names = sorted((self.quote(n) for n in column_names))
314
314
 
315
315
  where_expressions = [
316
- f'{relation_a}.{name} = {relation_b}.{name}' for name in names
316
+ f'{relation_a}.{name} IS NOT DISTINCT FROM {relation_b}.{name}'
317
+ for name in names
317
318
  ]
318
319
  where_clause = ' AND '.join(where_expressions)
319
320
  columns_csv = ', '.join(names)
@@ -19,6 +19,8 @@
19
19
  {{ get_insert_overwrite_sql(source, target, dest_columns) }}
20
20
  {%- elif strategy == 'delete+insert' -%}
21
21
  {% do return(get_delete_insert_merge_sql(target, source, unique_key, dest_columns, incremental_predicates)) %}
22
+ {%- elif strategy == 'merge' -%}
23
+ {{ get_merge_sql(target, source, unique_key, dest_columns, incremental_predicates) }}
22
24
  {%- elif strategy is not none -%}
23
25
  {% do exceptions.raise_compiler_error('Model %s has incremental strategy %s '
24
26
  'specified, but that strategy is not '
@@ -7,9 +7,15 @@
7
7
  {% macro firebolt__create_csv_table(model, agate_table) %}
8
8
  {%- set column_override = model['config'].get('column_types', {}) -%}
9
9
  {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}
10
+ {%- set is_firebolt_core = target.url is defined and target.url -%}
11
+ {%- set default_table_type = 'fact' if is_firebolt_core else 'dimension' -%}
12
+ {%- set table_type = config.get(
13
+ 'table_type',
14
+ default = default_table_type
15
+ ) | upper -%}
10
16
  {% set sql %}
11
17
 
12
- CREATE DIMENSION TABLE IF NOT EXISTS {{ this.render() }} (
18
+ CREATE {{ table_type }} TABLE IF NOT EXISTS {{ this.render() }} (
13
19
  {%- for col_name in agate_table.column_names -%}
14
20
  {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}
15
21
  {%- set type = column_override.get(col_name, inferred_type) -%}
@@ -28,9 +28,11 @@
28
28
  {%- do adapter.drop_relation(relation) -%}
29
29
  {%- endif -%}
30
30
 
31
+ {%- set is_firebolt_core = target.url is defined and target.url -%}
32
+ {%- set default_table_type = 'fact' if is_firebolt_core else 'dimension' -%}
31
33
  {%- set table_type = config.get(
32
34
  'table_type',
33
- default = 'dimension'
35
+ default = default_table_type
34
36
  ) | upper -%}
35
37
  {%- set primary_index = config.get('primary_index') -%}
36
38
  {%- set incremental_strategy = config.get('incremental_strategy') -%}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt_firebolt
3
- Version: 1.9.4
3
+ Version: 1.11.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
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: dbt-adapters<2.0,>=1.0
23
23
  Requires-Dist: dbt-core>=1.8.0
24
- Requires-Dist: firebolt-sdk>=1.8.1
24
+ Requires-Dist: firebolt-sdk>=1.13.0
25
25
  Requires-Dist: pydantic>=0.23
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: allure-pytest==2.*; extra == "dev"
@@ -77,7 +77,7 @@ The table below shows which dbt and Firebolt features are supported by the adapt
77
77
  | Incremental materializations - append | :white_check_mark: |
78
78
  | Incremental materializations - insert_overwrite | :white_check_mark: |
79
79
  | Incremental materializations - delete+insert | :white_check_mark: |
80
- | Incremental materializations - merge | :x: |
80
+ | Incremental materializations - merge | :white_check_mark: |
81
81
  | Snapshots | :white_check_mark: |
82
82
  | Seeds | :white_check_mark: |
83
83
  | Tests | :white_check_mark: |
@@ -1,6 +1,6 @@
1
1
  dbt-adapters<2.0,>=1.0
2
2
  dbt-core>=1.8.0
3
- firebolt-sdk>=1.8.1
3
+ firebolt-sdk>=1.13.0
4
4
  pydantic>=0.23
5
5
 
6
6
  [dev]
@@ -27,7 +27,7 @@ packages = find_namespace:
27
27
  install_requires =
28
28
  dbt-adapters>=1.0,<2.0
29
29
  dbt-core>=1.8.0
30
- firebolt-sdk>=1.8.1
30
+ firebolt-sdk>=1.13.0
31
31
  pydantic>=0.23
32
32
  python_requires = >=3.8
33
33
  include_package_data = True
File without changes
File without changes