On Jun 18, 2007, at 3:34 PM, Christoph Haas wrote:
> assign_mapper(session_context, DhcpHost, dhcp_hosts_table) > > assign_mapper(session_context, DnsRecord, powerdns_records_table, > properties={ > 'dhcphost': relation(DhcpHost, > primaryjoin=(cast > (powerdns_records_table.c.content,PGInet) > ==dhcp_hosts_table.c.ip_address), > foreign_keys=[powerdns_records_table.c.content]), > } > ) > also, this works: mapper(DhcpHost, dhcp_hosts_table) mapper(DnsRecord, powerdns_records_table, properties={ 'dhcphost': relation(DhcpHost, primaryjoin=(cast (powerdns_records_table.c.content,PGInet) ==dhcp_hosts_table.c.ip_address), foreign_keys=[powerdns_records_table.c.content], remote_side=[dhcp_hosts_table.c.ip_address], viewonly=True, ), } ) now, the "viewonly" eliminates your "syncrule" issue. remote_side currently gives the lazyloader more information on which to build a lazy clause (works for eager too), and i can make it check for "CAST" to work around this issue (though id like it to work for any SQL function too). but since viewonly, this wont help you with a flush(). if i made "syncrule" accept a manual argument, such as a callable which you would define to say "destination.content = str(source.ip_address)", that would be a generalized way for there to be any kind of functional stuff indicated within a primaryjoin condition. in the case of CAST specifically, we do have some awareness that we need to go from PGInet -> string when setting DhcpHost's "content" attribute...but i dont like to redefine DB functionality on the Python side since we cant easily generalize it. ive added some comments to this effect to the ticket. this feature would be better in the 0.4 series, which has several weeks before release though is available via SVN. does that work for you ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---