Re: cannot insert a timestamp
James Henstridge <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 10, 2009 at 7:34 AM, Al Niessner <[email protected]> wrote: > > self.__cursor.execute (command, value) > > Building up the command to match the dictionary 'value' is pretty > complicated because it handles more than one table. However it is the > usual building a string thing. Plus all the same code works with psycopg > v1. To switch between them, I just change the import and yank the _o > from the timestamp. No other changes are required. I don't see these problems locally. Are you adding extra quotes in your query by any chance? >>> import psycopg2 >>> conn = psycopg2.connect(database='template1') >>> cursor = conn.cursor() >>> cursor.execute("SELECT %s", (psycopg2.TimestampFromTicks(42),)) >>> cursor.fetchone() ('1970-01-01T08:00:42+08:00',) James.