[sqlalchemy] Re: simple DateTime select

2007-04-07 Thread Michael Bayer
FYI the comparisons to a DateTime column are better done against a similar datetime() object, rather than a string - select(table.c.date_col < datetime.datetime(2007, 10, 19, 10, 23, 54)) On Apr 7, 2007, at 11:44 PM, rkennedy wrote: > > Hi Matthew, > > Your assessment was spot on. Apparently

[sqlalchemy] Re: simple DateTime select

2007-04-07 Thread rkennedy
Hi Matthew, Your assessment was spot on. Apparently the start_time field also needed an explicit reference to the database table import. The following query now does the trick... events = self.sess.query(model.Event).select_by(model.Event.c.start_time < '2007-10-19 10:23:54') Thanks again for y

[sqlalchemy] Re: simple DateTime select

2007-04-07 Thread desmaj
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 produce

[sqlalchemy] Re: simple DateTime select

2007-04-07 Thread rkennedy
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" When I

[sqlalchemy] Re: simple DateTime select

2007-04-07 Thread desmaj
Hi Ryan, On Apr 7, 6:10 pm, "rkennedy" <[EMAIL PROTECTED]> wrote: > I'm new to SQLAlchemy and am trying to select objects from the > following table that occurred before a specified date. I'm pretty new myself, but I've been reading the docs a bunch today and I may be able to help. > event_tabl