Issue1682864

classification
Title: sqlite3 package
Type: Severity: normal
Components: Library Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, dubnerm, fwierzbicki, pdina, pjac, pjenvey, stefan.richthofer, zyasoft
Priority: low Keywords: patch

Created on 2007-03-17.21:39:30 by dubnerm, last changed 2016-08-01.09:52:39 by zyasoft.

Files
File name Uploaded Description Edit Remove
_sqlite3.py dubnerm, 2007-03-17.21:39:30 Lib/sqlite3/_sqlite3.py
Messages
msg2691 (view) Author: Michael Dubner (dubnerm) Date: 2007-03-17.21:39:30
CPython 2.5 has new package in standard library 'sqlite3'. Here is compatibility module '_sqlite3' implementation using 'javasqlite' [http://www.ch-werner.de/javasqlite/].
msg4238 (view) Author: Jim Baker (zyasoft) Date: 2009-03-12.08:01:38
Deferred to 2.5.1
msg4943 (view) Author: Philip Jenvey (pjenvey) Date: 2009-07-25.23:26:10
The SQLiteJDBC project came out shortly after this patch was created: http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC

The javasqlite it uses can be painful to install because it requires 
compiling its JNI linkages

SQLiteJDBC however works out of the box, it includes pre-compiled shims 
for the popular platforms and falls back to the slower NestedVM 
emulation on other platforms. It also seems well maintained, however 
javasqlite looks to still be maintained too

I would love to see this module tweaked to use SQLiteJDBC instead. This 
will require some work however as its api is different from javasqlite's
msg8756 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.16:38:52
Should revisit, among other things this would support https://bitbucket.org/jython/jython/pull-request/14/for-discussion-changes-to-support-ipython/

Some things to explore here:

* sqlitejava is clearly closer to the underlying SQLite, as a simple wrapper; it's also what Michael Dubner contributed a Python wrapper for.

* Xerial seems to be much more supported, and doesn't have native dependencies for us to consider.

It's pretty clear we need to go with the Xerial solution - we don't have the engineering resources to manage native dependencies.

Note that custom functions (UDFs) can be done with Xerial, https://bitbucket.org/xerial/sqlite-jdbc/src/975459c6e053b850404c04bc4bc3f5e52dcd8686/src/test/java/org/sqlite/UDFTest.java?at=default#cl-47

Likewise, there appears to be support for callback functions as well, by perusing some of the commits. I wasn't able to find any real docs however, so we will have to look at source code to go past JDBC.
msg8757 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.16:41:14
Probably the best way to do this is develop outside of Jython's development process, much like jyjdbc or Clamp
msg8931 (view) Author: Philip Jenvey (pjenvey) Date: 2014-08-19.18:08:15
There's another option, albeit a distant one for providing sqlite3 -- implementing a cffi backend and providing cffi, which is something we'd like to do anyway. Then we could use PyPy's _sqlite3 impl:

https://bitbucket.org/pypy/pypy/src/8bc429151c06505db6f2393fcd9f35a91971c510/lib_pypy/_sqlite3.py?at=default
msg9104 (view) Author: Jim Baker (zyasoft) Date: 2014-10-06.03:44:25
2.7.1 or later
msg10018 (view) Author: Jim Baker (zyasoft) Date: 2015-05-04.16:54:00
In msg8757, I proposed implementing outside of Jython's development process. However, given that we are planning to move to a 6 month release cycle, this doesn't seem to be so important - when the implementation of sqlite3 is done, we can make it part of the next 2.7.x release.

I also examined Xerial's support for what is required. As far as I can tell, all necessary functionality is implemented, including extension loading. Testing varies in the Python 2.7 test suite - there's no testing at all for extensions (see https://github.com/python/cpython/commit/b53996dead8c6a602d3f4f6c73bdd4573d0e49ef), but most other testing seems to be more than adequate.
msg10453 (view) Author: Jim Baker (zyasoft) Date: 2015-11-11.21:21:13
Moving to 2.7.2 (or later)
msg10887 (view) Author: Stefan Richthofer (stefan.richthofer) Date: 2016-08-01.04:05:36
Did someone take a look at this repository?
https://github.com/anthonyhendrickson/jython-sqlite3
It's only 3 weeks old, but might be promising.

Also. I was able to do some basic stuff with sqlite3 on Linux using JyNI. Importing works out of the box, creating, a db, cursor, execute simple sql-commands works. Some unittests crash JVM with a segfault (5 or so). If I remove these crashing tests, about 70% of the remaining unittests succeed. So, making this bulletproof would require some serious work. Maybe it would be more valuable to make cffi bulletproof and go the PyPy-path. As of this writing I wouldn't want to go through the failing tests to clean up support. However if one of them should turn out to be crucial for some actual use-case, e.g. to support some dependent framework, let me know: Then I will fix it with priority.
msg10888 (view) Author: Jim Baker (zyasoft) Date: 2016-08-01.09:52:39
I like https://github.com/anthonyhendrickson/jython-sqlite3 in terms of its packaging, but it doesn't port the sqlite3 module. Instead it makes sqlite3 available as a DBI2 compatible package. So separate goals.

Using JyNI could be a good alternative, but I think this port would be straightforward to Jython. Just requires a bit of time - I'm estimating a solid week of work.
History
Date User Action Args
2016-08-01 09:52:39zyasoftsetmessages: + msg10888
2016-08-01 04:05:36stefan.richthofersetnosy: + stefan.richthofer
messages: + msg10887
2015-11-11 21:21:14zyasoftsetmessages: + msg10453
milestone: Jython 2.7.1 -> Jython 2.7.2
2015-05-04 16:54:00zyasoftsetmessages: + msg10018
2015-04-20 23:42:38zyasoftsettitle: sqlite3 package (for python2.5 compatibility) -> sqlite3 package
versions: + Jython 2.7, - Jython 2.5
2015-04-20 23:42:26zyasoftsetmilestone: Jython 2.7.1
2014-10-06 03:44:25zyasoftsetmessages: + msg9104
2014-08-19 18:08:16pjenveysetmessages: + msg8931
2014-08-18 11:20:11pdinasetnosy: + pdina
2014-06-19 16:41:14zyasoftsetmessages: + msg8757
2014-06-19 16:38:52zyasoftsetmessages: + msg8756
2013-02-25 19:05:11fwierzbickisetversions: + Jython 2.5, - 2.5.1
2012-08-10 18:16:25fwierzbickisetnosy: + fwierzbicki
2012-06-18 18:50:34Arfreversetnosy: + Arfrever
2010-09-09 05:53:03zyasoftsetassignee: zyasoft ->
2009-12-17 14:47:28pjacsetnosy: + pjac
2009-07-25 23:26:10pjenveysetnosy: + pjenvey
messages: + msg4943
2009-03-12 08:01:38zyasoftsetpriority: normal -> low
messages: + msg4238
versions: + 2.5.1
2008-12-15 18:43:24fwierzbickisetcomponents: + Library, - None
2008-09-14 16:51:18zyasoftsetassignee: zyasoft
nosy: + zyasoft
2007-03-17 21:39:30dubnermcreate