You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the chapter 4 program db_viewer.py I get the following error:
Traceback (most recent call last): File "/home/xxx/Documents/MyPython/db_viewer.py", line 95, in loadDatabase self.table_names = self.engine.table_names() AttributeError: 'Engine' object has no attribute 'table_names'
I read somewhere that it happens because of a change between the older and current version of the library. Please can someone give the "new" way to do the loading of the database with sqlalchemy? Thank you.
The text was updated successfully, but these errors were encountered:
for the current SQLAlchemy release you need to change line 86 in method loadDatabase from: self.table_names = self.engine.table_names()
to inspector = inspect(self.engine) self.table_names = inspector.get_table_names()
and import from sqlalchemy import inspect
Change 2:
On line 49 of method loadTable change: metadata = MetaData(self.engine)
to metadata = MetaData() metadata.reflect(self.engine)
Change 3
and on line 54 of the same method change: mapper(GenericDBClass, table)
to mapper_registry = registry() mapper_registry.map_imperatively(GenericDBClass, table)
and also import from sqlalchemy.orm import registry
When running the chapter 4 program db_viewer.py I get the following error:
Traceback (most recent call last): File "/home/xxx/Documents/MyPython/db_viewer.py", line 95, in loadDatabase self.table_names = self.engine.table_names() AttributeError: 'Engine' object has no attribute 'table_names'
I read somewhere that it happens because of a change between the older and current version of the library. Please can someone give the "new" way to do the loading of the database with sqlalchemy? Thank you.
The text was updated successfully, but these errors were encountered: