The default way is to replace the pre-installed SQLite library with the one we compiled containing the litereplica.


The Python's sqlite3 module interfaces with the installed

We can check it using the command bellow:

ldd /usr/lib/python2.7/lib-dynload/

We have 3 options to make it work with the modified SQLite library containing litereplica:

1. Use the LD_LIBRARY_PATH when opening python

LD_LIBRARY_PATH=/usr/lib python

2. Overwrite the pre-installed library

cd /usr/lib/arm-linux-gnueabihf  (or x86_64-linux-gnu, it depends on the architecture)

ln -sf /usr/lib/

3. Set the rpath in the wrapper library

For this we need patchelf:

git clone

cd patchelf




sudo make install

To set the rpath in the wrapper library:

patchelf --set-rpath /usr/lib /usr/lib/python2.7/lib-dynload/

To check if it was successful:

objdump -p /usr/lib/python2.7/lib-dynload/ | grep RPATH


Replace the file sqlite3.dll in the folder \Python\DLLs with the one containing litereplica.


Then we can use the sqlite3 module normally, passing a URI in the place of the filename.

Note that this works even in Python 2.7 because the litereplica has the URI enabled by default.

Example code:

import sqlite3

conn = sqlite3.connect('file:data.db?replica=master&slave=tcp://server:port')