ingestr 0.10.0rc0__py3-none-any.whl → 0.10.0rc1__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
@@ -112,6 +112,12 @@ class SchemaNaming(str, Enum):
112
112
  direct = "direct"
113
113
 
114
114
 
115
+ class SqlReflectionLevel(str, Enum):
116
+ minimal = "minimal"
117
+ full = "full"
118
+ full_with_precision = "full_with_precision"
119
+
120
+
115
121
  @app.command()
116
122
  def ingest(
117
123
  source_uri: Annotated[
@@ -259,6 +265,20 @@ def ingest(
259
265
  envvar="EXTRACT_PARALLELISM",
260
266
  ),
261
267
  ] = 5, # type: ignore
268
+ sql_reflection_level: Annotated[
269
+ SqlReflectionLevel,
270
+ typer.Option(
271
+ help="The reflection level to use when reflecting the table schema from the source",
272
+ envvar="SQL_REFLECTION_LEVEL",
273
+ ),
274
+ ] = SqlReflectionLevel.full, # type: ignore
275
+ sql_limit: Annotated[
276
+ Optional[int],
277
+ typer.Option(
278
+ help="The limit to use when fetching data from the source",
279
+ envvar="SQL_LIMIT",
280
+ ),
281
+ ] = None, # type: ignore
262
282
  ):
263
283
  import hashlib
264
284
  import tempfile
@@ -447,6 +467,8 @@ def ingest(
447
467
  interval_end=interval_end,
448
468
  sql_backend=sql_backend.value,
449
469
  page_size=page_size,
470
+ sql_reflection_level=sql_reflection_level.value,
471
+ sql_limit=sql_limit,
450
472
  )
451
473
 
452
474
  if original_incremental_strategy == IncrementalStrategy.delete_insert:
@@ -494,7 +516,6 @@ def ingest(
494
516
  elapsed = end_time - start_time
495
517
  elapsedHuman = f"in {humanize.precisedelta(elapsed)}"
496
518
 
497
- # remove the pipelines_dir folder if it was created by ingestr
498
519
  if is_pipelines_dir_temp:
499
520
  import shutil
500
521
 
ingestr/src/sources.py CHANGED
@@ -67,6 +67,14 @@ class SqlSource:
67
67
  if uri.startswith("mysql://"):
68
68
  uri = uri.replace("mysql://", "mysql+pymysql://")
69
69
 
70
+ reflection_level = kwargs.get("sql_reflection_level")
71
+
72
+ query_adapter_callback = None
73
+ if kwargs.get("sql_limit"):
74
+
75
+ def query_adapter_callback(query, table):
76
+ return query.limit(kwargs.get("sql_limit"))
77
+
70
78
  table_instance = self.table_builder(
71
79
  credentials=ConnectionStringCredentials(uri),
72
80
  schema=table_fields.dataset,
@@ -74,6 +82,8 @@ class SqlSource:
74
82
  incremental=incremental,
75
83
  backend=kwargs.get("sql_backend", "sqlalchemy"),
76
84
  chunk_size=kwargs.get("page_size", None),
85
+ reflection_level=reflection_level,
86
+ query_adapter_callback=query_adapter_callback,
77
87
  )
78
88
 
79
89
  return table_instance
ingestr/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.0rc0"
1
+ __version__ = "0.10.0rc1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ingestr
3
- Version: 0.10.0rc0
3
+ Version: 0.10.0rc1
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,10 @@
1
- ingestr/main.py,sha256=O0FnyiWBjWu-Inl56EVtdHVWOggTdeEgjKbfp7zT1Kc,20100
1
+ ingestr/main.py,sha256=F38DRQ-ZjwCQaEbSWfg1cSThYMBgOnQWOd-G9rinC1s,20755
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=t_t4xK-bC1dBf7w1axcopuzIERzPHIHZ_QLiEb7BOhQ,33805
5
+ ingestr/src/sources.py,sha256=ajknMdZrRdtMASrvdUEJNO7T49mKYR6owhPm0d-h-Bo,34164
6
6
  ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
7
- ingestr/src/version.py,sha256=xTnym0lQwATiKdBCgZ51qs6XA-BvYKGOI8vHCckrPzk,26
7
+ ingestr/src/version.py,sha256=Tme0LgDiYpeJhYWEQJW_1BdVaxEwPjv-S0uEHbcUTRY,26
8
8
  ingestr/src/adjust/__init__.py,sha256=oTM7XozDcMuUiCZ0w4gWEBXuCCtMZ0iBfkKdd2pVa1E,3007
9
9
  ingestr/src/adjust/adjust_helpers.py,sha256=-tmmxy9k3wms-ZEIgxmlp2cAQ2X_O1lgjY1128bbMu4,3224
10
10
  ingestr/src/airtable/__init__.py,sha256=GHWYrjI2qhs_JihdNJysB0Ni3bzqT_MLXn_S9_Q5zRA,2775
@@ -69,8 +69,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
69
69
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
70
70
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
71
71
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
72
- ingestr-0.10.0rc0.dist-info/METADATA,sha256=cRvsEF34onQqsvTFbiaU9w3mb6digQL1iLG4BOi3HfQ,7063
73
- ingestr-0.10.0rc0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
74
- ingestr-0.10.0rc0.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
75
- ingestr-0.10.0rc0.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
76
- ingestr-0.10.0rc0.dist-info/RECORD,,
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,,