Revert "fix: Add metadata reflection fix to sqlite as well"

This reverts commit 394a0b2dfb.
This commit is contained in:
Igor Ilic 2024-12-16 13:19:21 +01:00
parent 394a0b2dfb
commit 34b139af26

View file

@ -113,12 +113,10 @@ class SQLAlchemyAdapter():
""" """
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":
# Create a MetaData instance to load table information # Load the schema information into the MetaData object
metadata = MetaData() await connection.run_sync(Base.metadata.reflect)
# Load table information from schema into MetaData if table_name in Base.metadata.tables:
await connection.run_sync(metadata.reflect) return Base.metadata.tables[table_name]
if table_name in metadata.tables:
return metadata.tables[table_name]
else: else:
raise EntityNotFoundError(message=f"Table '{table_name}' not found.") raise EntityNotFoundError(message=f"Table '{table_name}' not found.")
else: else:
@ -140,11 +138,8 @@ class SQLAlchemyAdapter():
table_names = [] table_names = []
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":
# Create a MetaData instance to load table information await connection.run_sync(Base.metadata.reflect)
metadata = MetaData() for table in Base.metadata.tables:
# Load table information from schema into MetaData
await connection.run_sync(metadata.reflect)
for table in metadata.tables:
table_names.append(str(table)) table_names.append(str(table))
else: else:
schema_list = await self.get_schema_list() schema_list = await self.get_schema_list()