I'm trying to write a simple Python script to load data stored in MSSQL to PostGIS. Idea is to load processing in QGIS and then run "importintopostgis" geoalgorithm : "Import into Postgis" from python, since layers in MSSQL don't change:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import processing
processing.runalg("qgis:importintopostgis"....
processing.runalg("qgis:importintopostgis"...
For some of the layers it actually works ok, till i stumble to one of the layers that returns:
Error importing to PostGIS Feature write errors: Creation error for features from #0 to #0. Provider errors was: PostGIS error while adding features: ERROR: Geometry type (MultiLineString) does not match column type (LineString) Only 88794 of 88994 features written.
I'm assuming that plugin assumes that geometry is Linestring when reading few lines, creates table with linestring geo feature and then stumbles on multilinestring.
Can't find a way to correct that any idea ?
The other possibility I found was to use OGR import from python with:
processing.runalg("gdalogr:importvectorintopostgisdatabaseavailableconnections",1,"dbname=
This one crashes with message:
'NoneType' object has no attribute 'groups' See log for more details
I can't find error log in "History and log" window.
I think now I'm stuck. Any Idea how to solve this problem ? ETL tool, some other script etc.