ingestr 0.6.5__py3-none-any.whl → 0.6.6__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/factory.py CHANGED
@@ -30,6 +30,7 @@ SQL_SOURCE_SCHEMES = [
30
30
  "mssql",
31
31
  "mysql",
32
32
  "mysql+pymysql",
33
+ "mysql+mysqlconnector",
33
34
  "postgres",
34
35
  "postgresql",
35
36
  "redshift",
ingestr/src/sources.py CHANGED
@@ -12,6 +12,7 @@ from ingestr.src.mongodb import mongodb_collection
12
12
  from ingestr.src.notion import notion_databases
13
13
  from ingestr.src.shopify import shopify_source
14
14
  from ingestr.src.sql_database import sql_table
15
+ from ingestr.src.table_definition import table_string_to_dataclass
15
16
 
16
17
 
17
18
  class SqlSource:
@@ -24,9 +25,7 @@ class SqlSource:
24
25
  return False
25
26
 
26
27
  def dlt_source(self, uri: str, table: str, **kwargs):
27
- table_fields = table.split(".")
28
- if len(table_fields) != 2:
29
- raise ValueError("Table name must be in the format schema.table")
28
+ table_fields = table_string_to_dataclass(table)
30
29
 
31
30
  incremental = None
32
31
  if kwargs.get("incremental_key"):
@@ -45,8 +44,8 @@ class SqlSource:
45
44
 
46
45
  table_instance = self.table_builder(
47
46
  credentials=uri,
48
- schema=table_fields[-2],
49
- table=table_fields[-1],
47
+ schema=table_fields.dataset,
48
+ table=table_fields.table,
50
49
  incremental=incremental,
51
50
  merge_key=kwargs.get("merge_key"),
52
51
  backend=kwargs.get("sql_backend", "sqlalchemy"),
@@ -65,9 +64,7 @@ class MongoDbSource:
65
64
  return False
66
65
 
67
66
  def dlt_source(self, uri: str, table: str, **kwargs):
68
- table_fields = table.split(".")
69
- if len(table_fields) != 2:
70
- raise ValueError("Table name must be in the format schema.table")
67
+ table_fields = table_string_to_dataclass(table)
71
68
 
72
69
  incremental = None
73
70
  if kwargs.get("incremental_key"):
@@ -82,8 +79,8 @@ class MongoDbSource:
82
79
 
83
80
  table_instance = self.table_builder(
84
81
  connection_url=uri,
85
- database=table_fields[-2],
86
- collection=table_fields[-1],
82
+ database=table_fields.dataset,
83
+ collection=table_fields.table,
87
84
  parallel=True,
88
85
  incremental=incremental,
89
86
  )
@@ -293,15 +290,10 @@ class GoogleSheetsSource:
293
290
  base64.b64decode(credentials_base64[0]).decode("utf-8")
294
291
  )
295
292
 
296
- table_fields = table.split(".")
297
- if len(table_fields) != 2:
298
- raise ValueError(
299
- "Table name must be in the format <spreadsheet_id>.<sheet_name>"
300
- )
301
-
293
+ table_fields = table_string_to_dataclass(table)
302
294
  return self.table_builder(
303
295
  credentials=credentials,
304
- spreadsheet_url_or_id=table_fields[0],
305
- range_names=[table_fields[1]],
296
+ spreadsheet_url_or_id=table_fields.table,
297
+ range_names=[table_fields.dataset],
306
298
  get_named_ranges=False,
307
299
  )
@@ -13,10 +13,6 @@ class SqlSourceTest(unittest.TestCase):
13
13
  uri = "bigquery://my-project"
14
14
  source.dlt_source(uri, "onetable")
15
15
 
16
- with pytest.raises(ValueError):
17
- uri = "bigquery://my-project"
18
- source.dlt_source(uri, "onetable.with.too.many.fields")
19
-
20
16
  def test_table_instance_is_created(self):
21
17
  uri = "bigquery://my-project"
22
18
  table = "schema.table"
@@ -63,10 +59,6 @@ class MongoDbSourceTest(unittest.TestCase):
63
59
  uri = "mongodb://my-project"
64
60
  source.dlt_source(uri, "onetable")
65
61
 
66
- with pytest.raises(ValueError):
67
- uri = "mongodb://my-project"
68
- source.dlt_source(uri, "onetable.with.too.many.fields")
69
-
70
62
  def test_table_instance_is_created(self):
71
63
  uri = "mongodb://my-project"
72
64
  table = "schema.table"
@@ -0,0 +1,15 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass
5
+ class TableDefinition:
6
+ dataset: str
7
+ table: str
8
+
9
+
10
+ def table_string_to_dataclass(table: str) -> TableDefinition:
11
+ table_fields = table.split(".", 1)
12
+ if len(table_fields) != 2:
13
+ raise ValueError("Table name must be in the format <schema>.<table>")
14
+
15
+ return TableDefinition(dataset=table_fields[0], table=table_fields[1])
ingestr/src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.6.5"
1
+ __version__ = "0.6.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ingestr
3
- Version: 0.6.5
3
+ Version: 0.6.6
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
@@ -21,6 +21,7 @@ Requires-Dist: duckdb-engine==0.11.5
21
21
  Requires-Dist: duckdb==0.10.2
22
22
  Requires-Dist: google-api-python-client==2.130.0
23
23
  Requires-Dist: google-cloud-bigquery-storage==2.24.0
24
+ Requires-Dist: mysql-connector-python==9.0.0
24
25
  Requires-Dist: pendulum==3.0.0
25
26
  Requires-Dist: psycopg2-binary==2.9.9
26
27
  Requires-Dist: py-machineid==0.5.1
@@ -171,6 +172,11 @@ Join our Slack community [here](https://join.slack.com/t/bruindatacommunity/shar
171
172
  <tr>
172
173
  <td colspan="3" style='text-align:center;'><strong>Platforms</strong></td>
173
174
  </tr>
175
+ <tr>
176
+ <td>Gorgias</td>
177
+ <td>✅</td>
178
+ <td>❌</td>
179
+ </tr>
174
180
  <tr>
175
181
  <td>Google Sheets</td>
176
182
  <td>✅</td>
@@ -2,11 +2,12 @@ ingestr/main.py,sha256=PvZtqrlHO3aSFtdhIdLAhzsOLG1hP_ql24vof76SFaI,14862
2
2
  ingestr/main_test.py,sha256=MDV2Eo86W_CcxGgEkYYoBc6xIXjVMER4hMhgAdxXYMc,28464
3
3
  ingestr/src/destinations.py,sha256=2SfPMjtTelPmzQmc3zNs8xGcKIPuGn_hoZFIBUuhjXI,6338
4
4
  ingestr/src/destinations_test.py,sha256=rgEk8EpAntFbSOwXovC4prv3RA22mwq8pIO6sZ_rYzg,4212
5
- ingestr/src/factory.py,sha256=7skwetBXFIwAuKyTFfffGPgSo_PRRZ5uEnxOHUv28yQ,3517
5
+ ingestr/src/factory.py,sha256=w6xb8scWa_uG4otoMjqvqcx99hofrN2YcLzaB7QSgYo,3545
6
6
  ingestr/src/factory_test.py,sha256=X9sFkvNByWChIcyeDt1QiIPMIzGNKb7M5A_GUE0-nnI,664
7
- ingestr/src/sources.py,sha256=v0oFu-Pt_Zv06FypBb9_rHKP_iIMpkgm9MMaVpOUjPg,10313
8
- ingestr/src/sources_test.py,sha256=t94u1lYAspxzfe-DkxVtq5vw6xrLWphipvwntrwrzqg,3930
9
- ingestr/src/version.py,sha256=KDgkBrBsBSUzbLgrOZ89YsNN06fU4j5bmcuEwo6q5pg,22
7
+ ingestr/src/sources.py,sha256=sLT8CDiLz6aTekm6QZCXatZAdTyzCabqjJesnEe88GU,10061
8
+ ingestr/src/sources_test.py,sha256=wZopz4tFtFnOiCEO8pZW816Nj86pLlR5fEqfq0TtWMQ,3629
9
+ ingestr/src/table_definition.py,sha256=REbAbqdlmUMUuRh8nEQRreWjPVOQ5ZcfqGkScKdCrmk,390
10
+ ingestr/src/version.py,sha256=I3h5MyD10PkOUQEBnR6L9ja7s4WeTEg8rRjRKTCWYWQ,22
10
11
  ingestr/src/google_sheets/README.md,sha256=wFQhvmGpRA38Ba2N_WIax6duyD4c7c_pwvvprRfQDnw,5470
11
12
  ingestr/src/google_sheets/__init__.py,sha256=5qlX-6ilx5MW7klC7B_0jGSxloQSLkSESTh4nlY3Aos,6643
12
13
  ingestr/src/google_sheets/helpers/__init__.py,sha256=5hXZrZK8cMO3UOuL-s4OKOpdACdihQD0hYYlSEu-iQ8,35
@@ -40,8 +41,8 @@ ingestr/testdata/delete_insert_part2.csv,sha256=B_KUzpzbNdDY_n7wWop1mT2cz36TmayS
40
41
  ingestr/testdata/merge_expected.csv,sha256=DReHqWGnQMsf2PBv_Q2pfjsgvikYFnf1zYcQZ7ZqYN0,276
41
42
  ingestr/testdata/merge_part1.csv,sha256=Pw8Z9IDKcNU0qQHx1z6BUf4rF_-SxKGFOvymCt4OY9I,185
42
43
  ingestr/testdata/merge_part2.csv,sha256=T_GiWxA81SN63_tMOIuemcvboEFeAmbKc7xRXvL9esw,287
43
- ingestr-0.6.5.dist-info/METADATA,sha256=WmTysf7rKdSEh5XQILpzOVrF43VsoRtgxzL0XaAEoYA,5699
44
- ingestr-0.6.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
45
- ingestr-0.6.5.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
46
- ingestr-0.6.5.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
47
- ingestr-0.6.5.dist-info/RECORD,,
44
+ ingestr-0.6.6.dist-info/METADATA,sha256=o9eKbLqKlQ-TkYoaLHFLeQAjuraP9UZhM1jsCL2v7Gg,5830
45
+ ingestr-0.6.6.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
46
+ ingestr-0.6.6.dist-info/entry_points.txt,sha256=oPJy0KBnPWYjDtP1k8qwAihcTLHSZokSQvRAw_wtfJM,46
47
+ ingestr-0.6.6.dist-info/licenses/LICENSE.md,sha256=cW8wIhn8HFE-KLStDF9jHQ1O_ARWP3kTpk_-eOccL24,1075
48
+ ingestr-0.6.6.dist-info/RECORD,,