Search Postgresql Archives

executing a sql script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using python and can execute standard "select,update,delete,functions".  
What I'd like to do is execute a sql script (a text file).  But I don't know 
how?
Some thing like:
 import psycopg2
 import psycopg2.extensions
        conn = psycopg2.connect("host=%s dbname=%s user =%s  password 
=%s " %(self.pgSqlHostID.Value,self.pgSqlDatabaseID.Value,self.pgSqlUserID.Value,self.msSqlPasswordID.Value))
        
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
        tempCursor= conn.cursor()
        try:
            tempCursor.execute("run script %s " % FileNameScript)
            tempCursor.execute('commit')
-- 
John Fabiani

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux