Fixes to the pipeline
This commit is contained in:
parent
401167bb0f
commit
07e2bc1b39
4 changed files with 705 additions and 662 deletions
|
|
@ -108,11 +108,13 @@ async def add_files(file_paths: List[str], dataset_name: str, user):
|
||||||
data_id = ingestion.identify(classified_data)
|
data_id = ingestion.identify(classified_data)
|
||||||
|
|
||||||
if user is None:
|
if user is None:
|
||||||
user = await create_default_user()
|
try:
|
||||||
|
user = await create_default_user()
|
||||||
await give_permission_on_document(user, data_id, "read")
|
|
||||||
await give_permission_on_document(user, data_id, "write")
|
|
||||||
|
|
||||||
|
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()
|
file_metadata = classified_data.get_metadata()
|
||||||
|
|
||||||
yield {
|
yield {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,19 @@ class SQLAlchemyAdapter():
|
||||||
connection.execute(text("DELETE FROM cognify;"))
|
connection.execute(text("DELETE FROM cognify;"))
|
||||||
connection.execute(text("DROP TABLE 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 def delete_database(self):
|
||||||
async with self.engine.begin() as connection:
|
async with self.engine.begin() as connection:
|
||||||
from ..ModelBase import Base
|
try:
|
||||||
await connection.run_sync(Base.metadata.drop_all)
|
await self.drop_tables(connection)
|
||||||
|
print("Database tables dropped successfully.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error dropping database tables: {e}")
|
||||||
|
|
@ -35,7 +35,7 @@ async def main():
|
||||||
|
|
||||||
await cognee.add([text], dataset_name)
|
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
|
from cognee.infrastructure.databases.vector import get_vector_engine
|
||||||
vector_engine = get_vector_engine()
|
vector_engine = get_vector_engine()
|
||||||
|
|
|
||||||
1339
poetry.lock
generated
1339
poetry.lock
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue