[Osgeo4w-trac] [osgeo4w] #305: python/sqlite: "sqlite3-rtree-geometry-callback" not found in "C:\OSGeo4W\apps\Python27\DLLs\sqlite3.dll"

OSGeo4W trac_osgeo4w at osgeo.org
Thu Nov 8 11:11:22 PST 2012


#305: python/sqlite: "sqlite3-rtree-geometry-callback" not found in
"C:\OSGeo4W\apps\Python27\DLLs\sqlite3.dll"
--------------------+-------------------------------------------------------
Reporter:  hellik   |       Owner:  maphew                     
    Type:  defect   |      Status:  new                        
Priority:  blocker  |   Component:  Package                    
 Version:  1.0      |    Keywords:  python, python-core, sqlite
--------------------+-------------------------------------------------------

Comment(by hellik):

 Replying to [comment:40 jef]:
 > Replying to [comment:39 martinl]:
 > > so could be SQLite DLL library removed from the python package? It
 would be really nice to get rid of the problem...
 >
 > done.  The testing area is updated, please test ({{{osgeo4w-setup -t}}}
 or {{{setup-test.bat}}})

 complete fresh test-install by setup-test.bat in a new folder
 C:\OSGeo4Wtest, only wingrass7svn and dependencies installed.

 some testing (always in the ''OSGeo for Windows command shell'' and the
 ''Minimal SYStem''):

 testsqlite.py

 {{{
 import sys
 import sqlite3
 print sys.executable
 b = sqlite3.version
 print b
 c = sqlite3.sqlite_version
 print c
 }}}

 {{{
 myricaria at MYRICARIA-HP /c/tmp/test
 $ python testsqlite.py
 C:\OSGeo4Wtest\bin\python.exe
 2.6.0
 3.7.10
 }}}

 test-shapefile

 {{{
 $ ogrinfo -al test.shp
 INFO: Open of `test.shp'
       using driver `ESRI Shapefile' successful.

 Layer name: test
 Geometry: Point
 Feature Count: 3
 Extent: (11.360236, 47.562036) - (12.456152, 47.884962)
 Layer SRS WKT:
 GEOGCS["GCS_WGS_1984",
     DATUM["WGS_1984",
         SPHEROID["WGS_84",6378137.0,298.257223563]],
     PRIMEM["Greenwich",0.0],
     UNIT["Degree",0.0174532925199433]]
 Id: Integer (6.0)
 pname: String (3.0)
 OGRFeature(test):0
   Id (Integer) = 0
   pname (String) = a
   POINT (11.360236291910875 47.884962359602177)

 OGRFeature(test):1
   Id (Integer) = 0
   pname (String) = b
   POINT (12.456151953403253 47.882419631849288)

 OGRFeature(test):2
   Id (Integer) = 0
   pname (String) = c
   POINT (11.812841831923969 47.562035934986092)
 }}}

 ogr2ogr test-shapefile to a sqlite-db

 {{{
 myricaria at MYRICARIA-HP /c/tmp/test
 $ ogr2ogr -f "SQLite" shape2sqlite.db test.shp
 }}}

 {{{
 myricaria at MYRICARIA-HP /c/tmp/test
 $ ogrinfo -al shape2sqlite.db
 INFO: Open of `shape2sqlite.db'
       using driver `SQLite' successful.

 Layer name: test
 Geometry: Point
 Feature Count: 3
 Extent: (11.360236, 47.562036) - (12.456152, 47.884962)
 Layer SRS WKT:
 GEOGCS["WGS 84",
     DATUM["WGS_1984",
         SPHEROID["WGS 84",6378137,298.257223563,
             AUTHORITY["EPSG","7030"]],
         AUTHORITY["EPSG","6326"]],
     PRIMEM["Greenwich",0,
         AUTHORITY["EPSG","8901"]],
     UNIT["degree",0.0174532925199433,
         AUTHORITY["EPSG","9122"]],
     AUTHORITY["EPSG","4326"]]
 FID Column = OGC_FID
 Geometry Column = GEOMETRY
 id: Integer (0.0)
 pname: String (0.0)
 OGRFeature(test):1
   id (Integer) = 0
   pname (String) = a
   POINT (11.360236291910875 47.884962359602177)

 OGRFeature(test):2
   id (Integer) = 0
   pname (String) = b
   POINT (12.456151953403253 47.882419631849288)

 OGRFeature(test):3
   id (Integer) = 0
   pname (String) = c
   POINT (11.812841831923969 47.562035934986092)
 }}}

 connect2db.py

 {{{
 import sqlite3
 conn = sqlite3.connect('shape2sqlite.db')

 c = conn.cursor()

 # Create table
 c.execute('''CREATE TABLE stocks
              (date text, trans text, symbol text, qty real, price
 real)''')

 # Insert a row of data
 c.execute("INSERT INTO stocks VALUES
 ('2006-01-05','BUY','RHAT',100,35.14)")

 # Save (commit) the changes
 conn.commit()

 # We can also close the connection if we are done with it.
 # Just be sure any changes have been committed or they will be lost.
 conn.close()
 }}}

 sometest.py

 {{{
 import sqlite3
 conn = sqlite3.connect('shape2sqlite.db')
 c = conn.cursor()
 # Do this
 t = ('RHAT',)
 c.execute('SELECT * FROM stocks WHERE symbol=?', t)
 print c.fetchone()

 # Larger example that inserts many records at a time
 purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
              ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),
              ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
             ]
 c.executemany('INSERT INTO stocks VALUES (?,?,?,?,?)', purchases)

 for row in c.execute('SELECT * FROM stocks ORDER BY price'):
         print row
 }}}

 {{{
 myricaria at MYRICARIA-HP /c/tmp/test
 $ python sometest.py
 (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14)
 (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14)
 (u'2006-03-28', u'BUY', u'IBM', 1000.0, 45.0)
 (u'2006-04-06', u'SELL', u'IBM', 500.0, 53.0)
 (u'2006-04-05', u'BUY', u'MSFT', 1000.0, 72.0)
 }}}

 osgeo4w-wingrass7svn starts without any problem

 Helmut

-- 
Ticket URL: <http://trac.osgeo.org/osgeo4w/ticket/305#comment:41>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.


More information about the Osgeo4w-trac mailing list