Hi Ryan, On Apr 7, 8:44 pm, "rkennedy" <[EMAIL PROTECTED]> wrote: > Thanks, Matthew. > > Looks like SA is still complaining about the global name not being > defined. > > > event = self.sess.query(model.Event).get_by(event_table.c.start_time < > > '2007-10-19 10:23:54') > > The above code produces a similar error... > "NameError: global name 'event_table' is not defined"
Does the above code have access to your event table definition? That looks to me like Python can't find event table. I don't think SA has even gotten to it yet. Make sure that you've made the necessary imports to get event_table into the local namspace. > When I try retrieving objects that occurred on a specific date, > e.g.... > > event = self.sess.query(model.Event).get_by(start_time='2006-10-19 > 10:23:54') > > ..everything checks out ok. Perhaps it has something to do with the > way the operator is being used? When you use the "start_time=..." form above, you are passing a keyword argument to the get_by method. The start_time name is used inside get_by and so it doesn't need to exist outside. When you use the "start_time==..." form, I think that you'll find that you will get the same NameError that you got when you tried "start_time<...". Regards, Matthew --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---