psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone:

Philip Semanchuk philip at semanchuk.com
Tue Mar 30 17:26:51 EDT 2010


On Mar 30, 2010, at 4:47 PM, ASh wrote:

> Hi, please help me understand why am I getting error with this query
>
>
>            new_start_date = "NOW() - '29 days'::INTERVAL"
>            self.dyndb.orderdb.query('''update xxxx set creation_date
> = %s
>            where id_order = %s''', (new_start_date, "123"))
>
>
>
> ...
> psycopg2.DataError: invalid input syntax for type timestamp with time
> zone: "NOW() - '29 days'::INTERVAL"

Hi Anton,
It sounds to me like the problem is with your SQL rather than with  
psycopg2 or Python. Try the query directly in Postgres -- does it work  
there? If so, then your next step should be to ask on the psycopg2  
mailing list that Google can find for you.

Good luck
Philip




More information about the Python-list mailing list