hi.

i'm trying to join two tables in sqlalchemy for a query, and having an
issue.

from what I understand , it seems that the SQL which is generated is
fine ( and it does run if i 'print' and substitute in variables ) --
the problem is that due to my structuring of how I handle date ranges,
the values are never passed into the query during execution.  I just
have placeholder binders.

I'm wondering if someone can offer a suggestion has to how to re-
organize or re-approach this code into something that works.


the production code, is :


        dates= []
        if date_start:
            dates.append( (self.__class__).timestamp_registered >=
date_start )
        if date_end:
            dates.append( (self.__class__).timestamp_registered <=
date_end )
        if sql_and:
            dates.append( sql_and )
        if dates :
            dates= sqlalchemy.sql.and_( *dates )
        sql= sqlalchemy.select( \
            [
                (self.__class__)._osn_table_sa_stash.name+'.id',
                'nickname',
                'osn_email_address_id',
                'email_address',
                'timestamp_registered',
            ],
            dates,
            from_obj=[
 
(self.__class__)._osn_table_sa_stash.outerjoin( 
OpenSocialNetwork.model.get_osn_compatibility_class( 
'email_options.osn_email_address' )._osn_table_sa_stash )
            ],
            order_by=[(self.__class__)._osn_table_sa_stash.name
+'.id'],


This looks a little hairy, as its from a microframework... so just to
explain:

def
OpenSocialNetwork.model.get_osn_compatibility_class( "module.table" ):
     """returns the correct class for the microframework, in case a
classname was overrideen"""

class SqlAlchemyObject(object):
    _osn_table_sa_stash= None # during reflection, a link to the table
is placed here

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.

Reply via email to