dagster-airbyte 0.20.4__tar.gz → 0.20.6__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.

Potentially problematic release.


This version of dagster-airbyte might be problematic. Click here for more details.

Files changed (30) hide show
  1. {dagster-airbyte-0.20.4/dagster_airbyte.egg-info → dagster-airbyte-0.20.6}/PKG-INFO +1 -1
  2. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/asset_defs.py +67 -47
  3. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/reconciliation.py +5 -3
  4. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/types.py +5 -3
  5. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/resources.py +5 -3
  6. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/types.py +1 -2
  7. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/utils.py +3 -3
  8. dagster-airbyte-0.20.6/dagster_airbyte/version.py +1 -0
  9. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6/dagster_airbyte.egg-info}/PKG-INFO +1 -1
  10. dagster-airbyte-0.20.6/dagster_airbyte.egg-info/requires.txt +8 -0
  11. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/setup.py +2 -2
  12. dagster-airbyte-0.20.4/dagster_airbyte/version.py +0 -1
  13. dagster-airbyte-0.20.4/dagster_airbyte.egg-info/requires.txt +0 -8
  14. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/LICENSE +0 -0
  15. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/MANIFEST.in +0 -0
  16. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/README.md +0 -0
  17. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/__init__.py +0 -0
  18. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/cli.py +0 -0
  19. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/__init__.py +0 -0
  20. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/generated/__init__.py +0 -0
  21. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/generated/destinations.py +0 -0
  22. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/managed/generated/sources.py +0 -0
  23. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/ops.py +0 -0
  24. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte/py.typed +0 -0
  25. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte.egg-info/SOURCES.txt +0 -0
  26. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte.egg-info/dependency_links.txt +0 -0
  27. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte.egg-info/entry_points.txt +0 -0
  28. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte.egg-info/not-zip-safe +0 -0
  29. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/dagster_airbyte.egg-info/top_level.txt +0 -0
  30. {dagster-airbyte-0.20.4 → dagster-airbyte-0.20.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dagster-airbyte
3
- Version: 0.20.4
3
+ Version: 0.20.6
4
4
  Summary: Package for integrating Airbyte with Dagster.
5
5
  Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-airbyte
6
6
  Author: Elementl
@@ -54,6 +54,10 @@ from dagster_airbyte.utils import (
54
54
  )
55
55
 
56
56
 
57
+ def _table_to_output_name_fn(table: str) -> str:
58
+ return table.replace("-", "_")
59
+
60
+
57
61
  def _build_airbyte_asset_defn_metadata(
58
62
  connection_id: str,
59
63
  destination_tables: Sequence[str],
@@ -82,7 +86,10 @@ def _build_airbyte_asset_defn_metadata(
82
86
  )
83
87
 
84
88
  outputs = {
85
- table: AssetKey([*asset_key_prefix, *table_to_asset_key_fn(table).path]) for table in tables
89
+ _table_to_output_name_fn(table): AssetKey(
90
+ [*asset_key_prefix, *table_to_asset_key_fn(table).path]
91
+ )
92
+ for table in tables
86
93
  }
87
94
 
88
95
  internal_deps: Dict[str, Set[AssetKey]] = {}
@@ -105,28 +112,32 @@ def _build_airbyte_asset_defn_metadata(
105
112
  internal_deps[table] = set(upstream_assets or [])
106
113
 
107
114
  return AssetsDefinitionCacheableData(
108
- keys_by_input_name={asset_key.path[-1]: asset_key for asset_key in upstream_assets}
109
- if upstream_assets
110
- else {},
115
+ keys_by_input_name=(
116
+ {asset_key.path[-1]: asset_key for asset_key in upstream_assets}
117
+ if upstream_assets
118
+ else {}
119
+ ),
111
120
  keys_by_output_name=outputs,
112
121
  internal_asset_deps=internal_deps,
113
122
  group_name=group_name,
114
123
  key_prefix=asset_key_prefix,
115
124
  can_subset=False,
116
- metadata_by_output_name={
117
- table: {"table_schema": MetadataValue.table_schema(schema_by_table_name[table])}
118
- for table in tables
119
- }
120
- if schema_by_table_name
121
- else None,
122
- freshness_policies_by_output_name={output: freshness_policy for output in outputs}
123
- if freshness_policy
124
- else None,
125
- auto_materialize_policies_by_output_name={
126
- output: auto_materialize_policy for output in outputs
127
- }
128
- if auto_materialize_policy
129
- else None,
125
+ metadata_by_output_name=(
126
+ {
127
+ table: {"table_schema": MetadataValue.table_schema(schema_by_table_name[table])}
128
+ for table in tables
129
+ }
130
+ if schema_by_table_name
131
+ else None
132
+ ),
133
+ freshness_policies_by_output_name=(
134
+ {output: freshness_policy for output in outputs} if freshness_policy else None
135
+ ),
136
+ auto_materialize_policies_by_output_name=(
137
+ {output: auto_materialize_policy for output in outputs}
138
+ if auto_materialize_policy
139
+ else None
140
+ ),
130
141
  extra_metadata={
131
142
  "connection_id": connection_id,
132
143
  "group_name": group_name,
@@ -154,16 +165,20 @@ def _build_airbyte_assets_from_metadata(
154
165
  outs={
155
166
  k: AssetOut(
156
167
  key=v,
157
- metadata={
158
- k: cast(TableSchemaMetadataValue, v)
159
- for k, v in assets_defn_meta.metadata_by_output_name.get(k, {}).items()
160
- }
161
- if assets_defn_meta.metadata_by_output_name
162
- else None,
168
+ metadata=(
169
+ {
170
+ k: cast(TableSchemaMetadataValue, v)
171
+ for k, v in assets_defn_meta.metadata_by_output_name.get(k, {}).items()
172
+ }
173
+ if assets_defn_meta.metadata_by_output_name
174
+ else None
175
+ ),
163
176
  io_manager_key=io_manager_key,
164
- freshness_policy=assets_defn_meta.freshness_policies_by_output_name.get(k)
165
- if assets_defn_meta.freshness_policies_by_output_name
166
- else None,
177
+ freshness_policy=(
178
+ assets_defn_meta.freshness_policies_by_output_name.get(k)
179
+ if assets_defn_meta.freshness_policies_by_output_name
180
+ else None
181
+ ),
167
182
  dagster_type=Nothing,
168
183
  )
169
184
  for k, v in (assets_defn_meta.keys_by_output_name or {}).items()
@@ -184,7 +199,7 @@ def _build_airbyte_assets_from_metadata(
184
199
  if table_name in destination_tables:
185
200
  yield Output(
186
201
  value=None,
187
- output_name=table_name,
202
+ output_name=_table_to_output_name_fn(table_name),
188
203
  metadata=materialization.metadata,
189
204
  )
190
205
  # Also materialize any normalization tables affiliated with this destination
@@ -193,7 +208,7 @@ def _build_airbyte_assets_from_metadata(
193
208
  for dependent_table in normalization_tables.get(table_name, set()):
194
209
  yield Output(
195
210
  value=None,
196
- output_name=dependent_table,
211
+ output_name=_table_to_output_name_fn(dependent_table),
197
212
  )
198
213
  else:
199
214
  yield materialization
@@ -246,9 +261,11 @@ def build_airbyte_assets(
246
261
  outputs = {
247
262
  table: AssetOut(
248
263
  key=AssetKey([*asset_key_prefix, table]),
249
- metadata={"table_schema": MetadataValue.table_schema(schema_by_table_name[table])}
250
- if schema_by_table_name
251
- else None,
264
+ metadata=(
265
+ {"table_schema": MetadataValue.table_schema(schema_by_table_name[table])}
266
+ if schema_by_table_name
267
+ else None
268
+ ),
252
269
  freshness_policy=freshness_policy,
253
270
  )
254
271
  for table in tables
@@ -288,13 +305,13 @@ def build_airbyte_assets(
288
305
  for table_name in destination_tables:
289
306
  yield Output(
290
307
  value=None,
291
- output_name=table_name,
308
+ output_name=_table_to_output_name_fn(table_name),
292
309
  )
293
310
  if normalization_tables:
294
311
  for dependent_table in normalization_tables.get(table_name, set()):
295
312
  yield Output(
296
313
  value=None,
297
- output_name=dependent_table,
314
+ output_name=_table_to_output_name_fn(dependent_table),
298
315
  )
299
316
  else:
300
317
  for materialization in generate_materializations(ab_output, asset_key_prefix):
@@ -302,7 +319,7 @@ def build_airbyte_assets(
302
319
  if table_name in destination_tables:
303
320
  yield Output(
304
321
  value=None,
305
- output_name=table_name,
322
+ output_name=_table_to_output_name_fn(table_name),
306
323
  metadata=materialization.metadata,
307
324
  )
308
325
  # Also materialize any normalization tables affiliated with this destination
@@ -311,7 +328,7 @@ def build_airbyte_assets(
311
328
  for dependent_table in normalization_tables.get(table_name, set()):
312
329
  yield Output(
313
330
  value=None,
314
- output_name=dependent_table,
331
+ output_name=_table_to_output_name_fn(dependent_table),
315
332
  )
316
333
  else:
317
334
  yield materialization
@@ -330,8 +347,7 @@ def _get_schema_types(schema: Mapping[str, Any]) -> Sequence[str]:
330
347
 
331
348
 
332
349
  def _get_sub_schemas(schema: Mapping[str, Any]) -> Sequence[Mapping[str, Any]]:
333
- """Returns a list of sub-schema definitions for a given schema. This is used to handle union types.
334
- """
350
+ """Returns a list of sub-schema definitions for a given schema. This is used to handle union types."""
335
351
  return schema.get("anyOf") or schema.get("oneOf") or [schema]
336
352
 
337
353
 
@@ -516,9 +532,9 @@ class AirbyteCoreCacheableAssetsDefinition(CacheableAssetsDefinition):
516
532
  self._connection_to_group_fn = connection_to_group_fn
517
533
  self._connection_to_io_manager_key_fn = connection_to_io_manager_key_fn
518
534
  self._connection_filter = connection_filter
519
- self._connection_to_asset_key_fn: Callable[
520
- [AirbyteConnectionMetadata, str], AssetKey
521
- ] = connection_to_asset_key_fn or (lambda _, table: AssetKey(path=[table]))
535
+ self._connection_to_asset_key_fn: Callable[[AirbyteConnectionMetadata, str], AssetKey] = (
536
+ connection_to_asset_key_fn or (lambda _, table: AssetKey(path=[table]))
537
+ )
522
538
  self._connection_to_freshness_policy_fn = connection_to_freshness_policy_fn or (
523
539
  lambda _: None
524
540
  )
@@ -555,12 +571,16 @@ class AirbyteCoreCacheableAssetsDefinition(CacheableAssetsDefinition):
555
571
  for table, metadata in stream_table_metadata.items()
556
572
  },
557
573
  asset_key_prefix=self._key_prefix,
558
- group_name=self._connection_to_group_fn(connection.name)
559
- if self._connection_to_group_fn
560
- else None,
561
- io_manager_key=self._connection_to_io_manager_key_fn(connection.name)
562
- if self._connection_to_io_manager_key_fn
563
- else None,
574
+ group_name=(
575
+ self._connection_to_group_fn(connection.name)
576
+ if self._connection_to_group_fn
577
+ else None
578
+ ),
579
+ io_manager_key=(
580
+ self._connection_to_io_manager_key_fn(connection.name)
581
+ if self._connection_to_io_manager_key_fn
582
+ else None
583
+ ),
564
584
  schema_by_table_name=schema_by_table_name,
565
585
  table_to_asset_key_fn=table_to_asset_key,
566
586
  freshness_policy=self._connection_to_freshness_policy_fn(connection),
@@ -125,9 +125,11 @@ def conn_dict(conn: Optional[AirbyteConnection]) -> Mapping[str, Any]:
125
125
  "destination": conn.destination.name if conn.destination else "Unknown",
126
126
  "normalize data": conn.normalize_data,
127
127
  "streams": {k: v.to_json() for k, v in conn.stream_config.items()},
128
- "destination namespace": conn.destination_namespace.name
129
- if isinstance(conn.destination_namespace, AirbyteDestinationNamespace)
130
- else conn.destination_namespace,
128
+ "destination namespace": (
129
+ conn.destination_namespace.name
130
+ if isinstance(conn.destination_namespace, AirbyteDestinationNamespace)
131
+ else conn.destination_namespace
132
+ ),
131
133
  "prefix": conn.prefix,
132
134
  }
133
135
 
@@ -330,9 +330,11 @@ class InitializedAirbyteConnection:
330
330
  destination=dest,
331
331
  stream_config=streams,
332
332
  normalize_data=len(api_dict["operationIds"]) > 0,
333
- destination_namespace=api_dict["namespaceFormat"]
334
- if api_dict["namespaceDefinition"] == "customformat"
335
- else AirbyteDestinationNamespace(api_dict["namespaceDefinition"]),
333
+ destination_namespace=(
334
+ api_dict["namespaceFormat"]
335
+ if api_dict["namespaceDefinition"] == "customformat"
336
+ else AirbyteDestinationNamespace(api_dict["namespaceDefinition"])
337
+ ),
336
338
  prefix=api_dict["prefix"] if api_dict.get("prefix") else None,
337
339
  ),
338
340
  api_dict["connectionId"],
@@ -438,9 +438,11 @@ class AirbyteResource(BaseAirbyteResource):
438
438
  headers=headers,
439
439
  json=data,
440
440
  timeout=self.request_timeout,
441
- auth=(self.username, self.password)
442
- if self.username and self.password
443
- else None,
441
+ auth=(
442
+ (self.username, self.password)
443
+ if self.username and self.password
444
+ else None
445
+ ),
444
446
  ),
445
447
  self.request_additional_params,
446
448
  ),
@@ -9,8 +9,7 @@ class AirbyteTableMetadata:
9
9
  schema: TableSchema,
10
10
  normalization_tables: Optional[Mapping[str, "AirbyteTableMetadata"]] = None,
11
11
  ):
12
- """Contains metadata about an Airbyte table, including its schema and any created normalization tables.
13
- """
12
+ """Contains metadata about an Airbyte table, including its schema and any created normalization tables."""
14
13
  self.schema = schema
15
14
  self.normalization_tables = normalization_tables or dict()
16
15
 
@@ -52,9 +52,9 @@ def generate_materializations(
52
52
  # all the streams that are set to be sync'd by this connection
53
53
  all_stream_props = {
54
54
  prefix
55
- + stream["stream"]["name"]: stream.get("stream", {})
56
- .get("jsonSchema", {})
57
- .get("properties", {})
55
+ + stream["stream"]["name"]: (
56
+ stream.get("stream", {}).get("jsonSchema", {}).get("properties", {})
57
+ )
58
58
  for stream in output.connection_details.get("syncCatalog", {}).get("streams", [])
59
59
  if stream.get("config", {}).get("selected")
60
60
  }
@@ -0,0 +1 @@
1
+ __version__ = "0.20.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dagster-airbyte
3
- Version: 0.20.4
3
+ Version: 0.20.6
4
4
  Summary: Package for integrating Airbyte with Dagster.
5
5
  Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-airbyte
6
6
  Author: Elementl
@@ -0,0 +1,8 @@
1
+ dagster==1.4.6
2
+ requests
3
+
4
+ [managed]
5
+ dagster-managed-elements==0.20.6
6
+
7
+ [test]
8
+ requests-mock
@@ -35,7 +35,7 @@ setup(
35
35
  ],
36
36
  packages=find_packages(exclude=["dagster_airbyte_tests*"]),
37
37
  install_requires=[
38
- "dagster==1.4.4",
38
+ "dagster==1.4.6",
39
39
  "requests",
40
40
  ],
41
41
  zip_safe=False,
@@ -49,7 +49,7 @@ setup(
49
49
  "requests-mock",
50
50
  ],
51
51
  "managed": [
52
- "dagster-managed-elements==0.20.4",
52
+ "dagster-managed-elements==0.20.6",
53
53
  ],
54
54
  },
55
55
  )
@@ -1 +0,0 @@
1
- __version__ = "0.20.4"
@@ -1,8 +0,0 @@
1
- dagster==1.4.4
2
- requests
3
-
4
- [managed]
5
- dagster-managed-elements==0.20.4
6
-
7
- [test]
8
- requests-mock