Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Remove unnecessary logic with latest DuckDB #1312

davidmezzetti1c2a78119ac6
diff --git a/src/python/txtai/database/duckdb.py b/src/python/txtai/database/duckdb.py
index 88cf6310..bfb0b39e 100644
--- a/src/python/txtai/database/duckdb.py
+++ b/src/python/txtai/database/duckdb.py
@@ -47,10 +47,7 @@ class DuckDB(Embedded):
return super().execute(function, *self.formatargs(args))
except SQLError as e:
# Runtime errors abort the transaction. DuckDB has no savepoints, so it can't be recovered without a rollback.
- if self.aborted():
- raise SQLError(f"{e}\n\n{DuckDB.ABORTED}") from None
-
- raise
+ raise SQLError(f"{e}\n\n{DuckDB.ABORTED}") from None
def insertdocument(self, uid, data, tags, entry):
# Delete existing document
@@ -136,20 +133,6 @@ class DuckDB(Embedded):
return connection
- def aborted(self):
- """
- Checks if the current transaction is aborted.
-
- Returns:
- True if the current transaction is aborted
- """
-
- try:
- self.connection.execute("SELECT 1")
- return False
- except duckdb.TransactionException:
- return True
-
def formatargs(self, args):
"""
DuckDB doesn't support named parameters. This method replaces named parameters with question marks