Merge branch 'dev' of github.com:topoteretes/cognee into dev
This commit is contained in:
commit
0a9e1a4ec3
2 changed files with 4 additions and 4 deletions
|
|
@ -69,7 +69,7 @@ class SQLAlchemyAdapter:
|
||||||
async def delete_table(self, table_name: str, schema_name: Optional[str] = "public"):
|
async def delete_table(self, table_name: str, schema_name: Optional[str] = "public"):
|
||||||
async with self.engine.begin() as connection:
|
async with self.engine.begin() as connection:
|
||||||
if self.engine.dialect.name == "sqlite":
|
if self.engine.dialect.name == "sqlite":
|
||||||
# SQLite doesn’t support schema namespaces and the CASCADE keyword.
|
# SQLite doesn't support schema namespaces and the CASCADE keyword.
|
||||||
# However, foreign key constraint can be defined with ON DELETE CASCADE during table creation.
|
# However, foreign key constraint can be defined with ON DELETE CASCADE during table creation.
|
||||||
await connection.execute(text(f'DROP TABLE IF EXISTS "{table_name}";'))
|
await connection.execute(text(f'DROP TABLE IF EXISTS "{table_name}";'))
|
||||||
else:
|
else:
|
||||||
|
|
@ -327,10 +327,10 @@ class SQLAlchemyAdapter:
|
||||||
file.write("")
|
file.write("")
|
||||||
else:
|
else:
|
||||||
async with self.engine.begin() as connection:
|
async with self.engine.begin() as connection:
|
||||||
schema_list = await self.get_schema_list()
|
|
||||||
# Create a MetaData instance to load table information
|
# Create a MetaData instance to load table information
|
||||||
metadata = MetaData()
|
metadata = MetaData()
|
||||||
# Drop all tables from all schemas
|
# Drop all tables from the public schema
|
||||||
|
schema_list = ["public", "public_staging"]
|
||||||
for schema_name in schema_list:
|
for schema_name in schema_list:
|
||||||
# Load the schema information into the MetaData object
|
# Load the schema information into the MetaData object
|
||||||
await connection.run_sync(metadata.reflect, schema=schema_name)
|
await connection.run_sync(metadata.reflect, schema=schema_name)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class CollectionNotFoundError(CriticalError):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
message,
|
message,
|
||||||
name: str = "DatabaseNotCreatedError",
|
name: str = "CollectionNotFoundError",
|
||||||
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
|
status_code: int = status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
):
|
):
|
||||||
super().__init__(message, name, status_code)
|
super().__init__(message, name, status_code)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue