Since BerkeleyDB can use the SQLite api, can python use sqlite module to connect to BerkeleyDB.
This post suggests using something else, but could have been written pre-Api sync. Best Python module for Berkeley DB?
Can get a simple connection string. If there known problem, PLEASE post. I am exploring this topic.
Using python 2.7 on linux and windows.
Building and amalgamating libraries on win32 is challenging :)
My assumptions:
Download bdb and pysqlite (this time I've got 2.6.3) and place it in c:\bdb
,
unpack bdb so you'll have
C:\bdb\db-5.2.36
go in C:\bdb\db-5.2.36\build_windows
pick Berkeley_DB_vs2010.sln
,
select Static Release
as configuration and build
you need to have libdb52s.lib
and libdb_sql52s.lib
in
C:\bdb\db-5.2.36\build_windows\Win32\Static Release
now unpack pysqlite in c:\bdb
, go in C:\bdb\pysqlite-2.6.3
and
edit setup.cfg
as follow:
[build_ext]
include_dirs=C:\bdb\db-5.2.36\lang\sql\generated
library_dirs=C:\bdb\db-5.2.36\build_windows\Win32\Static Release
define=SQLITE_OMIT_LOAD_EXTENSION
be sure to remove libraries= I had to add them to setup.py, because of static link we need to specify more than one library, if someone knows a way to specify a list in setup.cfg, please tell me :)
now open setup.py
go at line 191 and replace:
libraries=libraries
with:
libraries=['libdb_sql52s', 'libdb52s', 'ws2_32', 'advapi32'],
open vs2010 command prompt (in visual studio tools menu)
go in c:\bdb\pysqlite
set DISTUTILS_USE_SDK=1
set MSSdk=1
python setup.py build
# ignore errors about manifests, just make sure _sqlite.pyd is built
# make same tests of the linux instructions
python setup.py bdist_wininst
will make the .exe installer in dist subdir
According to the OracleBSDDB documentation, you can force BsdDB to generate a sqlite3 replacement library, then (in theory) you will be able to use this library in replacement of the standard sqlite3 library, and then use the sqlite3 python module.
Yet, be carrefull, using the version of BsdDB which support SQLite API is licensed under the SleepyCat License that will force you to pay fees to Oracle OR be an open source project (neither of those solutions are really bad, but you have to choose).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With