Skip to content

Commit

Permalink
[新增]readme增加trino
Browse files Browse the repository at this point in the history
  • Loading branch information
longfengpili committed Oct 25, 2023
1 parent 1f670b0 commit 5b6b772
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)`
Expand Down
4 changes: 2 additions & 2 deletions pydbapi/db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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 !')
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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:
Expand Down Expand Up @@ -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}',
Expand Down

0 comments on commit 5b6b772

Please sign in to comment.