I have a customer table which has a 1-to-n relation with a phone
table.  The phone table has the following columns: integer id, string
number, and boolean is_fax.  Is there a way to override the phones
collection so I can return a boolean if the customer contains at least
1 phone record with a is_fax set to True.


For example:

class Customer: pass
class Phone: pass

session.mapper(Customer, customers_table,
properties={'phones':relation(Phone, backref='customers'})

my_customer = Customer.query.filter_by(id=1).first()

# I want it to return True if at least one phone in the list has
is_fax = True
# so I'm thinking of somehow wrapping or overriding the python list
class
my_customer.phones.has_fax()
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to