Merge pull request #43 from topoteretes/COG-68

Cog 68
This commit is contained in:
Vasilije 2024-02-20 09:42:25 +01:00 committed by GitHub
commit 0ee8899f68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 16 deletions

View file

@ -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."""

View file

@ -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: