Is it possible to load pure sqlite 2.0 (without spatial extension) table into qgis using python? I would like to get the same result as in the case of using Add Vector Layer -> All files. I have already modified this example http://www.qgis.org/pyqgis-cookbook/loadlayer.html but it doesn't work in my case. Can someone help me? I use in the python console this code:
>>> db = r'c:\Program Files (x86)\Quantum GIS Lisboa\data\base.db'
>>> uri = QgsDataSourceURI()
>>> uri.setDatabase(db)
>>> schema = ''
>>> table = 'table'
>>> geom_column = ''
>>> uri.setDataSource(schema, table, geom_column)
>>> display_name = 'table'
>>> vlayer = QgsVectorLayer(uri.uri(), display_name, 'sqlite')
>>> QgsMapLayerRegistry.instance().addMapLayer(vlayer)
<qgis.core.QgsVectorLayer object at 0x0CFA08A0>
i also tried with 'spatialite' in vlayer. When I use Add vector layer i can see result table in the TOC. Using this code I can't display table in table of contents. I think the reason of my trouble is trivial, but I have no idea what I should do to see my table
pathLayer = 'c: +\database.db|layername=layer1' vlayer = QgsVectorLayer(pathLayer, 'layer1', 'ogr') QgsMapLayerRegistry.instance().addMapLayer(vlayer)
i can add one table. Using Uri I have never get a result. Hot to set parameters of connection for geometryless table?