memorisdk 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of memorisdk might be problematic. Click here for more details.
- memoriai/__init__.py +140 -0
- memoriai/agents/__init__.py +7 -0
- memoriai/agents/conscious_agent.py +506 -0
- memoriai/agents/memory_agent.py +322 -0
- memoriai/agents/retrieval_agent.py +579 -0
- memoriai/config/__init__.py +14 -0
- memoriai/config/manager.py +281 -0
- memoriai/config/settings.py +287 -0
- memoriai/core/__init__.py +6 -0
- memoriai/core/database.py +966 -0
- memoriai/core/memory.py +1349 -0
- memoriai/database/__init__.py +5 -0
- memoriai/database/connectors/__init__.py +9 -0
- memoriai/database/connectors/mysql_connector.py +159 -0
- memoriai/database/connectors/postgres_connector.py +158 -0
- memoriai/database/connectors/sqlite_connector.py +148 -0
- memoriai/database/queries/__init__.py +15 -0
- memoriai/database/queries/base_queries.py +204 -0
- memoriai/database/queries/chat_queries.py +157 -0
- memoriai/database/queries/entity_queries.py +236 -0
- memoriai/database/queries/memory_queries.py +178 -0
- memoriai/database/templates/__init__.py +0 -0
- memoriai/database/templates/basic_template.py +0 -0
- memoriai/database/templates/schemas/__init__.py +0 -0
- memoriai/integrations/__init__.py +68 -0
- memoriai/integrations/anthropic_integration.py +194 -0
- memoriai/integrations/litellm_integration.py +11 -0
- memoriai/integrations/openai_integration.py +273 -0
- memoriai/scripts/llm_text.py +50 -0
- memoriai/tools/__init__.py +5 -0
- memoriai/tools/memory_tool.py +544 -0
- memoriai/utils/__init__.py +89 -0
- memoriai/utils/exceptions.py +418 -0
- memoriai/utils/helpers.py +433 -0
- memoriai/utils/logging.py +204 -0
- memoriai/utils/pydantic_models.py +258 -0
- memoriai/utils/schemas.py +0 -0
- memoriai/utils/validators.py +339 -0
- memorisdk-1.0.0.dist-info/METADATA +386 -0
- memorisdk-1.0.0.dist-info/RECORD +44 -0
- memorisdk-1.0.0.dist-info/WHEEL +5 -0
- memorisdk-1.0.0.dist-info/entry_points.txt +2 -0
- memorisdk-1.0.0.dist-info/licenses/LICENSE +203 -0
- memorisdk-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Database connectors for different database backends
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .mysql_connector import MySQLConnector
|
|
6
|
+
from .postgres_connector import PostgreSQLConnector
|
|
7
|
+
from .sqlite_connector import SQLiteConnector
|
|
8
|
+
|
|
9
|
+
__all__ = ["SQLiteConnector", "PostgreSQLConnector", "MySQLConnector"]
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MySQL connector for Memori v1.0
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from loguru import logger
|
|
8
|
+
|
|
9
|
+
from ...utils.exceptions import DatabaseError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MySQLConnector:
|
|
13
|
+
"""MySQL database connector"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, connection_config: Dict[str, str]):
|
|
16
|
+
"""Initialize MySQL connector"""
|
|
17
|
+
self.connection_config = connection_config
|
|
18
|
+
self._mysql = None
|
|
19
|
+
self._setup_mysql()
|
|
20
|
+
|
|
21
|
+
def _setup_mysql(self):
|
|
22
|
+
"""Setup MySQL connection library"""
|
|
23
|
+
try:
|
|
24
|
+
import mysql.connector
|
|
25
|
+
|
|
26
|
+
self._mysql = mysql.connector
|
|
27
|
+
except ImportError:
|
|
28
|
+
raise DatabaseError(
|
|
29
|
+
"mysql-connector-python is required for MySQL support. "
|
|
30
|
+
"Install it with: pip install mysql-connector-python"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def get_connection(self):
|
|
34
|
+
"""Get MySQL connection"""
|
|
35
|
+
try:
|
|
36
|
+
conn = self._mysql.connect(**self.connection_config)
|
|
37
|
+
return conn
|
|
38
|
+
|
|
39
|
+
except Exception as e:
|
|
40
|
+
raise DatabaseError(f"Failed to connect to MySQL database: {e}")
|
|
41
|
+
|
|
42
|
+
def execute_query(
|
|
43
|
+
self, query: str, params: Optional[List] = None
|
|
44
|
+
) -> List[Dict[str, Any]]:
|
|
45
|
+
"""Execute a query and return results"""
|
|
46
|
+
try:
|
|
47
|
+
with self.get_connection() as conn:
|
|
48
|
+
cursor = conn.cursor(dictionary=True)
|
|
49
|
+
|
|
50
|
+
if params:
|
|
51
|
+
cursor.execute(query, params)
|
|
52
|
+
else:
|
|
53
|
+
cursor.execute(query)
|
|
54
|
+
|
|
55
|
+
results = cursor.fetchall()
|
|
56
|
+
cursor.close()
|
|
57
|
+
|
|
58
|
+
return results
|
|
59
|
+
|
|
60
|
+
except Exception as e:
|
|
61
|
+
raise DatabaseError(f"Failed to execute query: {e}")
|
|
62
|
+
|
|
63
|
+
def execute_insert(self, query: str, params: Optional[List] = None) -> str:
|
|
64
|
+
"""Execute an insert query and return the inserted row ID"""
|
|
65
|
+
try:
|
|
66
|
+
with self.get_connection() as conn:
|
|
67
|
+
cursor = conn.cursor()
|
|
68
|
+
|
|
69
|
+
if params:
|
|
70
|
+
cursor.execute(query, params)
|
|
71
|
+
else:
|
|
72
|
+
cursor.execute(query)
|
|
73
|
+
|
|
74
|
+
conn.commit()
|
|
75
|
+
inserted_id = str(cursor.lastrowid)
|
|
76
|
+
cursor.close()
|
|
77
|
+
|
|
78
|
+
return inserted_id
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
raise DatabaseError(f"Failed to execute insert: {e}")
|
|
82
|
+
|
|
83
|
+
def execute_update(self, query: str, params: Optional[List] = None) -> int:
|
|
84
|
+
"""Execute an update query and return number of affected rows"""
|
|
85
|
+
try:
|
|
86
|
+
with self.get_connection() as conn:
|
|
87
|
+
cursor = conn.cursor()
|
|
88
|
+
|
|
89
|
+
if params:
|
|
90
|
+
cursor.execute(query, params)
|
|
91
|
+
else:
|
|
92
|
+
cursor.execute(query)
|
|
93
|
+
|
|
94
|
+
conn.commit()
|
|
95
|
+
affected_rows = cursor.rowcount
|
|
96
|
+
cursor.close()
|
|
97
|
+
|
|
98
|
+
return affected_rows
|
|
99
|
+
|
|
100
|
+
except Exception as e:
|
|
101
|
+
raise DatabaseError(f"Failed to execute update: {e}")
|
|
102
|
+
|
|
103
|
+
def execute_delete(self, query: str, params: Optional[List] = None) -> int:
|
|
104
|
+
"""Execute a delete query and return number of affected rows"""
|
|
105
|
+
try:
|
|
106
|
+
with self.get_connection() as conn:
|
|
107
|
+
cursor = conn.cursor()
|
|
108
|
+
|
|
109
|
+
if params:
|
|
110
|
+
cursor.execute(query, params)
|
|
111
|
+
else:
|
|
112
|
+
cursor.execute(query)
|
|
113
|
+
|
|
114
|
+
conn.commit()
|
|
115
|
+
affected_rows = cursor.rowcount
|
|
116
|
+
cursor.close()
|
|
117
|
+
|
|
118
|
+
return affected_rows
|
|
119
|
+
|
|
120
|
+
except Exception as e:
|
|
121
|
+
raise DatabaseError(f"Failed to execute delete: {e}")
|
|
122
|
+
|
|
123
|
+
def execute_transaction(self, queries: List[tuple]) -> bool:
|
|
124
|
+
"""Execute multiple queries in a transaction"""
|
|
125
|
+
try:
|
|
126
|
+
with self.get_connection() as conn:
|
|
127
|
+
cursor = conn.cursor()
|
|
128
|
+
|
|
129
|
+
try:
|
|
130
|
+
for query, params in queries:
|
|
131
|
+
if params:
|
|
132
|
+
cursor.execute(query, params)
|
|
133
|
+
else:
|
|
134
|
+
cursor.execute(query)
|
|
135
|
+
|
|
136
|
+
conn.commit()
|
|
137
|
+
cursor.close()
|
|
138
|
+
return True
|
|
139
|
+
|
|
140
|
+
except Exception as e:
|
|
141
|
+
conn.rollback()
|
|
142
|
+
cursor.close()
|
|
143
|
+
raise e
|
|
144
|
+
|
|
145
|
+
except Exception as e:
|
|
146
|
+
logger.error(f"Transaction failed: {e}")
|
|
147
|
+
return False
|
|
148
|
+
|
|
149
|
+
def test_connection(self) -> bool:
|
|
150
|
+
"""Test if the database connection is working"""
|
|
151
|
+
try:
|
|
152
|
+
with self.get_connection() as conn:
|
|
153
|
+
cursor = conn.cursor()
|
|
154
|
+
cursor.execute("SELECT 1")
|
|
155
|
+
cursor.close()
|
|
156
|
+
return True
|
|
157
|
+
except Exception as e:
|
|
158
|
+
logger.error(f"Connection test failed: {e}")
|
|
159
|
+
return False
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PostgreSQL connector for Memori v1.0
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from loguru import logger
|
|
8
|
+
|
|
9
|
+
from ...utils.exceptions import DatabaseError
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PostgreSQLConnector:
|
|
13
|
+
"""PostgreSQL database connector"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, connection_string: str):
|
|
16
|
+
"""Initialize PostgreSQL connector"""
|
|
17
|
+
self.connection_string = connection_string
|
|
18
|
+
self._psycopg2 = None
|
|
19
|
+
self._setup_psycopg2()
|
|
20
|
+
|
|
21
|
+
def _setup_psycopg2(self):
|
|
22
|
+
"""Setup psycopg2 connection"""
|
|
23
|
+
try:
|
|
24
|
+
import psycopg2
|
|
25
|
+
import psycopg2.extras
|
|
26
|
+
|
|
27
|
+
self._psycopg2 = psycopg2
|
|
28
|
+
self._extras = psycopg2.extras
|
|
29
|
+
except ImportError:
|
|
30
|
+
raise DatabaseError(
|
|
31
|
+
"psycopg2 is required for PostgreSQL support. "
|
|
32
|
+
"Install it with: pip install psycopg2-binary"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def get_connection(self):
|
|
36
|
+
"""Get PostgreSQL connection"""
|
|
37
|
+
try:
|
|
38
|
+
conn = self._psycopg2.connect(
|
|
39
|
+
self.connection_string, cursor_factory=self._extras.RealDictCursor
|
|
40
|
+
)
|
|
41
|
+
conn.autocommit = False
|
|
42
|
+
return conn
|
|
43
|
+
|
|
44
|
+
except Exception as e:
|
|
45
|
+
raise DatabaseError(f"Failed to connect to PostgreSQL database: {e}")
|
|
46
|
+
|
|
47
|
+
def execute_query(
|
|
48
|
+
self, query: str, params: Optional[List] = None
|
|
49
|
+
) -> List[Dict[str, Any]]:
|
|
50
|
+
"""Execute a query and return results"""
|
|
51
|
+
try:
|
|
52
|
+
with self.get_connection() as conn:
|
|
53
|
+
with conn.cursor() as cursor:
|
|
54
|
+
if params:
|
|
55
|
+
cursor.execute(query, params)
|
|
56
|
+
else:
|
|
57
|
+
cursor.execute(query)
|
|
58
|
+
|
|
59
|
+
# Return results as list of dictionaries
|
|
60
|
+
results = []
|
|
61
|
+
for row in cursor.fetchall():
|
|
62
|
+
results.append(dict(row))
|
|
63
|
+
|
|
64
|
+
return results
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
raise DatabaseError(f"Failed to execute query: {e}")
|
|
68
|
+
|
|
69
|
+
def execute_insert(self, query: str, params: Optional[List] = None) -> str:
|
|
70
|
+
"""Execute an insert query and return the inserted row ID"""
|
|
71
|
+
try:
|
|
72
|
+
with self.get_connection() as conn:
|
|
73
|
+
with conn.cursor() as cursor:
|
|
74
|
+
if params:
|
|
75
|
+
cursor.execute(query, params)
|
|
76
|
+
else:
|
|
77
|
+
cursor.execute(query)
|
|
78
|
+
|
|
79
|
+
# Try to get the inserted ID
|
|
80
|
+
inserted_id = None
|
|
81
|
+
if cursor.rowcount > 0:
|
|
82
|
+
try:
|
|
83
|
+
# For PostgreSQL, we need RETURNING clause for ID
|
|
84
|
+
inserted_id = cursor.fetchone()
|
|
85
|
+
if inserted_id and hasattr(inserted_id, "values"):
|
|
86
|
+
inserted_id = str(list(inserted_id.values())[0])
|
|
87
|
+
else:
|
|
88
|
+
inserted_id = str(cursor.rowcount)
|
|
89
|
+
except Exception:
|
|
90
|
+
inserted_id = str(cursor.rowcount)
|
|
91
|
+
|
|
92
|
+
conn.commit()
|
|
93
|
+
return inserted_id or "0"
|
|
94
|
+
|
|
95
|
+
except Exception as e:
|
|
96
|
+
raise DatabaseError(f"Failed to execute insert: {e}")
|
|
97
|
+
|
|
98
|
+
def execute_update(self, query: str, params: Optional[List] = None) -> int:
|
|
99
|
+
"""Execute an update query and return number of affected rows"""
|
|
100
|
+
try:
|
|
101
|
+
with self.get_connection() as conn:
|
|
102
|
+
with conn.cursor() as cursor:
|
|
103
|
+
if params:
|
|
104
|
+
cursor.execute(query, params)
|
|
105
|
+
else:
|
|
106
|
+
cursor.execute(query)
|
|
107
|
+
|
|
108
|
+
conn.commit()
|
|
109
|
+
return cursor.rowcount
|
|
110
|
+
|
|
111
|
+
except Exception as e:
|
|
112
|
+
raise DatabaseError(f"Failed to execute update: {e}")
|
|
113
|
+
|
|
114
|
+
def execute_delete(self, query: str, params: Optional[List] = None) -> int:
|
|
115
|
+
"""Execute a delete query and return number of affected rows"""
|
|
116
|
+
try:
|
|
117
|
+
with self.get_connection() as conn:
|
|
118
|
+
with conn.cursor() as cursor:
|
|
119
|
+
if params:
|
|
120
|
+
cursor.execute(query, params)
|
|
121
|
+
else:
|
|
122
|
+
cursor.execute(query)
|
|
123
|
+
|
|
124
|
+
conn.commit()
|
|
125
|
+
return cursor.rowcount
|
|
126
|
+
|
|
127
|
+
except Exception as e:
|
|
128
|
+
raise DatabaseError(f"Failed to execute delete: {e}")
|
|
129
|
+
|
|
130
|
+
def execute_transaction(self, queries: List[tuple]) -> bool:
|
|
131
|
+
"""Execute multiple queries in a transaction"""
|
|
132
|
+
try:
|
|
133
|
+
with self.get_connection() as conn:
|
|
134
|
+
with conn.cursor() as cursor:
|
|
135
|
+
|
|
136
|
+
for query, params in queries:
|
|
137
|
+
if params:
|
|
138
|
+
cursor.execute(query, params)
|
|
139
|
+
else:
|
|
140
|
+
cursor.execute(query)
|
|
141
|
+
|
|
142
|
+
conn.commit()
|
|
143
|
+
return True
|
|
144
|
+
|
|
145
|
+
except Exception as e:
|
|
146
|
+
logger.error(f"Transaction failed: {e}")
|
|
147
|
+
return False
|
|
148
|
+
|
|
149
|
+
def test_connection(self) -> bool:
|
|
150
|
+
"""Test if the database connection is working"""
|
|
151
|
+
try:
|
|
152
|
+
with self.get_connection() as conn:
|
|
153
|
+
with conn.cursor() as cursor:
|
|
154
|
+
cursor.execute("SELECT 1")
|
|
155
|
+
return True
|
|
156
|
+
except Exception as e:
|
|
157
|
+
logger.error(f"Connection test failed: {e}")
|
|
158
|
+
return False
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SQLite connector for Memori v1.0
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sqlite3
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
|
+
|
|
9
|
+
from loguru import logger
|
|
10
|
+
|
|
11
|
+
from ...utils.exceptions import DatabaseError
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SQLiteConnector:
|
|
15
|
+
"""SQLite database connector with FTS5 support"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, db_path: str):
|
|
18
|
+
"""Initialize SQLite connector"""
|
|
19
|
+
self.db_path = db_path
|
|
20
|
+
self._ensure_directory_exists()
|
|
21
|
+
|
|
22
|
+
def _ensure_directory_exists(self):
|
|
23
|
+
"""Ensure the database directory exists"""
|
|
24
|
+
db_dir = Path(self.db_path).parent
|
|
25
|
+
db_dir.mkdir(parents=True, exist_ok=True)
|
|
26
|
+
|
|
27
|
+
def get_connection(self) -> sqlite3.Connection:
|
|
28
|
+
"""Get SQLite connection with proper configuration"""
|
|
29
|
+
try:
|
|
30
|
+
conn = sqlite3.connect(self.db_path)
|
|
31
|
+
conn.row_factory = sqlite3.Row # Enable dict-like access
|
|
32
|
+
|
|
33
|
+
# Enable foreign keys
|
|
34
|
+
conn.execute("PRAGMA foreign_keys = ON")
|
|
35
|
+
|
|
36
|
+
# Enable WAL mode for better concurrency
|
|
37
|
+
conn.execute("PRAGMA journal_mode = WAL")
|
|
38
|
+
|
|
39
|
+
# Enable FTS5 tokenizer if available
|
|
40
|
+
try:
|
|
41
|
+
conn.execute("PRAGMA enable_fts3_tokenizer=1")
|
|
42
|
+
except sqlite3.Error:
|
|
43
|
+
# FTS3 tokenizer not available, continue without it
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
return conn
|
|
47
|
+
|
|
48
|
+
except Exception as e:
|
|
49
|
+
raise DatabaseError(f"Failed to connect to SQLite database: {e}")
|
|
50
|
+
|
|
51
|
+
def execute_query(
|
|
52
|
+
self, query: str, params: Optional[List] = None
|
|
53
|
+
) -> List[Dict[str, Any]]:
|
|
54
|
+
"""Execute a query and return results"""
|
|
55
|
+
try:
|
|
56
|
+
with self.get_connection() as conn:
|
|
57
|
+
cursor = conn.cursor()
|
|
58
|
+
if params:
|
|
59
|
+
cursor.execute(query, params)
|
|
60
|
+
else:
|
|
61
|
+
cursor.execute(query)
|
|
62
|
+
|
|
63
|
+
# Return results as list of dictionaries
|
|
64
|
+
results = []
|
|
65
|
+
for row in cursor.fetchall():
|
|
66
|
+
results.append(dict(row))
|
|
67
|
+
|
|
68
|
+
return results
|
|
69
|
+
|
|
70
|
+
except Exception as e:
|
|
71
|
+
raise DatabaseError(f"Failed to execute query: {e}")
|
|
72
|
+
|
|
73
|
+
def execute_insert(self, query: str, params: Optional[List] = None) -> str:
|
|
74
|
+
"""Execute an insert query and return the inserted row ID"""
|
|
75
|
+
try:
|
|
76
|
+
with self.get_connection() as conn:
|
|
77
|
+
cursor = conn.cursor()
|
|
78
|
+
if params:
|
|
79
|
+
cursor.execute(query, params)
|
|
80
|
+
else:
|
|
81
|
+
cursor.execute(query)
|
|
82
|
+
|
|
83
|
+
conn.commit()
|
|
84
|
+
return str(cursor.lastrowid)
|
|
85
|
+
|
|
86
|
+
except Exception as e:
|
|
87
|
+
raise DatabaseError(f"Failed to execute insert: {e}")
|
|
88
|
+
|
|
89
|
+
def execute_update(self, query: str, params: Optional[List] = None) -> int:
|
|
90
|
+
"""Execute an update query and return number of affected rows"""
|
|
91
|
+
try:
|
|
92
|
+
with self.get_connection() as conn:
|
|
93
|
+
cursor = conn.cursor()
|
|
94
|
+
if params:
|
|
95
|
+
cursor.execute(query, params)
|
|
96
|
+
else:
|
|
97
|
+
cursor.execute(query)
|
|
98
|
+
|
|
99
|
+
conn.commit()
|
|
100
|
+
return cursor.rowcount
|
|
101
|
+
|
|
102
|
+
except Exception as e:
|
|
103
|
+
raise DatabaseError(f"Failed to execute update: {e}")
|
|
104
|
+
|
|
105
|
+
def execute_delete(self, query: str, params: Optional[List] = None) -> int:
|
|
106
|
+
"""Execute a delete query and return number of affected rows"""
|
|
107
|
+
try:
|
|
108
|
+
with self.get_connection() as conn:
|
|
109
|
+
cursor = conn.cursor()
|
|
110
|
+
if params:
|
|
111
|
+
cursor.execute(query, params)
|
|
112
|
+
else:
|
|
113
|
+
cursor.execute(query)
|
|
114
|
+
|
|
115
|
+
conn.commit()
|
|
116
|
+
return cursor.rowcount
|
|
117
|
+
|
|
118
|
+
except Exception as e:
|
|
119
|
+
raise DatabaseError(f"Failed to execute delete: {e}")
|
|
120
|
+
|
|
121
|
+
def execute_transaction(self, queries: List[tuple]) -> bool:
|
|
122
|
+
"""Execute multiple queries in a transaction"""
|
|
123
|
+
try:
|
|
124
|
+
with self.get_connection() as conn:
|
|
125
|
+
cursor = conn.cursor()
|
|
126
|
+
|
|
127
|
+
for query, params in queries:
|
|
128
|
+
if params:
|
|
129
|
+
cursor.execute(query, params)
|
|
130
|
+
else:
|
|
131
|
+
cursor.execute(query)
|
|
132
|
+
|
|
133
|
+
conn.commit()
|
|
134
|
+
return True
|
|
135
|
+
|
|
136
|
+
except Exception as e:
|
|
137
|
+
logger.error(f"Transaction failed: {e}")
|
|
138
|
+
return False
|
|
139
|
+
|
|
140
|
+
def test_connection(self) -> bool:
|
|
141
|
+
"""Test if the database connection is working"""
|
|
142
|
+
try:
|
|
143
|
+
with self.get_connection() as conn:
|
|
144
|
+
conn.execute("SELECT 1")
|
|
145
|
+
return True
|
|
146
|
+
except Exception as e:
|
|
147
|
+
logger.error(f"Connection test failed: {e}")
|
|
148
|
+
return False
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Database queries module for centralized SQL management
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .base_queries import BaseQueries
|
|
6
|
+
from .chat_queries import ChatQueries
|
|
7
|
+
from .entity_queries import EntityQueries
|
|
8
|
+
from .memory_queries import MemoryQueries
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"BaseQueries",
|
|
12
|
+
"MemoryQueries",
|
|
13
|
+
"ChatQueries",
|
|
14
|
+
"EntityQueries",
|
|
15
|
+
]
|