From: Timothy S. <ti...@op...> - 2005-01-13 00:51:55
|
Karsten Hilbert wrote: >>>>i'm wondering why i get the following error witht he code below >>>>i'm guessing it's probably somethign very simple i'm goign wrong, most >>>>likely to do with my new line escapes \ >>>>if there is a better way of formatting my query to fix this i'm all ears. >>>> >>>> >>>> >>>> >>>consider using >>> >>>query = """ >>>... any formatting you want >>>""" >>> >>>No \ needed. >>> >>>Karsten >>> >>> >>> >>> >>ok i did that b ut i still get the error >> >>cur.execute("""CREATE OR REPLACE FUNCTION week_num ( date ) >> File "/usr/local/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line >>3072, in execute >> raise OperationalError, msg >>libpq.OperationalError: ERROR: syntax error at or near "20040701" at >>character 92 >> >> >The error seems to be in the first function declaration. In >there you have the %s *inside* the actual function body. I >doubt that pyPgSQL knows about the proper quoting rules for >that case, eg quotes need to be doubled at least, even tripled >or quadrupled in some special cases. > >Karsten > > your right, it needed '%s' |