[Qgis-user] Accessing Spatialite 3.0.1 in QGIS 1.8 using Python Console

gene martin.laloux at gmail.com
Sat Jul 7 07:33:30 PDT 2012


The sqlite module of Python does not enable "_load_extension"
You must use the "old" pysqlite2 compiled with "enable_load_extension " =
true (in the cfg file)
and

    from pysqlite2 import dbapi2 as sqlite
    db = sqlite.connect('test.db3')
    db.enable_load_extension(True);
    db.execute('SELECT load_extension("/path to/libspatialite.dylib (Mac OS
X), or libspatialite.so (Linux),  libspatialite.dll (Windows)")')
<pysqlite2.dbapi2.Cursor object at 0x100511960>
    rs = cur.execute('SELECT sqlite_version(), spatialite_version()')
    for row in rs:
         msg = "> SQLite v%s Spatialite v%s" % (row[0], row[1])
         print msg
 SQLite v3.7.11 Spatialite v3.0.1



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Accessing-Spatialite-3-0-1-in-QGIS-1-8-using-Python-Console-tp4986619p4986682.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.



More information about the Qgis-user mailing list