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

Anton Shishkov anton.shishkov at gmail.com
Wed Mar 31 04:42:41 EDT 2010


On Mar 31, 3:10 am, "D'Arcy J.M. Cain" <da... at druid.net> wrote:
> On Tue, 30 Mar 2010 15:46:12 -0700 (PDT)
>
> ASh <anton.shish... at gmail.com> wrote:
> > > >             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"))
>
> > > Put single quotes around the first %s in the query.
>
> > Tried like you said, got this error:
>
> > psycopg2.ProgrammingError: syntax error at or near "NOW"
> > LINE 1: update orderdb.orders set creation_date = 'E'NOW() - ''29
> > da...
>
> Right.  I misread it.  Please show us the exact error that you get with
> the original code.
>
> --
> D'Arcy J.M. Cain <da... at druid.net>         |  Democracy is three wolveshttp://www.druid.net/darcy/               |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

Error:
    cursor.execute(sql, params)
  File "/opt/local/lib/python2.5/site-packages/psycopg2/extras.py",
line 118, in execute
    return _cursor.execute(self, query, vars, async)
psycopg2.ProgrammingError: syntax error at or near "NOW"
LINE 1: update orderdb.orders set creation_date = 'E'NOW() - ''29
da...
                                                     ^



More information about the Python-list mailing list