mtsql 1.12.33__py3-none-any.whl → 1.12.34__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 CHANGED
@@ -659,7 +659,7 @@ def find_common_ids(
659
659
 
660
660
  def find_common_id_tuples(
661
661
  la_ids: tp.List[tp.List[int]],
662
- id_cols: tp.List[str],
662
+ l_idCols: tp.List[str],
663
663
  frame_name: str,
664
664
  engine: sa.engine.Engine,
665
665
  schema: tp.Optional[str] = None,
@@ -672,7 +672,7 @@ def find_common_id_tuples(
672
672
  ----------
673
673
  la_ids : list of list of int
674
674
  list of id tuples to be checked
675
- id_cols : list of str
675
+ l_idCols : list of str
676
676
  name of the id columns in the frame
677
677
  frame_name : str
678
678
  name of the frame to be checked against
@@ -680,7 +680,7 @@ def find_common_id_tuples(
680
680
  connection engine to the server
681
681
  schema : str, optional
682
682
  schema of the frame. If None, the default schema is used.
683
- id_cols : list of str
683
+ l_idCols : list of str
684
684
  name of the id column in the frame
685
685
  int_type : str
686
686
  an SQL string representing the int type of the id column
@@ -689,26 +689,30 @@ def find_common_id_tuples(
689
689
 
690
690
  Returns
691
691
  -------
692
- list of int
693
- list of common ids
692
+ list of list of int
693
+ list of cpommon id tuples
694
694
  """
695
695
 
696
696
  with conn_ctx(engine) as conn:
697
- temp_table = create_temp_id_table(l_ids, conn, int_type=int_type, logger=logger)
697
+ temp_table = create_temp_id_tuple_table(
698
+ la_ids, conn, int_type=int_type, logger=logger
699
+ )
698
700
 
699
701
  full_frame_name = frame_sql(frame_name, schema=schema)
700
702
 
701
- sql = f"""
702
- SELECT t.id FROM {temp_table} AS t
703
- INNER JOIN {full_frame_name} AS f
704
- ON t.id = f.{id_col};
705
- """
703
+ sql = "SELECT t.id1"
704
+ for i in range(1, len(l_idCols)):
705
+ sql += f", t.id{i+1}"
706
+ sql += f" FROM {temp_table} AS t INNER JOIN {full_frame_name} AS f ON "
707
+ sql += " AND ".join(
708
+ (f"t.id{i+1} = f.{l_idCols[i]}" for i in range(len(l_idCols)))
709
+ )
710
+ sql += ";"
706
711
 
707
712
  df_common = read_sql(sql, conn, index_col=None, logger=logger)
713
+ la_commonIds = df_common.to_numpy()
708
714
 
709
- l_commonIds = df_common["id"].tolist()
710
-
711
- return l_commonIds
715
+ return la_commonIds
712
716
 
713
717
 
714
718
  def find_common_str_ids(
mt/sql/version.py CHANGED
@@ -1,5 +1,5 @@
1
1
  MAJOR_VERSION = 1
2
2
  MINOR_VERSION = 12
3
- PATCH_VERSION = 33
3
+ PATCH_VERSION = 34
4
4
  version = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
5
5
  __all__ = ['MAJOR_VERSION', 'MINOR_VERSION', 'PATCH_VERSION', 'version']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtsql
3
- Version: 1.12.33
3
+ Version: 1.12.34
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
@@ -1,17 +1,17 @@
1
1
  mt/sql/__init__.py,sha256=b7zO50apZxt9Hg2eOkJhRLrXgACR8eS5b-Rphdn5qNQ,44
2
- mt/sql/base.py,sha256=HJzMlKO-SX3aLTMnOrvhrInfNi9O7WMD3tuV2yZIdJg,23863
2
+ mt/sql/base.py,sha256=14A2MOcplaG-lxw3XQTgJ-_y87UnlmNm-I_ky8BNAtU,24079
3
3
  mt/sql/mysql.py,sha256=n2ENDctdUqZuSaDAcrqZYtPtawq3Wx4dOPCRsCB5Q4w,4894
4
4
  mt/sql/psql.py,sha256=U8XEyg4rQYr5gm8KohRWrpCNJKl5WC1yxJMBkkm1k_A,68125
5
5
  mt/sql/sqlite.py,sha256=T2ak_hhNi_zRfpg_gp8JhNHn7D2kl4i-Ey6-9ANMtz0,8678
6
- mt/sql/version.py,sha256=3roEiAIfAeKb5dA-3ZmquKI_ZMs8TFD5x-PCcvQBLe4,208
6
+ mt/sql/version.py,sha256=D8EuKl4A40wQJkMyBQiik7J1LrO2sZafFCP-ODaRri4,208
7
7
  mt/sql/redshift/__init__.py,sha256=S-eRxJWcrvncF7LZXuulCdPV-UERu9eiw6uyDb5aGsM,443
8
8
  mt/sql/redshift/commands.py,sha256=xhGUBf3bL66EYdZI5HCUtOx-XqPCnXT_P-LnhPgtzrY,40193
9
9
  mt/sql/redshift/ddl.py,sha256=eUcZj9oIajiE1wKKBAP-V64gYJ7cVnSAt8dLFfluOJA,9777
10
10
  mt/sql/redshift/dialect.py,sha256=-0JjJubZZHRw0abhl6H6rKWaUE9pKtGwAuX-62T0e_c,53399
11
11
  mt/sql/redshift/main.py,sha256=H8_5sjtJ7dzWoCMXzPNjYhrMQ18eLUQ9xg-aYl5QeTc,17104
12
12
  mt/sql/redshift/redshift-ca-bundle.crt,sha256=532qYkOpQOstFE0mdXE1GVtL3v00XDKgZNTr6gK5-KE,8621
13
- mtsql-1.12.33.dist-info/licenses/LICENSE,sha256=PojkRlQzTT5Eg6Nj03XoIVEefN3u8iiIFf1p4rqe_t4,1070
14
- mtsql-1.12.33.dist-info/METADATA,sha256=MEQHkGnmBIr4lwNZrMKlCCbUNUOmprFJXE3a0xt5Slg,736
15
- mtsql-1.12.33.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
16
- mtsql-1.12.33.dist-info/top_level.txt,sha256=WcqGFu9cV7iMZg09iam8eNxUvGpLSKKF2Iubf6SJVOo,3
17
- mtsql-1.12.33.dist-info/RECORD,,
13
+ mtsql-1.12.34.dist-info/licenses/LICENSE,sha256=PojkRlQzTT5Eg6Nj03XoIVEefN3u8iiIFf1p4rqe_t4,1070
14
+ mtsql-1.12.34.dist-info/METADATA,sha256=JQ9YIrA80S3RHI0I0hPIfI7tA_qVL_6slJX0uu7nVQA,736
15
+ mtsql-1.12.34.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
16
+ mtsql-1.12.34.dist-info/top_level.txt,sha256=WcqGFu9cV7iMZg09iam8eNxUvGpLSKKF2Iubf6SJVOo,3
17
+ mtsql-1.12.34.dist-info/RECORD,,