cognee/cognee/modules/engine/operations/setup.py
2026-01-14 15:54:11 +01:00

25 lines
766 B
Python

from cognee.infrastructure.databases.relational import (
create_db_and_tables as create_relational_db_and_tables,
)
from cognee.infrastructure.databases.vector.pgvector import (
create_db_and_tables as create_pgvector_db_and_tables,
)
from cognee.context_global_variables import backend_access_control_enabled
async def setup():
"""
Set up the necessary databases and tables.
This function asynchronously creates a relational database and its corresponding tables,
followed by creating a PGVector database and its tables.
"""
await create_relational_db_and_tables()
if not backend_access_control_enabled():
await create_pgvector_db_and_tables()
if __name__ == "__main__":
import asyncio
asyncio.run(setup())