SQLite itself stores the value as a string, as it has no "datetime"
type. you can, in fact, specify whatever goofy type you want with
SQLite and most of it just goes in as a string.
when I run the DateTime unit test with sqlite3 (not 2):
python test/query.py QueryTest.testselectdate
I get a DateTime back. this is because the SLDateTime type in
SQLAlchemy is converting the string from SQLite into a date.
Are you looking at the datetime value directly in the database? or
are you selecting with SQLAlchemy and not getting a datetime back?
What does that unit test give you?
I also just checked in an assertion for it:
self.assert_(l ==
[(7, u'jack', datetime.datetime(2005, 11, 10, 0,
0)), (8, u'roy', datetime.datetime(2005, 11, 10, 11, 52, 35)), (9,
u'foo', datetime.datetime(2005, 11, 10, 11, 52, 35, 54839)), (10,
u'colber', None)]
)
On Dec 18, 2005, at 11:51 PM, limodou wrote:
In my table metadata, I defined a DateTime column, and as I insert a
new record to database, I pass it a datetime object. But as I get it
from the database, it becomes a unicode string(I use sqlite2). It
seems that the datetime type can not be converted automatically.
Should I do this job myself?
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit
-------------------------------------------------------
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_idv37&alloc_id865&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_idv37&alloc_id865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users