cannot insert a timestamp
Al Niessner <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <1244583759.3982.20.camel@charon> |
I have been using psycopg v1 for a little why and am trying to
transition my code to 2.0.8 (the version that synaptic grabs in Ubuntu
Jaunty). The timestamp stuff is kill me though.
So, here is what happens:
import psycopg2 as dbapi
atime = os.path.getatime ("some.file")
ts = dbapi.TimestampFromTicks (atime)
then I insert ts into the table and get this:
psycopg2.ProgrammingError: syntax error at or near "2009"
LINE 1: ...cation (rlid, atime, mtime, location) values
(1,''2009-06-09...
^
if I then print out ts, I get a double quoted string like:
"'2009-06-09 14:37:00-0700'". The double quotes does not seem right, so
I am posting here. I tried using ts.adapted and get the same result.
If I change things up a bit and do
import psycopg as dbapi
atime = os.path.getatime ("some.file")
ts = dbapi.TimestampFromTicks (atime)._o
then everything works fine.
In conclusion, can anyone show me what I am doing wrong? If desired, I
can write up a script that shows this problem fairly quickly. Until I
get a solution or work around, I guess I will be staying with version 1
something.
Thanks in advance for any help.
--
Al Niessner
I have never found the companion that was so companionable as solitude.
- From Walden by Henry David Thoreau
The universe is indifferent, and life is brutal; however, it is man's
choice of behavior that makes them malevolent rather than benevolent.
Some will fall in love with life and drink it from a fountain
That is pouring like an avalanche coming down the mountain.
- From the song Pepper by the Butthole Surfers