def onUpdateSqlLayer(self): l = self.iface.activeLayer() if l.dataProvider().name() in ['postgres', 'spatialite', 'oracle']: table = QgsDataSourceUri(l.source()).table() if table.startswith('(') and table.endswith(')'): self.run() self.dlg.runSqlLayerWindow(l)