Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Rename SQLException to SQLError, closes #232

davidmezzetti47b6b07db381
diff --git a/src/python/txtai/database/base.py b/src/python/txtai/database/base.py
index b8d4dd60..64a784e7 100644
--- a/src/python/txtai/database/base.py
+++ b/src/python/txtai/database/base.py
@@ -5,7 +5,7 @@ Database module
import logging
from .encoder import EncoderFactory
-from .sql import SQL, SQLException, Token
+from .sql import SQL, SQLError, Token
# Logging configuration
logger = 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 None
diff --git a/src/python/txtai/database/sql/__init__.py b/src/python/txtai/database/sql/__init__.py
index 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, SQLError
from .expression import Expression
from .token import Token
diff --git a/src/python/txtai/database/sql/base.py b/src/python/txtai/database/sql/base.py
index 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.py
index 60c18adf..a0273e0d 100644
--- a/test/python/testdatabase/testembeddings.py
+++ b/test/python/testdatabase/testembeddings.py
@@ -12,7 +12,7 @@ import unittest
from libcloud.storage.types import ContainerDoesNotExistError, ObjectDoesNotExistError
from txtai.embeddings import Embeddings
-from txtai.database import Database, SQLException
+from txtai.database import Database, SQLError
class 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.py
index 5f0c4ac4..06033ccd 100644
--- a/test/python/testdatabase/testsql.py
+++ b/test/python/testdatabase/testsql.py
@@ -4,7 +4,7 @@ SQL module tests
import unittest
-from txtai.database import SQL, SQLException, SQLite
+from txtai.database import SQL, SQLError, SQLite
class 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):