mtsql 1.12.1__py3-none-any.whl → 1.12.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.
- mt/sql/base.py +15 -4
- mt/sql/redshift/dialect.py +2 -2
- mt/sql/version.py +1 -1
- {mtsql-1.12.1.dist-info → mtsql-1.12.3.dist-info}/METADATA +3 -2
- {mtsql-1.12.1.dist-info → mtsql-1.12.3.dist-info}/RECORD +8 -8
- {mtsql-1.12.1.dist-info → mtsql-1.12.3.dist-info}/WHEEL +1 -1
- {mtsql-1.12.1.dist-info → mtsql-1.12.3.dist-info/licenses}/LICENSE +0 -0
- {mtsql-1.12.1.dist-info → mtsql-1.12.3.dist-info}/top_level.txt +0 -0
mt/sql/base.py
CHANGED
|
@@ -365,7 +365,10 @@ def table_exists(
|
|
|
365
365
|
|
|
366
366
|
|
|
367
367
|
def create_temp_id_table(
|
|
368
|
-
l_ids: list,
|
|
368
|
+
l_ids: list,
|
|
369
|
+
conn: sa.engine.Connection,
|
|
370
|
+
int_type="int",
|
|
371
|
+
chunksize: int = 2000000,
|
|
369
372
|
) -> str:
|
|
370
373
|
"""Creates a temporary table to containing a list of ids.
|
|
371
374
|
|
|
@@ -377,6 +380,8 @@ def create_temp_id_table(
|
|
|
377
380
|
a connection that has been opened
|
|
378
381
|
int_type : str
|
|
379
382
|
an SQL string representing the int type
|
|
383
|
+
chunksize : int
|
|
384
|
+
maximum number of ids to be inserted in each INSERT statement
|
|
380
385
|
|
|
381
386
|
Returns
|
|
382
387
|
-------
|
|
@@ -389,9 +394,15 @@ def create_temp_id_table(
|
|
|
389
394
|
query_str = f"CREATE TEMP TABLE {table_name}(id {int_type});"
|
|
390
395
|
conn.execute(sa.text(query_str))
|
|
391
396
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
397
|
+
while True:
|
|
398
|
+
l_ids2 = l_ids[:chunksize]
|
|
399
|
+
if len(l_ids2) == 0:
|
|
400
|
+
break
|
|
401
|
+
|
|
402
|
+
values = ",".join((f"({id})" for id in l_ids2))
|
|
403
|
+
query_str = f"INSERT INTO {table_name}(id) VALUES {values};"
|
|
404
|
+
conn.execute(sa.text(query_str))
|
|
405
|
+
l_ids = l_ids[chunksize:]
|
|
395
406
|
|
|
396
407
|
return table_name
|
|
397
408
|
|
mt/sql/redshift/dialect.py
CHANGED
|
@@ -749,7 +749,7 @@ class RedshiftDDLCompiler(PGDDLCompiler):
|
|
|
749
749
|
|
|
750
750
|
def post_create_table(self, table):
|
|
751
751
|
kwargs = ["diststyle", "distkey", "sortkey", "interleaved_sortkey"]
|
|
752
|
-
info = table.dialect_options["
|
|
752
|
+
info = table.dialect_options["mtsql_redshift"]
|
|
753
753
|
info = {key: info.get(key) for key in kwargs}
|
|
754
754
|
return get_table_attributes(self.preparer, **info)
|
|
755
755
|
|
|
@@ -776,7 +776,7 @@ class RedshiftDDLCompiler(PGDDLCompiler):
|
|
|
776
776
|
def _fetch_redshift_column_attributes(self, column):
|
|
777
777
|
text = ""
|
|
778
778
|
if sa_version >= Version("1.3.0"):
|
|
779
|
-
info = column.dialect_options["
|
|
779
|
+
info = column.dialect_options["mtsql_redshift"]
|
|
780
780
|
else:
|
|
781
781
|
if not hasattr(column, "info"):
|
|
782
782
|
return text
|
mt/sql/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mtsql
|
|
3
|
-
Version: 1.12.
|
|
3
|
+
Version: 1.12.3
|
|
4
4
|
Summary: Extra Python modules to deal with the interaction between pandas dataframes and remote SQL servers, for Minh-Tri Pham
|
|
5
5
|
Home-page: https://github.com/inteplus/mtsql
|
|
6
6
|
Author: ['Minh-Tri Pham']
|
|
@@ -16,6 +16,7 @@ Requires-Dist: mtbase>=4.31.5
|
|
|
16
16
|
Requires-Dist: mtpandas>=1.16.8
|
|
17
17
|
Dynamic: author
|
|
18
18
|
Dynamic: home-page
|
|
19
|
+
Dynamic: license-file
|
|
19
20
|
Dynamic: project-url
|
|
20
21
|
Dynamic: requires-dist
|
|
21
22
|
Dynamic: summary
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
mt/sql/__init__.py,sha256=b7zO50apZxt9Hg2eOkJhRLrXgACR8eS5b-Rphdn5qNQ,44
|
|
2
|
-
mt/sql/base.py,sha256=
|
|
2
|
+
mt/sql/base.py,sha256=cFs7jvF3eYK1isXenLBiT_WHR2PaQIt0mbB-LicqAdA,12242
|
|
3
3
|
mt/sql/mysql.py,sha256=n2ENDctdUqZuSaDAcrqZYtPtawq3Wx4dOPCRsCB5Q4w,4894
|
|
4
4
|
mt/sql/psql.py,sha256=AmXdDVRbvzK7hWK8kysrdiXkAUwSdWmh_OqlWdoNOig,66578
|
|
5
5
|
mt/sql/sqlite.py,sha256=T2ak_hhNi_zRfpg_gp8JhNHn7D2kl4i-Ey6-9ANMtz0,8678
|
|
6
|
-
mt/sql/version.py,sha256
|
|
6
|
+
mt/sql/version.py,sha256=Bew82KJDumKg1lsWoiZNeUvcEjPwKWihwAby1TBlNmE,207
|
|
7
7
|
mt/sql/redshift/__init__.py,sha256=S-eRxJWcrvncF7LZXuulCdPV-UERu9eiw6uyDb5aGsM,443
|
|
8
8
|
mt/sql/redshift/commands.py,sha256=aAxCsp0Nl-RoWAhdTjzuE32Os_H3e_MdNOj12mt47qs,40187
|
|
9
9
|
mt/sql/redshift/ddl.py,sha256=eUcZj9oIajiE1wKKBAP-V64gYJ7cVnSAt8dLFfluOJA,9777
|
|
10
|
-
mt/sql/redshift/dialect.py,sha256=
|
|
10
|
+
mt/sql/redshift/dialect.py,sha256=g3ie_BiOFoEC7vOcykbfNwBWKDtPzSf4XXpF6glAgik,53452
|
|
11
11
|
mt/sql/redshift/main.py,sha256=6dwnwNJ1F0_V9o2oqrSOkyN_pAMrgE01CCoqAjoyOME,17116
|
|
12
12
|
mt/sql/redshift/redshift-ca-bundle.crt,sha256=532qYkOpQOstFE0mdXE1GVtL3v00XDKgZNTr6gK5-KE,8621
|
|
13
|
-
mtsql-1.12.
|
|
14
|
-
mtsql-1.12.
|
|
15
|
-
mtsql-1.12.
|
|
16
|
-
mtsql-1.12.
|
|
17
|
-
mtsql-1.12.
|
|
13
|
+
mtsql-1.12.3.dist-info/licenses/LICENSE,sha256=PojkRlQzTT5Eg6Nj03XoIVEefN3u8iiIFf1p4rqe_t4,1070
|
|
14
|
+
mtsql-1.12.3.dist-info/METADATA,sha256=2deT-voUbvfDEBgQM1Ai-7oErLAcgGxygxxLUK1kdjU,737
|
|
15
|
+
mtsql-1.12.3.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
16
|
+
mtsql-1.12.3.dist-info/top_level.txt,sha256=WcqGFu9cV7iMZg09iam8eNxUvGpLSKKF2Iubf6SJVOo,3
|
|
17
|
+
mtsql-1.12.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|