Open
Description
Hi!
I was just testing out whether I could have ngshare run on the same PostgreSQL server as I have JupyterHub on. I'll document my issues here.
- The Docker image needs
psycopg2
. I used a custom image:FROM libretexts/ngshare:v0.5.1 USER 0:0 RUN pip install psycopg2-binary USER 65535:65535
- The database seems to be designed with Sqlite's dynamic-ish typing. Best case, ngshare should be tested against both sqlite and PostgreSQL. Example error, although I would expect many more due to Sqlite's lax behaviour wrt types:
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DatatypeMismatch) foreign key constraint "assignment_files_assoc_table_left_id_fkey" cannot be implemented DETAIL: Key columns "left_id" and "_id" are of incompatible types: text and integer. [SQL: CREATE TABLE assignment_files_assoc_table ( left_id TEXT NOT NULL, right_id INTEGER NOT NULL, PRIMARY KEY (left_id, right_id), FOREIGN KEY(left_id) REFERENCES assignments (_id), FOREIGN KEY(right_id) REFERENCES files (_id) ) ]
- Sqlite creates the database automatically when opened, but
psycopg2
as driver does not. I used a Kubernetes Job to create the database instead. This might need a simple code change somewhere. - Unless I am mistaken, the PVC that gets allocated is only used for the Sqlite support, so that should be shut of when the installations opts for PostgreSQL.
Is PostgreSQL support something you folks would be interested in? I'd provide some patches if so.
Metadata
Metadata
Assignees
Labels
No labels