Passing a sqlite connection into an extension module

M

Matteo

Hello-
I'm trying to find out if there is a way to share a sqlite database
connection between python and an extension module written in C or C+
+.
My setup is that I have some pretty intensive OpenGL rendering code
that gets its values from a largish sqlite database, performs a fair
bit of computation, and then draws. I'm throwing everything I can at
it to keep the code in python (numpy, Cython, vertex arrays and
drawlists), but the initial rendering is very slow, and it's fast
becoming much more time consuming for me to optimize the python than
it would be to write equivalent code in a C++ extension module.

However, I would like to have access to the same database from within
Python for running lesser queries, and for prototyping new features.
The problem is that I may be running from an in-memory database, and I
might also be using temporary tables (for a cache), which are not
shared across separate connections. I would like to grab the pointer
to the sqlite3 connection struct, and pass it to an extension module
so that I can use sqlite's native API. I can not find any way to do
such a thing in either the standard sqlite module, or in APSW.

Has anyone had any experience with this? I can think of some
workarounds (such as hack APSW, among other ideas). Any caveats?

Thanks,
-matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top