python - Sqlalchemy: Get some columns aliased -


i have question i'm sure it's quick answer, haven't been able find googling...

i have class product defined declarative sqlalchemy:

class product(declarativebase):     __tablename__ = "products"     _brand = column("brand", unicode(128))     _series = column("series", string(128))     _price = column("price", float)     _description = column("description", unicodetext)      _manufacturerid = column("manufacturer_id", integer, foreignkey("manufacturers.id"), key="manufacturerid")     _manufacturer = relationship("manufacturer",         uselist=false,          backref=backref("_products", collection_class=set)          ) 

and a point, want columns of products, such _brand , _manufacturerid, instead of retrieving named _manufacturerid want called _manufacturer (mainly "hide" relationship thing).

i don't know how that... like:

session.query(product.product._brand, product.product._manufacturerid "_manufacturer").all() 

i'm pretty sure doable, don't know how (using sqlalchemy 0.6.6, in case it's relevant)

thank much!

actually... think "label" may work.

how put sqlalchemy label on result of arithmetic expression?

if does, i'll detail here


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -