SQLExecX 2.2.0__tar.gz → 2.2.2__tar.gz

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.
Files changed (28) hide show
  1. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/PKG-INFO +1 -1
  2. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/SQLExecX.egg-info/PKG-INFO +1 -1
  3. SQLExecX-2.2.2/SQLExecX.egg-info/requires.txt +1 -0
  4. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/setup.py +2 -2
  5. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/exec.py +26 -19
  6. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/table_exec.py +3 -2
  7. SQLExecX-2.2.0/SQLExecX.egg-info/requires.txt +0 -1
  8. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/LICENSE +0 -0
  9. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/README.rst +0 -0
  10. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/SQLExecX.egg-info/SOURCES.txt +0 -0
  11. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/SQLExecX.egg-info/dependency_links.txt +0 -0
  12. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/SQLExecX.egg-info/not-zip-safe +0 -0
  13. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/SQLExecX.egg-info/top_level.txt +0 -0
  14. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/setup.cfg +0 -0
  15. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/__init__.py +0 -0
  16. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/constant.py +0 -0
  17. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/dialect.py +0 -0
  18. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/loader.py +0 -0
  19. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/log_support.py +0 -0
  20. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/page_exec.py +0 -0
  21. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/sql_exec.py +0 -0
  22. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/sql_support.py +0 -0
  23. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/table_limit_exec.py +0 -0
  24. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/table_order_by.py +0 -0
  25. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/table_page_exec.py +0 -0
  26. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/table_support.py +0 -0
  27. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/sqlexecx/utils.py +0 -0
  28. {SQLExecX-2.2.0 → SQLExecX-2.2.2}/test/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SQLExecX
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.
5
5
  Home-page: https://gitee.com/summry/sqlexecx
6
6
  Author: summy
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: SQLExecX
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.
5
5
  Home-page: https://gitee.com/summry/sqlexecx
6
6
  Author: summy
@@ -0,0 +1 @@
1
+ sqlexecutorx>=1.8.7
@@ -17,9 +17,9 @@ setup(
17
17
  description="A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.",
18
18
  long_description=long_description,
19
19
  long_description_content_type='text/markdown',
20
- version='2.2.0',
20
+ version='2.2.2',
21
21
  install_requires=[
22
- 'sqlexecutorx>=1.8.6',
22
+ 'sqlexecutorx>=1.8.7',
23
23
  ],
24
24
  url='https://gitee.com/summry/sqlexecx',
25
25
  author='summy',
@@ -296,8 +296,11 @@ def do_execute(sql: str, *args) -> int:
296
296
  >>> db.do_execute(sql, '张三', 20)
297
297
  1
298
298
  """
299
- sql = Dialect.before_execute(sql)
300
- return _execute(sql, *args)
299
+ # 判断*args是否为空,如果为空,则不传递*args给_execute函数
300
+ if args:
301
+ sql = Dialect.before_execute(sql)
302
+ return _execute(sql, *args)
303
+ return _execute(sql)
301
304
 
302
305
 
303
306
  def do_save_sql(sql: str, *args) -> Any:
@@ -340,9 +343,10 @@ def do_save_sql_select_key(select_key: str, sql: str, *args) -> Any:
340
343
  >>> db.do_save_sql_select_key(select_key, sql, '张三', 20)
341
344
  3
342
345
  """
343
-
344
- sql = Dialect.before_execute(sql)
345
- return _save(select_key, sql, *args)
346
+ if args:
347
+ sql = Dialect.before_execute(sql)
348
+ return _save(select_key, sql, *args)
349
+ return _save(select_key, sql)
346
350
 
347
351
 
348
352
  def do_get(sql: str, *args) -> Any:
@@ -375,9 +379,10 @@ def do_select(sql: str, *args) -> List[Tuple[Any, ...]]:
375
379
  >>> db.do_select(sql, '张三', 20)
376
380
  [(3, '张三', 20)]
377
381
  """
378
-
379
- sql = Dialect.before_execute(sql)
380
- return _select(sql, *args)
382
+ if args:
383
+ sql = Dialect.before_execute(sql)
384
+ return _select(sql, *args)
385
+ return _select(sql)
381
386
 
382
387
 
383
388
  def do_select_one(sql: str, *args) -> Tuple[Any, ...]:
@@ -392,10 +397,8 @@ def do_select_one(sql: str, *args) -> Tuple[Any, ...]:
392
397
  (3, '张三', 20)
393
398
  """
394
399
 
395
- print('do_select_one 1: ========',sql, args)
396
400
  sql, args = sql_support.limit_sql_args(sql, LIMIT_1, *args)
397
401
  sql = Dialect.before_execute(sql)
398
- print('do_select_one: ========',sql, args)
399
402
  return _select_one(sql, *args)
400
403
 
401
404
 
@@ -410,9 +413,10 @@ def do_query(sql: str, *args) -> List[dict[str, Any]]:
410
413
  >>> db.do_query(sql, '张三', 20)
411
414
  [{'id': 3, 'name': '张三', 'age': 20}]
412
415
  """
413
-
414
- sql = Dialect.before_execute(sql)
415
- return _query(sql, *args)
416
+ if args:
417
+ sql = Dialect.before_execute(sql)
418
+ return _query(sql, *args)
419
+ return _query(sql)
416
420
 
417
421
 
418
422
  def do_query_one(sql: str, *args) -> dict[str, Any]:
@@ -477,9 +481,10 @@ def do_ravel_list(sql: str, *args, position: int = 0) -> List:
477
481
  >>> db.do_ravel_list(sql, 20)
478
482
  ['张三', '李四', '王五']
479
483
  """
480
-
481
- sql = Dialect.before_execute(sql)
482
- return _ravel_list(sql, *args, position=position)
484
+ if args:
485
+ sql = Dialect.before_execute(sql)
486
+ return _ravel_list(sql, *args, position=position)
487
+ return _ravel_list(sql, position=position)
483
488
 
484
489
 
485
490
  def select_page(sql: str, page_num=1, page_size=10, *args, **kwargs) -> List[Tuple]:
@@ -557,7 +562,7 @@ def do_query_page(sql: str, page_num=1, page_size=10, *args) -> List[dict]:
557
562
 
558
563
  def batch_execute(sql: str, *args) -> int:
559
564
  """
560
- Batch execute
565
+ Execute SQL with batch data
561
566
 
562
567
  :param sql: SQL to execute
563
568
  :param args: All number must have same size.
@@ -647,8 +652,10 @@ def do_load(sql: str, *args) -> Loader:
647
652
  >>> db.do_load(sql, '张三', 20)
648
653
  Lodder()
649
654
  """
650
- sql = Dialect.before_execute(sql)
651
- return Loader(*_do_select(sql, *args))
655
+ if args:
656
+ sql = Dialect.before_execute(sql)
657
+ return Loader(*_do_select(sql, *args))
658
+ return Loader(*_do_select(sql))
652
659
 
653
660
 
654
661
  def insert_from_df(df, table_name: str, columns: Collection[str] = None) -> int:
@@ -721,7 +721,7 @@ class Table:
721
721
  (3, '张三', 20)
722
722
  """
723
723
  sql = get_table_select_sql(self.table, None, None, 0, *columns)
724
- return self.exec.select_first(sql)
724
+ return self.exec.do_select_first(sql)
725
725
 
726
726
  def query(self, *columns) -> List[dict]:
727
727
  """
@@ -760,7 +760,7 @@ class Table:
760
760
  {'id': 3, 'name': '张三', 'age': 20}
761
761
  """
762
762
  sql = get_table_select_sql(self.table, None, None, 0, *columns)
763
- return self.exec.query_first(sql)
763
+ return self.exec.do_query_first(sql)
764
764
 
765
765
  def ravel_list(self, column: str) -> List:
766
766
  """
@@ -801,6 +801,7 @@ class Table:
801
801
  20
802
802
  """
803
803
  return self.exec.insert_from_df(df, self.table, columns)
804
+
804
805
  def insert_from_pl(self, df, columns: Tuple[str] = None):
805
806
  """
806
807
  从polars DataFrame插入数据到表中并返回影响的行数。
@@ -1 +0,0 @@
1
- sqlexecutorx>=1.8.6
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes