Fixes to the pipeline

This commit is contained in:
Vasilije 2024-08-05 09:56:45 +02:00
parent 401167bb0f
commit 07e2bc1b39
4 changed files with 705 additions and 662 deletions

View file

@ -108,11 +108,13 @@ async def add_files(file_paths: List[str], dataset_name: str, user):
data_id = ingestion.identify(classified_data)
if user is None:
user = await create_default_user()
await give_permission_on_document(user, data_id, "read")
await give_permission_on_document(user, data_id, "write")
try:
user = await create_default_user()
await give_permission_on_document(user, data_id, "read")
await give_permission_on_document(user, data_id, "write")
except:
pass
file_metadata = classified_data.get_metadata()
yield {

View file

@ -153,7 +153,19 @@ class SQLAlchemyAdapter():
connection.execute(text("DELETE FROM cognify;"))
connection.execute(text("DROP TABLE cognify;"))
async def drop_tables(self, connection):
try:
await connection.execute(text("DROP TABLE IF EXISTS group_permission CASCADE"))
await connection.execute(text("DROP TABLE IF EXISTS permissions CASCADE"))
# Add more DROP TABLE statements for other tables as needed
print("Database tables dropped successfully.")
except Exception as e:
print(f"Error dropping database tables: {e}")
async def delete_database(self):
async with self.engine.begin() as connection:
from ..ModelBase import Base
await connection.run_sync(Base.metadata.drop_all)
try:
await self.drop_tables(connection)
print("Database tables dropped successfully.")
except Exception as e:
print(f"Error dropping database tables: {e}")

View file

@ -35,7 +35,7 @@ async def main():
await cognee.add([text], dataset_name)
await cognee.cognify([dataset_name], root_node_id = "ROOT")
await cognee.cognify([dataset_name])
from cognee.infrastructure.databases.vector import get_vector_engine
vector_engine = get_vector_engine()

1339
poetry.lock generated

File diff suppressed because it is too large Load diff