Hi

I have a few properties on an class specefied in declarative that are
mapped to a select, but I have only figured out how to map them
individually. I'd like to be able to specify the select only once, and
then pick what property maps to which field name, and make sure they
load simultaneously, by using deferred. Is this possible?

Here is my model:

class Product(Base):
    __tablename__ = "products"
    product_id = Column(Integer, primary_key = True)
    name = Column("Name", String)

    score = column_property(select(["score"],
                                        product_id == literal_column("al_id"),
                                        from_obj = ["product_data"]),
                                        deferred = True)

    n_pro_reviews  = column_property(select(["pro_reviews_count"],
                                        product_id == literal_column("al_id"),
                                        from_obj = ["product_data"]),
                                        deferred = True)

    n_user_reviews = column_property(select(["pro_reviews_count"],
                                        product_id ==
literal_column("product_id"),
                                        from_obj = ["product_data"]),
                                        deferred = True)

-- Joakim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to