ingestr 0.10.0rc1__py3-none-any.whl → 0.10.0rc3__py3-none-any.whl

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 ingestr might be problematic. Click here for more details.

ingestr/main.py CHANGED
@@ -8,6 +8,7 @@ from rich.console import Console
8
8
  from rich.status import Status
9
9
  from typing_extensions import Annotated
10
10
 
11
+ from ingestr.src.filters import cast_set_to_list
11
12
  from ingestr.src.telemetry.event import track
12
13
 
13
14
  app = typer.Typer(
@@ -458,6 +459,9 @@ def ingest(
458
459
  if factory.source_scheme == "sqlite":
459
460
  source_table = "main." + source_table.split(".")[-1]
460
461
 
462
+ if factory.destination_scheme == "bigquery":
463
+ dlt.config["destination.bigquery.autodetect_schema"] = True
464
+
461
465
  dlt_source = source.dlt_source(
462
466
  uri=source_uri,
463
467
  table=source_table,
@@ -471,6 +475,8 @@ def ingest(
471
475
  sql_limit=sql_limit,
472
476
  )
473
477
 
478
+ dlt_source.add_map(cast_set_to_list)
479
+
474
480
  if original_incremental_strategy == IncrementalStrategy.delete_insert:
475
481
  dlt_source.incremental.primary_key = ()
476
482
 
@@ -501,9 +507,9 @@ def ingest(
501
507
  ),
502
508
  write_disposition=write_disposition, # type: ignore
503
509
  primary_key=(primary_key if primary_key and len(primary_key) > 0 else None), # type: ignore
504
- loader_file_format=loader_file_format.value
505
- if loader_file_format is not None
506
- else None, # type: ignore
510
+ loader_file_format=(
511
+ loader_file_format.value if loader_file_format is not None else None # type: ignore
512
+ ), # type: ignore
507
513
  columns=column_hints,
508
514
  )
509
515
 
ingestr/src/filters.py ADDED
@@ -0,0 +1,7 @@
1
+ def cast_set_to_list(row):
2
+ # this handles just the sqlalchemy backend for now
3
+ if isinstance(row, dict):
4
+ for key in row.keys():
5
+ if isinstance(row[key], set):
6
+ row[key] = list(row[key])
7
+ return row
ingestr/src/sources.py CHANGED
@@ -12,6 +12,8 @@ from dlt.common.time import ensure_pendulum_datetime
12
12
  from dlt.common.typing import TSecretStrValue
13
13
  from dlt.sources.credentials import ConnectionStringCredentials
14
14
  from dlt.sources.sql_database import sql_table
15
+ from sqlalchemy import types as sa
16
+ from sqlalchemy.dialects import mysql
15
17
 
16
18
  from ingestr.src.adjust import REQUIRED_CUSTOM_DIMENSIONS, adjust_source
17
19
  from ingestr.src.adjust.adjust_helpers import parse_filters
@@ -75,6 +77,11 @@ class SqlSource:
75
77
  def query_adapter_callback(query, table):
76
78
  return query.limit(kwargs.get("sql_limit"))
77
79
 
80
+ def type_adapter_callback(sql_type):
81
+ if isinstance(sql_type, mysql.SET):
82
+ return sa.JSON
83
+ return sql_type
84
+
78
85
  table_instance = self.table_builder(
79
86
  credentials=ConnectionStringCredentials(uri),
80
87
  schema=table_fields.dataset,
@@ -84,6 +91,7 @@ class SqlSource:
84
91
  chunk_size=kwargs.get("page_size", None),
85
92
  reflection_level=reflection_level,
86
93
  query_adapter_callback=query_adapter_callback,
94
+ type_adapter_callback=type_adapter_callback,
87
95
  )
88
96
 
89
97
  return table_instance
ingestr/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.0rc1"
1
+ __version__ = "0.10.0rc3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ingestr
3
- Version: 0.10.0rc1
3
+ Version: 0.10.0rc3
4
4
  Summary: ingestr is a command-line application that ingests data from various sources and stores them in any database.
5
5
  Project-URL: Homepage, https://github.com/bruin-data/ingestr
6
6
  Project-URL: Issues, https://github.com/bruin-data/ingestr/issues
@@ -1,10 +1,11 @@
1
- ingestr/main.py,sha256=F38DRQ-ZjwCQaEbSWfg1cSThYMBgOnQWOd-G9rinC1s,20755
1
+ ingestr/main.py,sha256=e_Loavjd3LDNAca4B_Ck-d1rI5QfvQoYQRicZSlV9G8,21000
2
2
  ingestr/src/.gitignore,sha256=8cX1AZTSI0TcdZFGTmS_oyBjpfCzhOEt0DdAo2dFIY8,203
3
3
  ingestr/src/destinations.py,sha256=2SfPMjtTelPmzQmc3zNs8xGcKIPuGn_hoZFIBUuhjXI,6338
4
4
  ingestr/src/factory.py,sha256=ft81B-YJgvEROkHAZjMjTIS7IYvle-uZQv45b7-Wfk0,4947
5
- ingestr/src/sources.py,sha256=ajknMdZrRdtMASrvdUEJNO7T49mKYR6owhPm0d-h-Bo,34164
5
+ ingestr/src/filters.py,sha256=mHMj8Zp3_CsVLDTT1gxrkQTAsI_hheEaTsnoLpVm6Fk,242
6
+ ingestr/src/sources.py,sha256=Kp4KN5Dt7eVGSJHPUsdbPoc-uF59zr6wXIMOc03Lo3s,34447
6
7
  ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
7
- ingestr/src/version.py,sha256=Tme0LgDiYpeJhYWEQJW_1BdVaxEwPjv-S0uEHbcUTRY,26
8
+ ingestr/src/version.py,sha256=ElqoMRDsqGwCMiLiVG7t6YPRo495Y_ow7PO763ym2QI,26
8
9
  ingestr/src/adjust/__init__.py,sha256=oTM7XozDcMuUiCZ0w4gWEBXuCCtMZ0iBfkKdd2pVa1E,3007
9
10
  ingestr/src/adjust/adjust_helpers.py,sha256=-tmmxy9k3wms-ZEIgxmlp2cAQ2X_O1lgjY1128bbMu4,3224
10
11
  ingestr/src/airtable/__init__.py,sha256=GHWYrjI2qhs_JihdNJysB0Ni3bzqT_MLXn_S9_Q5zRA,2775
@@ -69,8 +70,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
69
70
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
70
71
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
71
72
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
72
- ingestr-0.10.0rc1.dist-info/METADATA,sha256=FEWuTxIM11p3nERDqWGnj9NeaaNx4fy9bEJ4r4msuSw,7063
73
- ingestr-0.10.0rc1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
74
- ingestr-0.10.0rc1.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
75
- ingestr-0.10.0rc1.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
76
- ingestr-0.10.0rc1.dist-info/RECORD,,
73
+ ingestr-0.10.0rc3.dist-info/METADATA,sha256=qDA8J1GC-BkSgxF27QrQjaeZgpi_QhL2PmwSs8qtGJM,7063
74
+ ingestr-0.10.0rc3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
75
+ ingestr-0.10.0rc3.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
76
+ ingestr-0.10.0rc3.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
77
+ ingestr-0.10.0rc3.dist-info/RECORD,,