python - Use alias for column name in SQLAlchemy -
suppose if have sqlalchemy table follows -
class employee(base): id = column(integer, primary_key=true) employee_desgination = column(string) i remember going through docs once , seeing way of using aliases long column names , use shorter ones instead. example, in above table instead of calling employee.employee_designation i'd use employee.emp_d or similar. wasn't able find example again :/ think declare alias() in table definition, not sure of syntax.
you can specify actual column name (if different attribute name) first argument column:
emp_d = column("employee_desgination", string)
Comments
Post a Comment