psycopg problem

From: Roger Mason <rmason(at)esd(dot)mun(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: psycopg problem
Date: 2006-08-10 10:27:20
Message-ID: y65lkpwdgxj.fsf@minnie.esd.mun.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Volkan YAZICI 2006-08-10 10:37:18 Re: psycopg problem
Previous Message Alban Hertroys 2006-08-10 09:46:43 Re: Tuning to speed select