Skip to content
Permalink
Browse files

[processing] fixes for 'import into PostGIS' alg

fixes #15097
  • Loading branch information
volaya committed Oct 17, 2016
1 parent 61a10df commit e58177cf9e360021618d6029821cbc8416496cff
Showing with 3 additions and 5 deletions.
  1. +3 −5 python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
@@ -94,7 +94,7 @@ def processAlgorithm(self, progress):
convertLowerCase = self.getParameterValue(self.LOWERCASE_NAMES)
dropStringLength = self.getParameterValue(self.DROP_STRING_LENGTH)
forceSinglePart = self.getParameterValue(self.FORCE_SINGLEPART)
primaryKeyField = self.getParameterValue(self.PRIMARY_KEY)
primaryKeyField = self.getParameterValue(self.PRIMARY_KEY) or 'id'
encoding = self.getParameterValue(self.ENCODING)

layerUri = self.getParameterValue(self.INPUT)
@@ -103,6 +103,7 @@ def processAlgorithm(self, progress):
table = self.getParameterValue(self.TABLENAME).strip()
if table == '':
table = layer.name()
table = "_".join(table.split(".")[:-1])
table = table.replace(' ', '').lower()[0:62]
providerName = 'postgres'

@@ -126,10 +127,7 @@ def processAlgorithm(self, progress):
geomColumn = None

uri = db.uri
if primaryKeyField:
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
else:
uri.setDataSource(schema, table, geomColumn, '')
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)

if encoding:
layer.setProviderEncoding(encoding)

0 comments on commit e58177c

Please sign in to comment.
You can’t perform that action at this time.