diff --git a/cognitive_architecture/database/database_manager.py b/cognitive_architecture/database/database_manager.py index ab988ecc7..c4706988b 100644 --- a/cognitive_architecture/database/database_manager.py +++ b/cognitive_architecture/database/database_manager.py @@ -15,7 +15,7 @@ class DatabaseManager: """Manages database creation, deletion, and table initialization.""" def __init__(self): """Initialize the Database Url with a given configuration.""" - self.engine = create_async_engine(get_sqlalchemy_database_url("sqlite"), echo = True) + self.engine = create_async_engine(get_sqlalchemy_database_url(globalConfig.db_type), echo = True) self.db_type = globalConfig.db_type @asynccontextmanager @@ -37,7 +37,7 @@ class DatabaseManager: query = text(f"SELECT 1 FROM pg_database WHERE datname='{db_name}'") async with self.get_connection() as connection: result = await connection.execute(query) - return await result.fetchone() is not None + return result.fetchone() is not None async def create_database(self, db_name): """Create a new database.""" diff --git a/docker-compose.yml b/docker-compose.yml index 927198116..86a67b467 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,9 +33,9 @@ services: - 80:80 - 50051:50051 - 5678:5678 - - 5432:5432 +# - 5432:5432 depends_on: - # - postgres + - postgres - neo4j deploy: resources: @@ -43,18 +43,18 @@ services: cpus: "4.0" memory: 8GB - # postgres: - # image: postgres - # container_name: postgres - # environment: - # - POSTGRES_HOST_AUTH_METHOD=trust - # - POSTGRES_USER=bla - # - POSTGRES_PASSWORD=bla - # - POSTGRES_DB=bubu - # networks: - # - cognee_backend - # ports: - # - "5432:5432" + postgres: + image: postgres + container_name: postgres + environment: + - POSTGRES_HOST_AUTH_METHOD=trust + - POSTGRES_USER=bla + - POSTGRES_PASSWORD=bla + - POSTGRES_DB=bubu + networks: + - cognee_backend + ports: + - "5432:5432" networks: cognee_backend: