diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9dba0da..aa8b4fe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.9, 3.10, 3.11, 3.12] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 139643f..fb84c30 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,13 @@ db = MysqlDB(host, user, password, database, port=3306, safe_rule=True, isdoris= sql = 'select * from [table];' row, action, result = db.execute(sql) ``` ++ Trino +```python +from pydbapi.api import TrinoDB +db = TrinoDB(host, user, password, database, catalog, port=8443, safe_rule=True) +sql = 'select * from [table];' +row, action, result = db.execute(sql) +``` + Snowflake(删除) ```python from pydbapi.api import SnowflakeDB @@ -105,6 +112,14 @@ row, action, result = db.execute(sql) - `ismultiple_index`: 多重索引 - `partition`: 分区 - `verbose`: 是否打印执行进度。 + + trino + + 代码 + `db.create(tablename, columns, partition=None, verbose=0)` + + params + - `tablename`: 表名; + - `columns`: 列内容; + - `partition`: 分区 + - `verbose`: 是否打印执行进度。 + insert[【db/base.py】](https://github.com/longfengpili/pydbapi/blob/master/pydbapi/db/base.py) + 代码 `db.insert(tablename, columns, inserttype='value', values=None, chunksize=1000, fromtable=None, condition=None)` diff --git a/pydbapi/db/base.py b/pydbapi/db/base.py index 962a84e..24ebc93 100644 --- a/pydbapi/db/base.py +++ b/pydbapi/db/base.py @@ -2,7 +2,7 @@ # @Author: longfengpili # @Date: 2023-06-02 15:27:41 # @Last Modified by: longfengpili -# @Last Modified time: 2023-10-25 11:09:55 +# @Last Modified time: 2023-10-25 11:18:43 # @github: https://github.com/longfengpili @@ -196,7 +196,7 @@ def insert(self, tablename, columns, inserttype='value', values=None, chunksize= rows, action, result = self.execute(sql_for_insert, verbose=verbose) if values and rows != (vlength % chunksize or chunksize): - raise Exception(f'Insert Error !!!') + raise Exception('Insert Error !!!') rows = vlength if values else rows dblogger.info(f'【{action}】{tablename} insert {rows} rows succeed !') diff --git a/setup.py b/setup.py index bc5b431..6b8e236 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # @Author: longfengpili # @Date: 2023-06-02 15:27:41 # @Last Modified by: longfengpili -# @Last Modified time: 2023-07-27 15:43:11 +# @Last Modified time: 2023-10-25 11:13:57 # @github: https://github.com/longfengpili @@ -11,7 +11,7 @@ import shutil import setuptools -VERSION = '0.0.108' +VERSION = '0.0.109' PROJECT_NAME = 'pydbapi' with open('README.md', 'r', encoding='utf-8') as f: @@ -46,7 +46,7 @@ "License :: OSI Approved :: MIT License", ], keywords=["dbapi", "sqlite3", "redshift", 'snowflake'], - python_requires=">=3.6", + python_requires=">=3.9", project_urls={ 'Documentation': f'https://github.com/longfengpili/{PROJECT_NAME}/blob/master/README.md', 'Source': f'https://github.com/longfengpili/{PROJECT_NAME}',