<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Thank you and sorry.<div>I have tried to connect to spatialite with this code, but this doesn´t add anything. Could you know why?</div><div><br></div><div><div><br></div><div><i>from PyQt4.QtCore import *</i></div><div><i>from PyQt4.QtGui import *</i></div><div><i>uri=QgsDataSourceURI()</i></div><div><i>uri.setDatabase('C:\Users\pr\Desktop\GIS.sqlite')</i></div><div><i>schema=' '</i></div><div><i>table ='ambi'</i></div><div><i>geom_column= 'geom'</i></div><div><i>uri.setDataSource(schema, table, geom_column)</i></div><div><i>display_name=('prueba')</i></div><div><i>vlayer=QgsVectorLayer(uri.uri(), display_name, 'spatialite')</i></div><div><br></div><div><br></div>Thanks</div><div><br></div><div><br><div><hr id="stopSpelling">Subject: Re: QGIS plugin with python<br>To: emiliosjlc@hotmail.com; qgis-user@lists.osgeo.org<br>From: wal3@mindspring.com<br>Date: Fri, 23 Oct 2015 09:29:13 -0400<br><br>
Emilio,<br>
<br>
Please reply to the QGIS users list so others will benefit from the
discussion. :)<br>
<br>
Your next reading would probably be the QT4 and PyQt4 documentation
for the SQL database classes. <br>
QT4 is the c++ version of the code. <br>
<br>
PyQt4 is the python wrappers around QT4.<br>
<br>
While you will be coding in python, the c++ documentation may be
helpful and clearer to read.<br>
<br>
Google has been my friend. :)<br>
<br>
Here are a few links to get you started.<br>
<br>
<a class="ecxmoz-txt-link-freetext" href="http://doc.qt.io/qt-4.8/sql-connecting.html" target="_blank">http://doc.qt.io/qt-4.8/sql-connecting.html</a><br>
<a class="ecxmoz-txt-link-freetext" href="http://pyqt.sourceforge.net/Docs/PyQt4/index.html" target="_blank">http://pyqt.sourceforge.net/Docs/PyQt4/index.html</a><br>
<a class="ecxmoz-txt-link-freetext" href="http://pyqt.sourceforge.net/Docs/PyQt4/qsqldatabase.html" target="_blank">http://pyqt.sourceforge.net/Docs/PyQt4/qsqldatabase.html</a><br>
<a class="ecxmoz-txt-link-freetext" href="http://stackoverflow.com/questions/7669987/what-is-the-correct-way-of-qsqldatabase-qsqlquery" target="_blank">http://stackoverflow.com/questions/7669987/what-is-the-correct-way-of-qsqldatabase-qsqlquery</a><br>
<br>
I'm sorry don't have an example available at the moment. I cannot
promise I'll find the time to put one together.<br>
<br>
<div class="ecxmoz-signature"><b>Worth Lutz</b><br>
<br>
<br>
</div>
<div class="ecxmoz-cite-prefix">On 10/23/2015 8:47 AM, Emilio S wrote:<br>
</div>
<blockquote cite="mid:DUB130-W616D0ABE46B295E91DAE55D2260@phx.gbl">
<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}
.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}
--></style>
<div dir="ltr">Thank you Worth Luz for your explanation. I have
started with this and I have read a lot, but do you know any
example to conect python with spatialite and do a SQL query?
<div><br>
</div>
<div>Thank you again</div>
</div>
</blockquote>
<br></div></div> </div></body>
</html>