TransWikia.com

How to link SQL file with relative path in Processing Scripts

Geographic Information Systems Asked by Nil on December 17, 2020

I wrote a processing tool, which exports some tables from PostGIS to package, and as part of the export, I am calling an external SQL file to add some triggers, etc. The SQL file is located as my script (C:UsersXXXXAppDataRoamingQGISQGIS3profilesdefaultprocessingscripts)

Currently, I linked the SQL file as follows.

path_to_sql = str(Path.home()) + "AppDataRoamingQGISQGIS3profilesdefaultprocessingscriptsbwk.sql"
sql_file = open(path_to_sql)code here

But I was wondering, why it does not work when I wrote path_to_sql = "bwk.sql" or path_to_sql ="bwk.sql" (No such file or directory: ‘bwk.sql’)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP