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.
I am porting some code from Perl to Python; in the Perl original I use
either DBI::do or a rickety home-built module to pass multiple SQL
statements (as one single block of SQL) to the Pg server. The typical usage
is something like this:
$dbh-do( EOSQL );
ALTER TABLE $xn OWNER TO xdev;
GRANT ALL
On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote:
I am porting some code from Perl to Python; in the Perl original I use
either DBI::do or a rickety home-built module to pass multiple SQL
statements (as one single block of SQL) to the Pg server. The typical
usage is something like
On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote:
On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote:
I am porting some code from Perl to Python; in the Perl original I use
either DBI::do or a rickety home-built module to pass multiple SQL
statements (as one single block of
On Sat, Oct 10, 2009 at 4:14 PM, Adrian Klaver akla...@comcast.net wrote:
On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote:
On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote:
I am porting some code from Perl to Python; in the Perl original I use
either DBI::do or a
On Sat, 10 Oct 2009, Adrian Klaver wrote:
One way
Using psycopg2
DSN = dbname=? user=? port=? host=?
con = psycopg2.connection(DSN)
cur = con.cursor()
cur.execute(statement1)
cur.execute(statement2)
con.commit()
Another way, not tested, is triple quote entire block above and pass it to
On Saturday 10 October 2009 1:24:05 pm Kynn Jones wrote:
On Sat, Oct 10, 2009 at 4:14 PM, Adrian Klaver akla...@comcast.net wrote:
On Saturday 10 October 2009 12:27:39 pm Adrian Klaver wrote:
On Saturday 10 October 2009 12:09:29 pm Kynn Jones wrote:
I am porting some code from Perl to
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
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