Skip to content

Commit

Permalink
change the handling of autocommit flag to support sqlite3 connections (
Browse files Browse the repository at this point in the history
  • Loading branch information
rvianello authored and greglandrum committed Jan 5, 2024
1 parent ccb59a6 commit 29aa66b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rdkit/Dbase/DbUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,16 @@ def _AddDataToDb(dBase, table, user, password, colDefs, colTypes, data, nullMark
block.append(tuple(entries))
if len(block) >= blockSize:
nDone += _insertBlock(cn, sqlStr, block)
if not hasattr(cn, 'autocommit') or not cn.autocommit:
# note: in Python 3.12 `cn.autocommit != True`
# is different from `not cn.autocommit` (GH #7009)
if not hasattr(cn, 'autocommit') or cn.autocommit != True:
cn.commit()
block = []
if len(block):
nDone += _insertBlock(cn, sqlStr, block)
if not hasattr(cn, 'autocommit') or not cn.autocommit:
# note: in Python 3.12 `cn.autocommit != True`
# is different from `not cn.autocommit` (GH #7009)
if not hasattr(cn, 'autocommit') or cn.autocommit != True:
cn.commit()


Expand Down

0 comments on commit 29aa66b

Please sign in to comment.