ingestr 0.10.0rc3__py3-none-any.whl → 0.10.0rc5__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
@@ -280,6 +280,13 @@ def ingest(
280
280
  envvar="SQL_LIMIT",
281
281
  ),
282
282
  ] = None, # type: ignore
283
+ sql_exclude_columns: Annotated[
284
+ Optional[list[str]],
285
+ typer.Option(
286
+ help="The columns to exclude from the source table",
287
+ envvar="SQL_EXCLUDE_COLUMNS",
288
+ ),
289
+ ] = [], # type: ignore
283
290
  ):
284
291
  import hashlib
285
292
  import tempfile
@@ -348,6 +355,13 @@ def ingest(
348
355
  },
349
356
  )
350
357
 
358
+ clean_sql_exclude_columns = []
359
+ if sql_exclude_columns:
360
+ for col in sql_exclude_columns:
361
+ for possible_col in col.split(","):
362
+ clean_sql_exclude_columns.append(possible_col.strip())
363
+ sql_exclude_columns = clean_sql_exclude_columns
364
+
351
365
  dlt.config["data_writer.buffer_max_items"] = page_size
352
366
  dlt.config["data_writer.file_max_items"] = loader_file_size
353
367
  dlt.config["extract.workers"] = extract_parallelism
@@ -459,9 +473,6 @@ def ingest(
459
473
  if factory.source_scheme == "sqlite":
460
474
  source_table = "main." + source_table.split(".")[-1]
461
475
 
462
- if factory.destination_scheme == "bigquery":
463
- dlt.config["destination.bigquery.autodetect_schema"] = True
464
-
465
476
  dlt_source = source.dlt_source(
466
477
  uri=source_uri,
467
478
  table=source_table,
@@ -473,6 +484,7 @@ def ingest(
473
484
  page_size=page_size,
474
485
  sql_reflection_level=sql_reflection_level.value,
475
486
  sql_limit=sql_limit,
487
+ sql_exclude_columns=sql_exclude_columns,
476
488
  )
477
489
 
478
490
  dlt_source.add_map(cast_set_to_list)
ingestr/src/filters.py CHANGED
@@ -1,3 +1,6 @@
1
+ from dlt.common.libs.sql_alchemy import Table
2
+
3
+
1
4
  def cast_set_to_list(row):
2
5
  # this handles just the sqlalchemy backend for now
3
6
  if isinstance(row, dict):
@@ -5,3 +8,14 @@ def cast_set_to_list(row):
5
8
  if isinstance(row[key], set):
6
9
  row[key] = list(row[key])
7
10
  return row
11
+
12
+
13
+ def table_adapter_exclude_columns(cols: list[str]):
14
+ print("given cols", cols)
15
+
16
+ def excluder(table: Table):
17
+ cols_to_remove = [col for col in table._columns if col.name in cols] # type: ignore
18
+ for col in cols_to_remove:
19
+ table._columns.remove(col) # type: ignore
20
+
21
+ return excluder
ingestr/src/sources.py CHANGED
@@ -23,6 +23,7 @@ from ingestr.src.arrow import memory_mapped_arrow
23
23
  from ingestr.src.chess import source
24
24
  from ingestr.src.facebook_ads import facebook_ads_source, facebook_insights_source
25
25
  from ingestr.src.filesystem import readers
26
+ from ingestr.src.filters import table_adapter_exclude_columns
26
27
  from ingestr.src.google_sheets import google_spreadsheet
27
28
  from ingestr.src.gorgias import gorgias_source
28
29
  from ingestr.src.hubspot import hubspot
@@ -92,6 +93,9 @@ class SqlSource:
92
93
  reflection_level=reflection_level,
93
94
  query_adapter_callback=query_adapter_callback,
94
95
  type_adapter_callback=type_adapter_callback,
96
+ table_adapter_callback=table_adapter_exclude_columns(
97
+ kwargs.get("sql_exclude_columns", [])
98
+ ),
95
99
  )
96
100
 
97
101
  return table_instance
ingestr/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.0rc3"
1
+ __version__ = "0.10.0rc5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ingestr
3
- Version: 0.10.0rc3
3
+ Version: 0.10.0rc5
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,11 +1,11 @@
1
- ingestr/main.py,sha256=e_Loavjd3LDNAca4B_Ck-d1rI5QfvQoYQRicZSlV9G8,21000
1
+ ingestr/main.py,sha256=UqSuqOMJPoq0fkcrba8D5gBfFIMKPEBEh0n19PJrP1c,21439
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/filters.py,sha256=mHMj8Zp3_CsVLDTT1gxrkQTAsI_hheEaTsnoLpVm6Fk,242
6
- ingestr/src/sources.py,sha256=Kp4KN5Dt7eVGSJHPUsdbPoc-uF59zr6wXIMOc03Lo3s,34447
5
+ ingestr/src/filters.py,sha256=9ckkhNF0lGVvSbw24VKQGXdtvxDCOfnSIFjswMjIu-A,611
6
+ ingestr/src/sources.py,sha256=lvp_xAsa0EUvzEq0Txbc4gNe-JPAn_47jyHdSHKwLOQ,34644
7
7
  ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
8
- ingestr/src/version.py,sha256=ElqoMRDsqGwCMiLiVG7t6YPRo495Y_ow7PO763ym2QI,26
8
+ ingestr/src/version.py,sha256=FipU1D3j5OsHv2DjFcCBccEi2EiXUNKnXRgNJjIA7Vo,26
9
9
  ingestr/src/adjust/__init__.py,sha256=oTM7XozDcMuUiCZ0w4gWEBXuCCtMZ0iBfkKdd2pVa1E,3007
10
10
  ingestr/src/adjust/adjust_helpers.py,sha256=-tmmxy9k3wms-ZEIgxmlp2cAQ2X_O1lgjY1128bbMu4,3224
11
11
  ingestr/src/airtable/__init__.py,sha256=GHWYrjI2qhs_JihdNJysB0Ni3bzqT_MLXn_S9_Q5zRA,2775
@@ -70,8 +70,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
70
70
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
71
71
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
72
72
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
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,,
73
+ ingestr-0.10.0rc5.dist-info/METADATA,sha256=GdCvj3lzj-P3rQ0kW27B18lP_XeikycDnOSU-Hp01wQ,7063
74
+ ingestr-0.10.0rc5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
75
+ ingestr-0.10.0rc5.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
76
+ ingestr-0.10.0rc5.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
77
+ ingestr-0.10.0rc5.dist-info/RECORD,,