From: | Adrian Klaver <aklaver(at)comcast(dot)net> |
---|---|
To: | "Massa, Harald Armin" <chef(at)ghum(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org, Kynn Jones <kynnjo(at)gmail(dot)com> |
Subject: | Re: How to send multiple SQL commands from Python? |
Date: | 2009-10-11 01:27:08 |
Message-ID: | 200910101827.08786.aklaver@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Saturday 10 October 2009 5:48:39 pm Massa, Harald Armin wrote:
> Adrian,
>
> While I was walking the dog I thought of a better solution.
>
> > sql_str = """ALTER TABLE %(xn)s OWNER TO xdev;
> > GRANT ALL ON TABLE %(xn)s TO xdev;
> > REVOKE ALL ON TABLE %(xn)s FROM PUBLIC;
> > GRANT SELECT ON TABLE %(xn)s TO PUBLIC;"""
> >
> > cur.execute(sql_str,{'xn':table_name})
> > --
>
> This will not work.
>
> Because: "xn" will be escaped as "data", that is... the resulting string
> will be:
>
> ALTER TABLE E'waschbaer' ONER TO xdev;
>
> which obviously is not what you want.
Thanks for pointing that out.
--
Adrian Klaver
aklaver(at)comcast(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | justin | 2009-10-11 01:36:19 | Re: interface for "non-SQL people" |
Previous Message | Massa, Harald Armin | 2009-10-11 00:48:39 | Re: How to send multiple SQL commands from Python? |