On Sat, Oct 10, 2009 at 01:14:56PM -0700, Adrian Klaver wrote:
> sql_str = "ALTER TABLE " + $xn + " OWNER TO xdev;"
> sql_str += "GRANT ALL ON TABLE " + $xn + " TO xdev;"
> sql_str += "REVOKE ALL ON TABLE " + $xn + " FROM PUBLIC;"
> sql_str += "GRANT SELECT ON TABLE " + $xn + " TO PUBLIC;"
One minor stylistic point. Python appears to follow the same string
literal rules as C in that multiple adjacent string literals are
concatenated at compile time[1]. Thus you could write the above as:
sql_str = (
"ALTER TABLE " + $xn + " OWNER TO xdev;"
"GRANT ALL ON TABLE " + $xn + " TO xdev;"
"REVOKE ALL ON TABLE " + $xn + " FROM PUBLIC;"
"GRANT SELECT ON TABLE " + $xn + " TO PUBLIC;"
);
This wouldn't help much here, but may in more complicated bits of code.
--
Sam http://samason.me.uk/
[1] http://docs.python.org/reference/lexical_analysis.html#string-literal-concatenation