We have 100's of shapefiles for which we have to generate excel reports based on few (combination of) parameters in the attribute table. I am using SQL query to achieve this and when i run the query in the "Create Virtual layer" process, it works fine and the output has been generated, which will be saved as an excel file. Instead of this process, i am trying to run this through python console. Though the code didn't show any error, the output is not being printed. Do i have to change the SQL query format in the code ?
Image 1: For the shapefile final_bdry, Total_Area has to be calculated based on two other columns - MS_Area, Ground_Con (similar to Pivot_Table in excel, sum of a column based on unique count of other two columns). No issues with the query and i am getting the desired output in the virtual_layer. .
Image 2: But, if i run the same query within python console, result is "None" Ref: Used this as ref SQL queries in shapefiles using python/gdal return none result