what does your SQL output look like ? if theres speed problems that originate in the SQL, thats where you should look first....if you can then come up with queries that work better, you can tailor your mappers around those new queries (in theory). or maybe just identify places where indexing could help.
Tim Van Steenburgh wrote: > Below is a snip of the relevant mappings. They appear to work but take > forever to load. I suspect there might be a better way to do this? > #--------------------------------------------------------------- > policies = Table('pol_homepolicy_tbl', engine, > Column('pol_policy_num', String(10), primary_key=True, > key='policyNum'), > Column('pol_policy_eff_date', DateTime, primary_key=True, > key='effectiveDate'), > ... > ) > > endorsements = Table('end_endorsement_tbl', engine, > Column('end_policy_num', String(10), > ForeignKey('pol_homepolicy_tbl.policyNum'), primary_key=True, > key='policyNum'), > Column('end_policy_eff_date', DateTime, > ForeignKey('pol_homepolicy_tbl.effectiveDate'), primary_key=True, > key='effectiveDate'), > Column('end_endorsement_type', String(20), > ForeignKey('uhe_endorsement_tbl.type'), primary_key=True, key='type'), > Column('end_endorsement_id', Integer, primary_key=True, key='id'), > Column('end_endorsement_desc', String(150), key='description'), > Column('end_endorsement_premium', Numeric(precision=2, length=9), > key='premium') > ... > ) > > endorsement_line_items_select = select( > [ > endorsements.c.type, > endorsements.c.id, > endorsements.c.description, > endorsements.c.premium > ] > ).alias('endorsement_line_items_select') > > EndorsementLineItem.mapper = mapper(EndorsementLineItem, > endorsement_line_items_select) > > distinct_endorsements_select = select( > [ > endorsements.c.policyNum, > endorsements.c.effectiveDate, > endorsements.c.type > ], > distinct=True > ).alias('distinct_endorsements_select') > > Endorsement.mapper = mapper(Endorsement, distinct_endorsements_select, > is_primary=True, properties=dict( > lineItems = relation(EndorsementLineItem.mapper, lazy=True, > private=True, > > primaryjoin=distinct_endorsements_select.c.end_endorsement_type==endorsement_line_items_select.c.end_endorsement_type > ) > )) > > Policy.mapper = mapper(Policy, policies, properties=dict( > endorsements = relation(Endorsement.mapper, lazy=True, private=True) > )) > ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users