Hi Noli, <div><br></div><div>you could use this [1] (sorry, it's in Spanish). It uses the Sqlite3 Python module [2].</div><div><br></div><div>Regards, </div><div><br></div><div>Germán</div><div><br></div><div>----------------------------</div>
<div>[1] <a href="http://geotux.tuxfamily.org/index.php?option=com_myblog&task=view&id=251&Itemid=59">http://geotux.tuxfamily.org/index.php?option=com_myblog&task=view&id=251&Itemid=59</a></div><div>
[2] <a href="http://docs.python.org/library/sqlite3.html">http://docs.python.org/library/sqlite3.html</a><br><br><div class="gmail_quote">On Fri, Sep 10, 2010 at 9:49 AM, Noli Sicad <span dir="ltr"><<a href="mailto:nsicad@gmail.com">nsicad@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
Given, this example from PyQGIS documentation.<br>
<br>
~~~~~~~~<br>
uri = QgsDataSourceURI()<br>
uri.setDatabase('/home/martin/test-2.3.sqlite')<br>
uri.setDataSource('','Towns', 'Geometry')<br>
<br>
layer = QgsVectorLayer(uri.uri(), 'Towns', 'spatialite')<br>
~~~~~~~~~<br>
<br>
How do you do a runtime for the above. I want to select the table /<br>
layer to load. How you figure out the uri.setDataSource('',' ',<br>
'Geometry') and QgsVectorLayer(uri.uri(), ' ', 'Spatialite')?<br>
<br>
~~~~~~~~<br>
file = QFileDialog.getOpenFileName(self,"Open Spatialite", ".",<br>
"Spatialite (*.sqlite)")<br>
fileInfo = QFileInfo(file)<br>
<br>
uri = QgsDataSourceURI()<br>
uri.setDatabase(file)<br>
uri.setDataSource('',' ', 'Geometry')<br>
<br>
# Add the layer<br>
layer = QgsVectorLayer(uri.uri(), ' ', 'Spatialite')<br>
<br>
~~~~~~~~~<br>
<br>
Noli<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>-----------<br> |\__ <br>(:>__)(<br> |/ <br><br>Soluciones Geoinformáticas Libres <br><a href="http://geotux.tuxfamily.org/">http://geotux.tuxfamily.org/</a><br>
</div>