There's a couple of ways of doing this, and which you use really
depends on your use case.
One option is to explicitly query the Names table, using the
"with_parent" method to restrict the results to names belonging to the
correct person:
name_query = session.query(Names).with_parent(p).filter(Names.name.startswith('B'))
http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html#common-relationship-operators
Another is to configure the relationship as "dynamic":
http://docs.sqlalchemy.org/en/rel_0_9/orm/collections.html#dynamic-relationship
If you do this, Person.names_collection will no longer be a simple
Python list, but instead a special kind of query that is preconfigured
to select rows related to the person instance. You would use it like:
name_query = p.names_collection.filter(Names.name.startswith('B'))
This usually only makes sense for very large collections, since you
can't really eager-load a dynamic relationship.
Hope that helps,
Simon