Hi, I’d like to follow up on the Backref Arguments <http://docs.sqlalchemy.org/en/latest/orm/backref.html#backref-arguments> example from the documentation.
First, to make sure I understand this correctly, are these two lines equivalent? I would assume so, considering this comment <http://docs.sqlalchemy.org/en/latest/orm/relationship_api.html#sqlalchemy.orm.relationship.params.primaryjoin>: “By default, this value [primaryjoin] is computed based on the foreign key relationships of the parent and child tables (or association table).” addresses = relationship("Address", backref="user") # Is like saying… addresses = relationship("Address", primaryjoin="User.id==Address.user_id", backref="user") Now for the backref with an argument. In the example, the email’s local part `tony` is hardcoded. Is there a way to parameterize that local part elegantly (i.e. pass arguments to that relationship), or is the following function the recommended way to go: def user_addresses(self, name): return [a for a in self.addresses if a.email.startswith(name)] Thanks! Jens -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to email@example.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.