fix: Remove creation of tables for PGVector
As PGVector is used as a vector database it doesn't need to create tables based on models Fix COG-678
This commit is contained in:
parent
b56a1dee59
commit
335b8ca0de
1 changed files with 0 additions and 8 deletions
|
|
@ -2,19 +2,11 @@ from ..get_vector_engine import get_vector_engine, get_vectordb_config
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
|
||||||
# Note: Variable is used like a caching mechanism to not recreate tables in case they were already created
|
|
||||||
created=False
|
|
||||||
|
|
||||||
async def create_db_and_tables():
|
async def create_db_and_tables():
|
||||||
vector_config = get_vectordb_config()
|
vector_config = get_vectordb_config()
|
||||||
vector_engine = get_vector_engine()
|
vector_engine = get_vector_engine()
|
||||||
|
|
||||||
if vector_config.vector_db_provider == "pgvector":
|
if vector_config.vector_db_provider == "pgvector":
|
||||||
global created
|
|
||||||
if not created:
|
|
||||||
await vector_engine.create_database()
|
|
||||||
created = True
|
|
||||||
|
|
||||||
async with vector_engine.engine.begin() as connection:
|
async with vector_engine.engine.begin() as connection:
|
||||||
await connection.execute(text("CREATE EXTENSION IF NOT EXISTS vector;"))
|
await connection.execute(text("CREATE EXTENSION IF NOT EXISTS vector;"))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue