Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

Only create single table with create_all, not all

Sarah Woodersee5ece686660
diff --git a/memgpt/connectors/db.py b/memgpt/connectors/db.py
index 206f7e3f8..b49c6c747 100644
--- a/memgpt/connectors/db.py
+++ b/memgpt/connectors/db.py
@@ -377,7 +377,8 @@ class PostgresStorageConnector(SQLStorageConnector):
print(c.name, c.type)
if c.name == "embedding":
assert isinstance(c.type, Vector), f"Embedding column must be of type Vector, got {c.type}"
- Base.metadata.create_all(self.engine) # Create the table if it doesn't exist
+ Base.metadata.create_all(self.engine, tables=[self.db_model.__table__]) # Create the table if it doesn't exist
+
self.Session = sessionmaker(bind=self.engine)
self.Session().execute(text("CREATE EXTENSION IF NOT EXISTS vector")) # Enables the vector extension
@@ -417,7 +418,7 @@ class SQLLiteStorageConnector(SQLStorageConnector):
# Create the SQLAlchemy engine
self.db_model = get_db_model(self.table_name, table_type, dialect="sqlite")
self.engine = create_engine(f"sqlite:///{self.path}")
- Base.metadata.create_all(self.engine) # Create the table if it doesn't exist
+ Base.metadata.create_all(self.engine, tables=[self.db_model.__table__]) # Create the table if it doesn't exist
self.Session = sessionmaker(bind=self.engine)
import sqlite3