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

Commit bcb3eca

Browse files
bjones1bnmnetp
authored andcommitted
Fix: Enable use with SQLite.
1 parent 294c055 commit bcb3eca

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
@@ -128,7 +128,9 @@ def setup(app):
128128
logger.info("Connecting to DB")
129129
try:
130130
dburl = get_dburl()
131-
engine = create_engine(dburl, client_encoding="utf8", convert_unicode=True)
131+
# SQLite doesn't support ``client_encoding``, while PostgreSQL does.
132+
encoding = dict(client_encoding="utf8") if dburl.startswith("postgresql") else {}
133+
engine = create_engine(dburl, convert_unicode=True, **encoding)
132134
Session = sessionmaker()
133135
engine.connect()
134136
Session.configure(bind=engine)
@@ -388,6 +390,7 @@ def addQuestionToDB(self):
388390
question_name=id_,
389391
)
390392
sess.execute(ins)
393+
sess.commit()
391394

392395

393396
def addQNumberToDB(app, node, qnumber):

0 commit comments

Comments
 (0)