ingestr 0.13.40__py3-none-any.whl → 0.13.41__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/src/buildinfo.py CHANGED
@@ -1 +1 @@
1
- version = "v0.13.40"
1
+ version = "v0.13.41"
ingestr/src/factory.py CHANGED
@@ -79,6 +79,7 @@ SQL_SOURCE_SCHEMES = [
79
79
  "clickhouse",
80
80
  "databricks",
81
81
  "db2",
82
+ "spanner",
82
83
  ]
83
84
 
84
85
 
ingestr/src/sources.py CHANGED
@@ -52,7 +52,10 @@ class SqlSource:
52
52
  def dlt_source(self, uri: str, table: str, **kwargs):
53
53
  table_fields = TableDefinition(dataset="custom", table="custom")
54
54
  if not table.startswith("query:"):
55
- table_fields = table_string_to_dataclass(table)
55
+ if uri.startswith("spanner://"):
56
+ table_fields = TableDefinition(dataset="", table=table)
57
+ else:
58
+ table_fields = table_string_to_dataclass(table)
56
59
 
57
60
  incremental = None
58
61
  if kwargs.get("incremental_key"):
@@ -113,6 +116,45 @@ class SqlSource:
113
116
  if uri.startswith("db2://"):
114
117
  uri = uri.replace("db2://", "db2+ibm_db://")
115
118
 
119
+ if uri.startswith("spanner://"):
120
+ parsed_uri = urlparse(uri)
121
+ query_params = parse_qs(parsed_uri.query)
122
+
123
+ project_id_param = query_params.get("project_id")
124
+ instance_id_param = query_params.get("instance_id")
125
+ database_param = query_params.get("database")
126
+
127
+ cred_path = query_params.get("credentials_path")
128
+ cred_base64 = query_params.get("credentials_base64")
129
+
130
+ if not project_id_param or not instance_id_param or not database_param:
131
+ raise ValueError(
132
+ "project_id, instance_id and database are required in the URI to get data from Google Spanner"
133
+ )
134
+
135
+ project_id = project_id_param[0]
136
+ instance_id = instance_id_param[0]
137
+ database = database_param[0]
138
+
139
+ if not cred_path and not cred_base64:
140
+ raise ValueError(
141
+ "credentials_path or credentials_base64 is required in the URI to get data from Google Sheets"
142
+ )
143
+ if cred_path:
144
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = cred_path[0]
145
+ elif cred_base64:
146
+ credentials = json.loads(
147
+ base64.b64decode(cred_base64[0]).decode("utf-8")
148
+ )
149
+ temp = tempfile.NamedTemporaryFile(
150
+ mode="w", delete=False, suffix=".json"
151
+ )
152
+ json.dump(credentials, temp)
153
+ temp.close()
154
+ os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = temp.name
155
+
156
+ uri = f"spanner+spanner:///projects/{project_id}/instances/{instance_id}/databases/{database}"
157
+
116
158
  from dlt.common.libs.sql_alchemy import (
117
159
  Engine,
118
160
  MetaData,
@@ -2325,7 +2367,9 @@ class ElasticsearchSource:
2325
2367
 
2326
2368
  index = table
2327
2369
  if not index:
2328
- raise ValueError("Table name must be provided which is the index name in elasticsearch")
2370
+ raise ValueError(
2371
+ "Table name must be provided which is the index name in elasticsearch"
2372
+ )
2329
2373
 
2330
2374
  query_params = parsed.query
2331
2375
  params = parse_qs(query_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ingestr
3
- Version: 0.13.40
3
+ Version: 0.13.41
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
@@ -72,11 +72,14 @@ Requires-Dist: google-auth==2.38.0
72
72
  Requires-Dist: google-cloud-bigquery-storage==2.24.0
73
73
  Requires-Dist: google-cloud-bigquery==3.30.0
74
74
  Requires-Dist: google-cloud-core==2.4.2
75
+ Requires-Dist: google-cloud-spanner==3.54.0
75
76
  Requires-Dist: google-cloud-storage==3.1.0
76
77
  Requires-Dist: google-crc32c==1.6.0
77
78
  Requires-Dist: google-resumable-media==2.7.2
78
79
  Requires-Dist: googleapis-common-protos==1.69.0
79
80
  Requires-Dist: greenlet==3.2.2
81
+ Requires-Dist: grpc-google-iam-v1==0.14.2
82
+ Requires-Dist: grpc-interceptor==0.15.4
80
83
  Requires-Dist: grpcio-status==1.62.3
81
84
  Requires-Dist: grpcio==1.70.0
82
85
  Requires-Dist: hdbcli==2.23.27
@@ -168,9 +171,11 @@ Requires-Dist: soupsieve==2.6
168
171
  Requires-Dist: sqlalchemy-bigquery==1.12.1
169
172
  Requires-Dist: sqlalchemy-hana==2.0.0
170
173
  Requires-Dist: sqlalchemy-redshift==0.8.14
174
+ Requires-Dist: sqlalchemy-spanner==1.11.0
171
175
  Requires-Dist: sqlalchemy2-stubs==0.0.2a38
172
176
  Requires-Dist: sqlalchemy==1.4.52
173
177
  Requires-Dist: sqlglot==26.12.1
178
+ Requires-Dist: sqlparse==0.5.3
174
179
  Requires-Dist: stripe==10.7.0
175
180
  Requires-Dist: tenacity==9.0.0
176
181
  Requires-Dist: thrift==0.16.0
@@ -2,15 +2,15 @@ ingestr/conftest.py,sha256=Q03FIJIZpLBbpj55cfCHIKEjc1FCvWJhMF2cidUJKQU,1748
2
2
  ingestr/main.py,sha256=Pe_rzwcDRKIYa7baEVUAAPOHyqQbX29RUexMl0F_S1k,25273
3
3
  ingestr/src/.gitignore,sha256=8cX1AZTSI0TcdZFGTmS_oyBjpfCzhOEt0DdAo2dFIY8,203
4
4
  ingestr/src/blob.py,sha256=onMe5ZHxPXTdcB_s2oGNdMo-XQJ3ajwOsWE9eSTGFmc,1495
5
- ingestr/src/buildinfo.py,sha256=kx4THAPAkQ2P32re7w8VrOWSESl3Fz3mnN83MSygHeE,21
5
+ ingestr/src/buildinfo.py,sha256=AK7sGUNx6CPDKJOXeMexFRun9bjpyv2c9t4DII73Pes,21
6
6
  ingestr/src/destinations.py,sha256=MctbeJUyNr0DRB0XYt2xAbEKkHZ40-nXXEOYCs4KuoE,15420
7
7
  ingestr/src/errors.py,sha256=Ufs4_DfE77_E3vnA1fOQdi6cmuLVNm7_SbFLkL1XPGk,686
8
- ingestr/src/factory.py,sha256=x-Ym3uHMgzj_svUk7Lopn3Jj-IhcQLCuDqA_eUPFLAI,5582
8
+ ingestr/src/factory.py,sha256=KJKIL9q7kU4oAVXy5o0wDwLAU0nG9y0xC8D7HzksYak,5597
9
9
  ingestr/src/filters.py,sha256=C-_TIVkF_cxZBgG-Run2Oyn0TAhJgA8IWXZ-OPY3uek,1136
10
10
  ingestr/src/loader.py,sha256=9NaWAyfkXdqAZSS-N72Iwo36Lbx4PyqIfaaH1dNdkFs,1712
11
11
  ingestr/src/partition.py,sha256=BrIP6wFJvyR7Nus_3ElnfxknUXeCipK_E_bB8kZowfc,969
12
12
  ingestr/src/resource.py,sha256=XG-sbBapFVEM7OhHQFQRTdTLlh-mHB-N4V1t8F8Tsww,543
13
- ingestr/src/sources.py,sha256=RitbAjFVnq1I7MsjbD7hrn6Akd_92P6OCEg--YHivDw,80770
13
+ ingestr/src/sources.py,sha256=SWZAa6bokLurQRPtH7rxi8K-GSVLp_p9Ig1ArGRsxCo,82635
14
14
  ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
15
15
  ingestr/src/time.py,sha256=H_Fk2J4ShXyUM-EMY7MqCLZQhlnZMZvO952bmZPc4yE,254
16
16
  ingestr/src/version.py,sha256=J_2xgZ0mKlvuHcjdKCx2nlioneLH0I47JiU_Slr_Nwc,189
@@ -128,8 +128,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
128
128
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
129
129
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
130
130
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
131
- ingestr-0.13.40.dist-info/METADATA,sha256=DV_PkyMFlK4isa37puXrTKAfFPb4oQ4_cKv-b1lojI4,13653
132
- ingestr-0.13.40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
133
- ingestr-0.13.40.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
134
- ingestr-0.13.40.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
135
- ingestr-0.13.40.dist-info/RECORD,,
131
+ ingestr-0.13.41.dist-info/METADATA,sha256=UzGBs9s0Kr6R1xji_ULG5Tuc383Klx2AIzfyZdXLBp4,13852
132
+ ingestr-0.13.41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
133
+ ingestr-0.13.41.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
134
+ ingestr-0.13.41.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
135
+ ingestr-0.13.41.dist-info/RECORD,,