diff --git a/cognitive_architecture/config.py b/cognitive_architecture/config.py index d4c9bf04d..d92fe5803 100644 --- a/cognitive_architecture/config.py +++ b/cognitive_architecture/config.py @@ -35,6 +35,7 @@ class Config: db_port: str = os.getenv("DB_PORT", "5432") db_user: str = os.getenv("DB_USER", "cognee") db_password: str = os.getenv("DB_PASSWORD", "cognee") + sqlalchemy_logging: bool = os.getenv("SQLALCHEMY_LOGGING", True) # Model parameters model: str = "gpt-4-1106-preview" diff --git a/cognitive_architecture/database/relationaldb/database.py b/cognitive_architecture/database/relationaldb/database.py index 8f470624f..9c463b798 100644 --- a/cognitive_architecture/database/relationaldb/database.py +++ b/cognitive_architecture/database/relationaldb/database.py @@ -33,20 +33,16 @@ def get_sqlalchemy_database_url(db_type='sqlite', db_name=config.db_name, base_p raise ValueError(f"Unsupported DB_TYPE: {db_type}") -# Example usage with a configuration file: -# config = DatabaseConfig(config_file='path/to/config.json') -# Or set them programmatically: - - SQLALCHEMY_DATABASE_URL = get_sqlalchemy_database_url() engine = create_async_engine( SQLALCHEMY_DATABASE_URL, pool_recycle=3600, - echo=True, # Enable logging for tutorial purposes + echo=config.sqlalchemy_logging, ) -# Use AsyncSession for the session + + AsyncSessionLocal = sessionmaker( bind=engine, class_=AsyncSession,