Nicholas Wieland wrote:
def testRecord (self):
t = reflect.mapTable (self.engine, 'test')
r = reflect.getRecord (t, id = 1)
self.assertEqual (
[r.id, r.name, '%s' % r.date], [1, 'Nicholas', '1978-10-12
00:00:00,00'])
Anyway, I'll try to use datetime objects directly.
The mx.DateTime doco says about the format for DateTimeFromString " The format
used in text must adhere to the following ISO-style syntax:
[YYYY-MM-DD] [HH:MM[:SS]]
with the usual meanings."
Have you tried removing the ',00' on your input?
My setup always returns the time in the specified format, not a comma in sight.
psycopg.ProgrammingError: ERROR: invalid input syntax for type
timestamp: "1978-10-11 00:00:0,000000"
UPDATE test SET name='Nicholas', date='1978-10-11 00:00:0,000000'
WHERE test.id = '1'
Annoying, to say the least ... :)
The incriminated code is:
if isinstance (column.type, types.DateTime):
mxdt = DateTimeFromString (self.w [k].props.text)
setattr (self.record, column.name, mxdt)
else:
setattr (self.record, column.name, self.w [k].props.text)
objectstore.commit ()
The format psycopg expects is '1978-10-11 00:00:0.000000' (as always,
. insted of ,)
The thing that pisses me off is that I don't pass a generic "string"
to commit (), but a normal mx.DateTime :(
Suggestions ? I've tried quite everything, but I'm no expert ...
Do you actually need the time? If not, then use DateFromString(), which sets the
time to 0:00:00:00.
Have you tried checking/changing the locale that is currently active to see if
it is correct or you can change mx's behaviour?
From the Python doco:
"Applications typically start with a call of
import locale
locale.setlocale(locale.LC_ALL, '')
This sets the locale for all categories to the user's default setting (typically
specified in the LANG environment variable)."
print locale.setlocale(locale.LC_ALL, '')
will print the current locale.
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://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users