how to get column name in db from an sqlalchemy attribute model code example
Example: how to get column name in db from an sqlalchemy attribute model
class User(Base):
__tablename__ = 'user'
id = Column('id', String(40), primary_key=True)
email = Column('email', String(50))
firstName = Column('first_name', String(25))
lastName = Column('last_name', String(25))
addressOne = Column('address_one', String(255))
from sqlalchemy.inspection import inspect
columnNameInDb = inspect(User).c.firstName.name
print(columnNameInDb)