Modifying the 'Base' class generated by sqlacodegen

491 views Asked by At

I want to have a parent class for all of my sqlacodegen classes that map to database tables.

The code generated by sqlacodegen includes the following:

Base = declarative_base()
metadata = Base.metadata

class MyFirstClass(Base):
   ....

class MySecondClass(Base):
   ....

Base is indeed that parent class. How can I either: 1) Add functionality to Base? 2) Make a parent class for Base so I can add that functionality in there.

Where do I put the common code that all these classes (those mapped to the database tables) share?

0

There are 0 answers