Skip to content

Commit 68c8603

Browse files
author
patched.codes[bot]
committed
Patched patchwork/common/tools/csvkit_tool.py
1 parent f971e58 commit 68c8603

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

patchwork/common/tools/csvkit_tool.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ def execute(self, files: list[str], query: str) -> str:
117117
files_to_insert = []
118118
if db_path.is_file():
119119
with sqlite3.connect(str(db_path)) as conn:
120+
cursor = conn.cursor()
120121
for file in files:
121-
res = conn.execute(
122-
f"SELECT 1 from {file.removesuffix('.csv')}",
123-
)
124-
if res.fetchone() is None:
122+
table_name = file.removesuffix('.csv')
123+
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name=?", (table_name,))
124+
res = cursor.fetchone()
125+
if res is None:
125126
files_to_insert.append(file)
126127
else:
127128
files_to_insert = files

0 commit comments

Comments
 (0)