sql – in-memory database in Python

sql – in-memory database in Python

SQLite3 might work. The Python interface does support the in-memory implementation that the SQLite3 C API offers.

From the spec:

You can also supply the special name
:memory: to create a database in RAM.

Its also relatively cheap with transactions, depending on what you are doing. To get going, just:

import sqlite3
conn = sqlite3.connect(:memory:)

You can then proceed like you were using a regular database.

Depending on your data – if you can get by with key/value (strings, hashes, lists, sets, sorted sets, etc) – Redis might be another option to explore (as you mentioned that you wanted to share with other programs).

It may not seem obvious, but pandas has a lot of relational capabilities. See comparison with SQL

sql – in-memory database in Python

I guess, SQLite3 will be the best option then.

If possible, take a look at memcached. (for key-value pair, lighting fast!)


HSQLDB for SQL Like tables. (no python support)

Leave a Reply

Your email address will not be published. Required fields are marked *