This works perfectly fine with an Oracle TABLE but not with a VIEW. Why?
uri = QgsDataSourceURI()uri.setConnection(host, port, db, username, pw)uri.setWkbType(QGis.WKBPolygon)uri.setDataSource(schema, table, geomcol)vlayer = QgsVectorLayer(uri.uri(), table, 'oracle')print vlayer.isValid()..and...