I'm having issues with sqlite and DateTime objects with a timezone attached (python 2.5, SQA 0.3.6, pysqlite-2.3.3, OS X) crashing, but the code works with postgres. I get the same issue with Python 2.4.
Given the test code below, with postgres I get ##### Via object 1970-01-01 06:30:34+00:00 ##### Via dict 1970-01-01 07:30:34+01:00 But sqlite crashes: ##### Via object 1970-01-01 06:30:34+00:00 ##### Via dict Traceback (most recent call last): File "test.py", line 40, in <module> print t.ts File "build/bdist.macosx-10.3-fat/egg/sqlalchemy/engine/base.py", line 1097, in __getattr__ File "build/bdist.macosx-10.3-fat/egg/sqlalchemy/engine/base.py", line 917, in _get_col File "build/bdist.macosx-10.3-fat/egg/sqlalchemy/databases/ sqlite.py", line 65, in convert_result_value File "build/bdist.macosx-10.3-fat/egg/sqlalchemy/databases/ sqlite.py", line 58, in _cvt File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/_strptime.py", line 313, in strptime data_string[found.end():]) ValueError: unconverted data remains: +00:00 Code below: import pytz from datetime import datetime from sqlalchemy import * from sqlalchemy.ext.activemapper import metadata TZ = pytz.timezone('UTC') test_table = Table("testing", metadata, Column("id", Integer, primary_key=True), Column("ts", DateTime(timezone=True)), ) class TestingObject(object): def __init__(self, ts): self.ts = ts mapper(TestingObject, test_table) db = create_engine('sqlite:///') metadata.connect(db) metadata.create_all() session = create_session() t = TestingObject(ts=datetime.fromtimestamp(23434, TZ)) session.save(t) session.flush() print '##### Via object' t2 = session.query(TestingObject).select()[0] print t2.ts print '##### Via dict' d = { 'ts' : datetime.fromtimestamp(23434, TZ)} test_table.insert(d).execute() t = test_table.select(test_table.c.id==2).execute().fetchone() print t.ts -- Arthur Clune "Anyone who says they understand TCP/IP, doesn't" - Van Jacobsen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---