Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
dealaccountdata
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ef232cd8
authored
May 13, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
将值作为元组列表传递给 execute_batch_insert 方法
1 parent
3fcdf2e8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
scene_refactor_data/db_helper.py
scene_refactor_data/scene_split_processor.py
scene_refactor_data/db_helper.py
View file @
ef232cd
...
@@ -84,6 +84,27 @@ class DBHelper:
...
@@ -84,6 +84,27 @@ class DBHelper:
self
.
logger
.
info
(
f
"更新失败: {sql}, 错误: {e}"
)
self
.
logger
.
info
(
f
"更新失败: {sql}, 错误: {e}"
)
raise
raise
def
execute_batch_insert
(
self
,
sql
,
values_list
):
"""
执行批量插入SQL(使用参数化查询)
Args:
sql: 插入SQL语句模板(使用
%
s 占位符)
values_list: 值列表,每个元素是一个元组
Returns:
bool: 执行成功返回True
"""
try
:
self
.
logger
.
debug
(
f
"执行批量插入: {sql}, 记录数: {len(values_list)}"
)
self
.
db
.
cursor
.
executemany
(
sql
,
values_list
)
self
.
db
.
con
.
commit
()
return
True
except
Exception
as
e
:
self
.
logger
.
info
(
f
"ERROR批量插入失败: {sql}, 错误: {e}"
)
self
.
db
.
con
.
rollback
()
raise
def
close
(
self
):
def
close
(
self
):
"""关闭数据库连接"""
"""关闭数据库连接"""
if
self
.
db
:
if
self
.
db
:
...
...
scene_refactor_data/scene_split_processor.py
View file @
ef232cd
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment