[Python] In Sqlalchemy, what's different in defining table using Base and Table

Discussão em 'Python' iniciado por Stack, Janeiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I know i can define a table using Table:

    user = Table('user', metadata,
    Column('user_id', Integer, primary_key = True),
    )


    and using Base:

    Base = declarative_base()
    class User(Base):
    __tablename__ = 'user'
    user_id= Column(Integer, primary_key = True)


    but what's the different???

    Continue reading...

Compartilhe esta Página