ingestr 0.2.2__py3-none-any.whl → 0.2.3__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.

@@ -1,3 +1,4 @@
1
+ import base64
1
2
  import csv
2
3
  import gzip
3
4
  import json
@@ -32,8 +33,11 @@ class BigQueryDestination:
32
33
  source_params = parse_qs(source_fields.query)
33
34
 
34
35
  cred_path = source_params.get("credentials_path")
35
- if not cred_path:
36
- raise ValueError("Credentials path is required")
36
+ credentials_base64 = source_params.get("credentials_base64")
37
+ if not cred_path and not credentials_base64:
38
+ raise ValueError(
39
+ "credentials_path or credentials_base64 is required to connect BigQuery"
40
+ )
37
41
 
38
42
  location = None
39
43
  if source_params.get("location"):
@@ -42,11 +46,19 @@ class BigQueryDestination:
42
46
  raise ValueError("Only one location is allowed")
43
47
  location = loc_params[0]
44
48
 
45
- with open(cred_path[0], "r") as f:
46
- credentials = json.load(f)
49
+ credentials = {}
50
+ if cred_path:
51
+ with open(cred_path[0], "r") as f:
52
+ credentials = json.load(f)
53
+ elif credentials_base64:
54
+ credentials = json.loads(
55
+ base64.b64decode(credentials_base64[0]).decode("utf-8")
56
+ )
47
57
 
48
58
  return dlt.destinations.bigquery(
49
- credentials=credentials, location=location, **kwargs
59
+ credentials=credentials, # type: ignore
60
+ location=location,
61
+ **kwargs,
50
62
  )
51
63
 
52
64
  def dlt_run_params(self, uri: str, table: str, **kwargs) -> dict:
ingestr/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.2"
1
+ __version__ = "0.2.3"
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ingestr
3
- Version: 0.2.2
3
+ Version: 0.2.3
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,12 +1,12 @@
1
1
  ingestr/main.py,sha256=93lOlvJmbWLabccuwvffewtF4iGdhnZNaJ1MR7J9vTY,11375
2
2
  ingestr/main_test.py,sha256=IQx2bjTnuixoY9ndgErBTaP3QE5AWvsLtv7ZPi8vJtA,19285
3
- ingestr/src/destinations.py,sha256=7O0zAUBb-1modTbAXu8onpZcsUl6TKCfKOJfydrny1M,5872
3
+ ingestr/src/destinations.py,sha256=i91DLjQtqFyQ4lJCYlCHdErH7I4zk_tMuPhgre6AOtQ,6307
4
4
  ingestr/src/destinations_test.py,sha256=rgEk8EpAntFbSOwXovC4prv3RA22mwq8pIO6sZ_rYzg,4212
5
5
  ingestr/src/factory.py,sha256=hcHjLjG-sVaO3fO0r8vrFFt0j5jcuijfdi1dHGfPkLQ,3021
6
6
  ingestr/src/factory_test.py,sha256=X9sFkvNByWChIcyeDt1QiIPMIzGNKb7M5A_GUE0-nnI,664
7
7
  ingestr/src/sources.py,sha256=HcLfpbqx2d25UhMWHhnczcpLTh_g-afDkwMCVnlsPCc,3119
8
8
  ingestr/src/sources_test.py,sha256=gqqnJIqblxDbipsX3jZWl0He7aMsob0YyewceY4Z11M,3808
9
- ingestr/src/version.py,sha256=m6kyaNpwBcP1XYcqrelX2oS3PJuOnElOcRdBa9pEb8c,22
9
+ ingestr/src/version.py,sha256=PNiDER4qM19h9zdsdfgKt2_dT4WgYK7EguJ8RU2qA_g,22
10
10
  ingestr/src/mongodb/__init__.py,sha256=MKXay_Qg9bOgXyKrqEw0YG0beOnV6FjJISv6fxjn6KE,4347
11
11
  ingestr/src/mongodb/helpers.py,sha256=QaolE_Kg-F4RgIp0f2T_rk08RdjFhzUw9vgtCCI6hkg,5599
12
12
  ingestr/src/sql_database/__init__.py,sha256=-f98oiE_WMJKdKfcdeZo114Qab1CCu8j7_s61w0np2E,2622
@@ -16,12 +16,12 @@ ingestr/src/sql_database/settings.py,sha256=PaLPayAb1QGHHcPlrZ7eJ1fonDA6-sOGh-Zi
16
16
  ingestr/src/telemetry/event.py,sha256=MpWc5tt0lSJ1pWKe9HQ11BHrcPBxSH40l4wjZi9u0tI,924
17
17
  ingestr/src/testdata/fakebqcredentials.json,sha256=scc6TUc963KAbKTLZCfcmqVzbtzDCW1_8JNRnyAXyy8,628
18
18
  ingestr/testdata/.gitignore,sha256=DFzYYOpqdTiT7S1HjCT-jffZSmEvFZge295_upAB0FY,13
19
- ingestr/testdata/test_create_replace.db,sha256=FaHNnwFq-LMCCwzN5kjgNM1XVJ-LboZEk2alSL4Bcsw,536576
20
- ingestr/testdata/test_delete_insert_with_timerange.db,sha256=Qy333urC9gs6klbJKVnS5qtGfNkQjup5hQiij2mEnXM,1585152
21
- ingestr/testdata/test_delete_insert_without_primary_key.db,sha256=BliVV6ItT-uTOAooixG0hWMXfxbUZgV-FjoajszNLsg,1847296
22
- ingestr/testdata/test_merge_with_primary_key.db,sha256=NyiDZ-MwouNVVIFea1DIdIWrsc5s6TEGuOVrWkPHPEk,1847296
23
- ingestr-0.2.2.dist-info/METADATA,sha256=UuXHTZRjngie4skudkjhxVu8oSt7oBv25rgJv_bGhCM,4551
24
- ingestr-0.2.2.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
25
- ingestr-0.2.2.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
26
- ingestr-0.2.2.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
27
- ingestr-0.2.2.dist-info/RECORD,,
19
+ ingestr/testdata/test_create_replace.db,sha256=qrl-_AR-5eKg5X0D7zpOsczdH_S6GHBrrTKBE-p0AZo,536576
20
+ ingestr/testdata/test_delete_insert_with_timerange.db,sha256=SxwNFb2x-CjQhHPJoM3--BlddM-PehIj5YP4AgVI-NM,1585152
21
+ ingestr/testdata/test_delete_insert_without_primary_key.db,sha256=MVNrVG5MlYkbHGAURu4nir3-lW0sdZHT42-5u3fuqlE,1847296
22
+ ingestr/testdata/test_merge_with_primary_key.db,sha256=aMOeXGHvIxbucgELOfm7k9nkWFaSy3UoA8PBQx5DsU8,1847296
23
+ ingestr-0.2.3.dist-info/METADATA,sha256=ugtL_RojccfQOk1m6SRbuZcnTkik8yl1m-Hj8L8zcb8,4551
24
+ ingestr-0.2.3.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
25
+ ingestr-0.2.3.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
26
+ ingestr-0.2.3.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
27
+ ingestr-0.2.3.dist-info/RECORD,,