@@ -91,7 +91,8 @@ def connect(self, parent=None):
91
91
uri = QgsDataSourceUri ()
92
92
93
93
settingsList = ["host" , "port" , "database" , "username" , "password" ]
94
- host , port , database , username , password = [settings .value (x , "" , type = str ) for x in settingsList ]
94
+ host , port , database , username , password = [
95
+ settings .value (x , "" , type = str ) for x in settingsList ]
95
96
96
97
# get all of the connexion options
97
98
@@ -202,7 +203,8 @@ def toSqlLayer(self, sql, geomCol, uniqueCol,
202
203
uri = self .uri ()
203
204
con = self .database ().connector
204
205
205
- uri .setDataSource (u"" , u"({}\n )" .format (sql ), geomCol , filter , uniqueCol .strip (u'"' ))
206
+ uri .setDataSource (u"" , u"({}\n )" .format (
207
+ sql ), geomCol , filter , uniqueCol .strip (u'"' ))
206
208
if avoidSelectById :
207
209
uri .disableSelectAtId (True )
208
210
provider = self .dbplugin ().providerName ()
@@ -403,18 +405,18 @@ def getValidQgisUniqueFields(self, onlyOne=False):
403
405
for idx in indexes :
404
406
if idx .isUnique and len (idx .columns ) == 1 :
405
407
fld = idx .fields ()[idx .columns [0 ]]
406
- if (fld .dataType == u"NUMBER"
407
- and not fld .modifier
408
- and fld .notNull
409
- and fld not in ret ):
408
+ if (fld .dataType == u"NUMBER" and
409
+ not fld .modifier and
410
+ fld .notNull and
411
+ fld not in ret ):
410
412
ret .append (fld )
411
413
412
414
# and finally append the other suitable fields
413
415
for fld in self .fields ():
414
- if (fld .dataType == u"NUMBER"
415
- and not fld .modifier
416
- and fld .notNull
417
- and fld not in ret ):
416
+ if (fld .dataType == u"NUMBER" and
417
+ not fld .modifier and
418
+ fld .notNull and
419
+ fld not in ret ):
418
420
ret .append (fld )
419
421
420
422
if onlyOne :
@@ -514,14 +516,14 @@ def __init__(self, row, table):
514
516
515
517
# find out whether fields are part of primary key
516
518
for con in self .table ().constraints ():
517
- if (con .type == ORTableConstraint .TypePrimaryKey
518
- and self .name == con .column ):
519
+ if (con .type == ORTableConstraint .TypePrimaryKey and
520
+ self .name == con .column ):
519
521
self .primaryKey = True
520
522
break
521
523
522
524
def type2String (self ):
523
- if (u"TIMESTAMP" in self .dataType
524
- or self .dataType in [u"DATE" , u"SDO_GEOMETRY" ,
525
+ if (u"TIMESTAMP" in self .dataType or
526
+ self .dataType in [u"DATE" , u"SDO_GEOMETRY" ,
525
527
u"BINARY_FLOAT" , u"BINARY_DOUBLE" ]):
526
528
return u"{}" .format (self .dataType )
527
529
if self .charMaxLen in [None , - 1 ]:
0 commit comments