Share your repls and programming experiences

← Back to all posts
ReplDBSQL - repl db now with sqlite3
MarcusWeinberger (678)

now use your repl db as a full sqlite3 database

run advanced queries, and more!


  • create a new file in your python repl (called for example) and copy this code in
  • in your file, add from db import ReplDBSQL
  • use it like so
db = ReplDBSQL()

con = db.connect() # returns an sqlite3 db instance
cur = con.cursor() # as normal
cur.execute('CREATE TABLE users (ID INT)')
db.commit() # save changes

# alternatively'INSERT INTO users (ID) VALUES (1)') # does the same as above
users ='SELECT * FROM users WHERE ID = ?', (1,))
HahaYes (1900)

SQL is a bit overkill, but its still cool