Re: problem creating users via pythons script

From: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
To: Timothy Smith <timothy(at)open-networks(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem creating users via pythons script
Date: 2006-07-19 12:13:25
Message-ID: 20060719121325.GB1367@alamut.tdm.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jul 19 10:02, Timothy Smith wrote:
> cur.execute("""CREATE USER %s WITH PASSWORD %s IN GROUP %s
> """,(StaffUserName,NewPassword,StaffGroup))
>
> produces this error
>
> ERROR: syntax error at or near "'bob.smith'" at character 13

IIRC, per Python DB-API PEP, the DB adapter you use try to escape and
quote any parameter you specified. Please try to use python parameters,
that are "% (param1, param2, ...)", only for values; not for any other
place in the query string.

To summarize, you can only use parameters for values, not keys.

Regards.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2006-07-19 12:45:06 User can not more login
Previous Message Christian Rengstl 2006-07-19 12:03:31 Re: Performance problem with query