mxDateTimes are not supported by the SA datetime objects....any reason you cant use datetime.datetime ?

On May 21, 2006, at 4:18 AM, Alex Greif wrote:

The following code works on windows but crashes on linux. It uses SA 0.1.7.
I am not sure whether the first import line makes problems, but as I
said it works fine on windows. Both running Python-2.4.2

any help is appreciated

Alex.


#######  code  ###########

import mx.DateTime.DateTime as mxDateTime
from sqlalchemy import *

e = create_engine("postgres://database=test", echo=True)

test = Table("test", e,
              Column("id", Integer, primary_key=True),
              Column("date", Date),
              Column("last_entry", Time),
            )
class Test(object):
     pass
Test.mapper = mapper(Test, test)

try:
 test.drop()
except:
 pass
test.create()

t = Test()
t.date = mxDateTime(2004,12,30)
t.last_entry = mxDateTime(2004,12,31,23,55,56.345)

objectstore.flush()



#######  error message  ########

[2006-05-21 10:14:06,398] [engine]:
DROP TABLE test
[2006-05-21 10:14:06,398] [engine]: None
[2006-05-21 10:14:06,431] [engine]:
CREATE TABLE test(
       id SERIAL NOT NULL PRIMARY KEY,
       date DATE,
       last_entry TIME
)


[2006-05-21 10:14:06,431] [engine]: None
[2006-05-21 10:14:06,505] [engine]: select nextval('test_id_seq')
[2006-05-21 10:14:06,505] [engine]: None
[2006-05-21 10:14:06,509] [engine]: INSERT INTO test (id, date,
last_entry) VALUES (%(id)s, %(date)s, %(last_entry)s)
[2006-05-21 10:14:06,509] [engine]: {'date': <DateTime object for
'2004-12-30 00:00:00.00' at 40232598>, 'last_entry': <DateTime object
for '2004-12-31 23:55:56.34' at 404c6250>, 'id': 1L}
Traceback (most recent call last):
 File "test2.py", line 25, in ?
   objectstore.flush()
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/objectstore.py",
line 260, in flush
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/objectstore.py",
line 81, in flush
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/unitofwork.py",
line 249, in flush
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/unitofwork.py",
line 374, in execute
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/unitofwork.py",
line 527, in execute
 File "build/bdist.linux-i686/egg/sqlalchemy/mapping/mapper.py", line
616, in save_obj
File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 473, in execute File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 378, in execute File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 355, in execute
 File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 646, in
execute_compiled
File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 641, in proxy File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 692, in execute File "build/bdist.linux-i686/egg/sqlalchemy/engine.py", line 712, in _execute
sqlalchemy.exceptions.SQLError: (ProgrammingError) can't adapt 'INSERT
INTO test (id, date, last_entry) VALUES (%(id)s, %(date)s,
%(last_entry)s)' {'date': <DateTime object for '2004-12-30
00:00:00.00' at 40232598>, 'last_entry': <DateTime object for
'2004-12-31 23:55:56.34' at 404c6250>, 'id': 1L}


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to