💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Rename SQLException to SQLError, closes #232
davidmezzetti47b6b07db381
diff --git a/src/python/txtai/database/base.py b/src/python/txtai/database/base.pyindex b8d4dd60..64a784e7 100644--- a/src/python/txtai/database/base.py+++ b/src/python/txtai/database/base.py@@ -5,7 +5,7 @@ Database moduleimport loggingfrom .encoder import EncoderFactory-from .sql import SQL, SQLException, Token+from .sql import SQL, SQLError, Token# Logging configurationlogger = logging.getLogger(__name__)@@ -226,4 +226,4 @@ class Database:return function(*args)except Exception as ex:- raise SQLException(ex) from None+ raise SQLError(ex) from Nonediff --git a/src/python/txtai/database/sql/__init__.py b/src/python/txtai/database/sql/__init__.pyindex 869716e0..91c6b654 100644--- a/src/python/txtai/database/sql/__init__.py+++ b/src/python/txtai/database/sql/__init__.py@@ -3,6 +3,6 @@ SQL imports"""from .aggregate import Aggregate-from .base import SQL, SQLException+from .base import SQL, SQLErrorfrom .expression import Expressionfrom .token import Tokendiff --git a/src/python/txtai/database/sql/base.py b/src/python/txtai/database/sql/base.pyindex 3bfc5312..e7bef613 100644--- a/src/python/txtai/database/sql/base.py+++ b/src/python/txtai/database/sql/base.py@@ -162,7 +162,7 @@ class SQL:return clause-class SQLException(Exception):+class SQLError(Exception):"""- Raised for exceptions generated by user SQL queries+ Raised for errors generated by user SQL queries"""diff --git a/test/python/testdatabase/testembeddings.py b/test/python/testdatabase/testembeddings.pyindex 60c18adf..a0273e0d 100644--- a/test/python/testdatabase/testembeddings.py+++ b/test/python/testdatabase/testembeddings.py@@ -12,7 +12,7 @@ import unittestfrom libcloud.storage.types import ContainerDoesNotExistError, ObjectDoesNotExistErrorfrom txtai.embeddings import Embeddings-from txtai.database import Database, SQLException+from txtai.database import Database, SQLErrorclass TestEmbeddings(unittest.TestCase):@@ -373,7 +373,7 @@ class TestEmbeddings(unittest.TestCase):self.assertEqual(sorted(result.keys()), ["data", "entry", "id", "text"])# Test SQL parse error- with self.assertRaises(SQLException):+ with self.assertRaises(SQLError):self.embeddings.search("select * from txtai where bad,query")def testUpsert(self):diff --git a/test/python/testdatabase/testsql.py b/test/python/testdatabase/testsql.pyindex 5f0c4ac4..06033ccd 100644--- a/test/python/testdatabase/testsql.py+++ b/test/python/testdatabase/testsql.py@@ -4,7 +4,7 @@ SQL module testsimport unittest-from txtai.database import SQL, SQLException, SQLite+from txtai.database import SQL, SQLError, SQLiteclass TestSQL(unittest.TestCase):@@ -58,16 +58,16 @@ class TestSQL(unittest.TestCase):Test invalid SQL"""- with self.assertRaises(SQLException):+ with self.assertRaises(SQLError):self.db.search("select * from txtai where order by")- with self.assertRaises(SQLException):+ with self.assertRaises(SQLError):self.db.search("select * from txtai where groupby order by")- with self.assertRaises(SQLException):+ with self.assertRaises(SQLError):self.db.search("select * from txtai where a(1)")- with self.assertRaises(SQLException):+ with self.assertRaises(SQLError):self.db.search("select a b c from txtai where id match id")def testBracket(self):