Search code examples
pythonmysqldatabaseormponyorm

How to reflect database objects using Pony ORM?


I have an existing MySQL database that I want to reflect using PonyORM.

I know I'm able to do that with SQLAlchemy:

engine = create_engine(...)
Base = declarative_base(metadata=MetaData(bind=engine))
...
...
class MyTable(Base):
    __table__ = Table('table_name', Base.metadata, autoload=True)

Is there a similiar way to do the same with PonyORM? I couldn't find information about that in the website.


Solution

  • Currently PonyORM does not have something like autoload=true, so entities have to be declared in Python. We can add support of database reflection in the future.