I normally define a column in a model like this, for example: jobID = Column(Integer, nullable=False, primary_key=True)
I now have a case where there are columns in the db that have spaces so I want to map the column name to a variable of a different name. Googling I found this: https://docs.sqlalchemy.org/en/14/orm/mapping_columns.html#naming-columns-distinctly-from-attribute-names class User(Base): __tablename__ = 'user' id = Column('user_id', Integer, primary_key=True) name = Column('user_name', String(50)) How can that work? Is it a different version of Column() from what I have been using? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CACwCsY4UdMXHJZzJ9zPDoL4y8333MXHyL7qpcrjptV5kz%3Dk9jA%40mail.gmail.com.
