[IPython-dev] SQLite kernel

Doug Blank doug.blank at gmail.com
Mon May 5 11:28:50 EDT 2014

On Mon, May 5, 2014 at 11:00 AM, Martin Gadbois <mgadbois at gmail.com> wrote:

> Hi!
> I would like to develop a SQLite kernel for IPython.
> Keyword, table and column completion would help building queries, and a
> dynamic output could resize text columns and have a proper notebook table
> output.
> To achieve that, I see two main directions:
> 1- Have an external kernel  (like
> http://nbviewer.ipython.org/gist/Carreau/4279371/node-kernel.ipynb) coded
> in Python since there are no 0MQ bindings for SQLite.
> 2- Extend IPython itself to support SQLite, since I will need to write
> Python code anyway to support SQLite.

I've wanted something like this for a while! I would like to incorporate
SQL as a language that could easily be used in a variety of educational
settings and other open source projects. But the utility of such a project
lies in the details of implementation.

There are pros and cons to both approaches. But you could perhaps develop
it in a manner that could be used in either situation. What would generally
be useful would be to replicate the SQLite shell. It would be great if the
parser was written in pure Python, and had an interpreter, also as much
written in pure Python as possible. That is, it would be great if the
low-level C-based sqlite API was limited, and could be swapped out.

That would allow other implementations of Python (Jython, PyPy, IronPython)
could use it with their own sqlite wrappers. But also, that might make it
useful for interfacing other data storages (for example, CSV files, Django
databases, etc.)

The SQLite shell is actually a bit hairy. Here is a port of the C code to
C# for example:


You could also use the simple-kernel [1] as a way of quickly turning a
Python program into a kernel. (simple-kernel was just updated by Min, so
now it is correct; thanks, Min!)

This might also have connections to the ADODB API [2]... they have worked
hard to make their connections be Python-implementation agnostic.

Looking forward to see what you develop!


[1] https://github.com/dsblank/simple_kernel
[2] https://sourceforge.net/projects/adodbapi

> What would this list recommend as an implementation strategy?
> Any example of creating an external kernel by reusing a subset of IPython
> itself?
> Thanks!
> --
> Martin
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140505/bdd9a803/attachment.html>

More information about the IPython-dev mailing list