Search Postgresql Archives

psycopg problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to use psycopg2 to create tables in a database using:

run = "S90040"
curs.execute("create table %s (date text, tset text)",(run,))

but it fails with

Traceback (most recent call last):
  File "write_xy_to_pg_psyco.py", line 44, in ?
    curs.execute("create table %s (date text, tset text)",(run,))
psycopg2.ProgrammingError: syntax error at or near "'S90040'" at
  character 14

If I run

curs.execute("create table S90040 (date text, tset text)",(run,))

it works perfectly, so I assume the quoting is messed up.

Could someone please tell me what I'm doing wrong?

Thanks,

Roger Mason


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux