Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 024b850

Browse files
committed
Fix: Enable use with SQLite.
1 parent 075020a commit 024b850

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

runestone/server/componentdb.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def setup(app):
123123
logger.info("Connecting to DB")
124124
try:
125125
dburl = get_dburl()
126-
engine = create_engine(dburl, client_encoding="utf8", convert_unicode=True)
126+
# SQLite doesn't support ``client_encoding``, while PostgreSQL does.
127+
encoding = dict(client_encoding="utf8") if dburl.startswith("postgresql") else {}
128+
engine = create_engine(dburl, convert_unicode=True, **encoding)
127129
Session = sessionmaker()
128130
engine.connect()
129131
Session.configure(bind=engine)
@@ -383,6 +385,7 @@ def addQuestionToDB(self):
383385
question_name=id_,
384386
)
385387
sess.execute(ins)
388+
sess.commit()
386389

387390

388391
def addQNumberToDB(app, node, qnumber):

0 commit comments

Comments
 (0)