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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -