Re: [sqlalchemy] Difference b/w creating a DeclarativeBase class vs assigning DeclarativeBase()

2023-10-10 Thread Simon King
I don't think this code was ever correct: Base = DeclarativeBase() Before SQLAlchemy 2.0, there was a declarative_base() function that was used in the same way: from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() ...but in SQLAlchemy 2.0, the

[sqlalchemy] Difference b/w creating a DeclarativeBase class vs assigning DeclarativeBase()

2023-10-10 Thread satya dev
What is the difference between class Base(DeclarativeBase): pass vs Base = DeclarativeBase() I am following the SQLAlchemy Tutorial for declaring mapped classes when I inherit the Base class I can access the metadata and create my tables