let me simplify this , maybe it'll make sense to someone presented differently:
# do we need to restrict this within a date range ? dates= [] if date_start: dates.append( class_a.timestamp_registered >= date_start ) if date_end: dates.append( class_a.timestamp_registered <= date_end ) if sql_and: dates.append( sql_and ) if dates : dates= sqlalchemy.sql.and_( *dates ) # generate the sql sql= sqlalchemy.select( \ [ class_a_table.name+'.id', 'nickname', 'email_address_id', 'email_address', 'timestamp_registered', ], dates, from_obj=[ class_a._osn_table_sa_stash.outerjoin( class_b_table ) ], order_by=[ class_b_table.name +'.id'], ) Variables used: class_a - mapped class class_a_table - reference to table class_a mapped to class_b_table - reference to table class_b mapped to -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.