How to sql scripts in a file? - Mailing list pgsql-sql

From John Zhang
Subject How to sql scripts in a file?
Date
Msg-id CAKDSG9AULGW-rdC9_KArVm2D=GPmcUce+n0kAFSDKfWtqVGnmA@mail.gmail.com
Whole thread Raw
Responses Re: [postgis-users] How to sql scripts in a file?  (Giuseppe Broccolo <g.broccolo.7@gmail.com>)
List pgsql-sql
Hello all,

I have a need to execute sql scripts in a file with comments in Python 2.7. 
here is m code snippet:

sqlF = r'{}\{}'.format(sFldr_sql,sSQLFile)
sql_file_contents = open(sqlF,'r').read()
cur.execute(sql_file_contents)
 
the file can be executed from pgAdmin successfully. However, the code above runs quietly without any issues raised but NO results was worked out.

In the sql file, there are scripts to DROP FUNCTION  IF EXISTS and CREATE OR REPLACE FUNCTION.

Your input to shed light on it would be much appreciated.

Thank you

--
Yours sincerely,


John Zhang


pgsql-sql by date:

Previous
From: Ashutosh Sharma
Date:
Subject: Re: FK constraint question
Next
From: Sándor Daku
Date:
Subject: Fwd: How to sql scripts in a file?