I'd probably have to make in_() use bind parameters, which I probably
should do anyway. then all the bind parameter stuff will handle the
typing issues.
Robert Leftwich wrote:
> in_() doesn't appear to work with dates, should it? Adding the following
> to
> testin() test/select.py from rev 713, fails with an error as shown below:
>
> # test dates
> import datetime
> entries = Table('myentries', db,
> Column('myid', Integer, key = 'id'),
> Column('name', String, key = 'name'),
> Column('description', String, key = 'description'),
> Column('entrydate', DateTime),
> )
> dates = [datetime.datetime(2005,12,i) for i in range(1,6)]
> dateStrings = tuple([str(d) for d in dates])
> self.runtest(select([entries], entries.c.entrydate.in_(*dates)),
> "SELECT myentries.myid, myentries.name, myentries.description,
> myentries.entrydate FROM myentries WHERE myentries.entrydate IN %s"
> %dateStrings)
>
> ======================================================================
> ERROR: testin (__main__.SelectTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/robert/tools/python/sqlalchemy/test/select.py", line 400,
> in testin
> self.runtest(select([entries], entries.c.entrydate.in_(*dates)),
> File "../../lib/sqlalchemy/sql.py", line 394, in in_
> File "../../lib/sqlalchemy/sql.py", line 475, in __init__
> File "/usr/lib/python2.4/sre.py", line 142, in sub
> return _compile(pattern, 0).sub(repl, string, count)
> TypeError: expected string or buffer
>
>
> Robert
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users