Skip to content

Commit

Permalink
[删除]TrinoDB事务
Browse files Browse the repository at this point in the history
  • Loading branch information
longfengpili committed Nov 16, 2022
1 parent 19bec30 commit 0ea5192
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions pydbapi/api/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @Author: longfengpili
# @Date: 2022-11-14 14:17:02
# @Last Modified by: longfengpili
# @Last Modified time: 2022-11-16 10:38:30
# @Last Modified time: 2022-11-16 11:13:46


import re
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_conn(self):
raise
conn = connect(schema=self.database, user=self.user, password=self.password,
host=self.host, port=self.port, catalog=self.catalog,
isolation_level=self.isolation_level # 如果使用事务模式,则不能(drop、select、create)混合使用
# isolation_level=self.isolation_level # 如果使用事务模式,则不能(drop、select、create)混合使用
)
if not conn:
self.get_conn()
Expand Down Expand Up @@ -178,7 +178,9 @@ def execute(self, sql, count=None, ehandling='raise', verbose=0):
try:
self._execute_step(cur, sql, ehandling=ehandling)
results = self.cur_results(cur, count)
except Exception:
except Exception as e:
sql = sql.replace('\n', '') # sql转换成一行
mytrinologger.error(f"【Error】{e}, 【error Sql】: {sql}")
conn.rollback()
break

Expand Down
2 changes: 1 addition & 1 deletion pydbapi/db/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @Author: chunyang.xu
# @Email: [email protected]
# @Date: 2020-06-02 18:46:58
# @Last Modified time: 2022-11-16 10:36:26
# @Last Modified time: 2022-11-16 11:13:04
# @github: https://github.com/longfengpili

# !/usr/bin/env python3
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @Author: chunyang.xu
# @Email: [email protected]
# @Date: 2020-06-09 16:46:54
# @Last Modified time: 2022-11-16 10:37:39
# @Last Modified time: 2022-11-16 11:18:06
# @github: https://github.com/longfengpili

# !/usr/bin/env python3
Expand All @@ -12,7 +12,7 @@
import shutil
import setuptools

VERSION = '0.0.95'
VERSION = '0.0.96'
PROJECT_NAME = 'pydbapi'

with open('README.md', 'r', encoding='utf-8') as f:
Expand Down
2 changes: 1 addition & 1 deletion tests/trino/test_trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @Author: longfengpili
# @Date: 2022-11-14 14:25:01
# @Last Modified by: longfengpili
# @Last Modified time: 2022-11-16 10:34:42
# @Last Modified time: 2022-11-16 11:14:15


import sys
Expand Down

0 comments on commit 0ea5192

Please sign in to comment.