[postgis-users] How to sql scripts in a file?

John Zhang johnzhang06 at gmail.com
Thu Apr 23 05:42:46 PDT 2020


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200423/2493465c/attachment.html>


More information about the postgis-users mailing list