ucam-department-of-psychiatry / crate

Create and use de-identified research databases. Preprocess, extract text, anonymise/de-identify, link, apply natural language processing, query for research, manage consent for contact.
GNU General Public License v3.0
19 stars 7 forks source link

Web front end crashes in automatic query builder if database structure has changed substantially #131

Closed RudolfCardinal closed 9 months ago

RudolfCardinal commented 9 months ago

Not sure if this is something that needs to be handled by the front end. However, if the database structure changes substantially (example: shifting NLP output into a separate database/schema), saved SQL queries may not only go awry, but the query builder can crash, e.g. via crate_anon.crateweb.research.sql_writer.get_join_info() to crate_anon.crateweb.research.research_db_info.get_dbinfo_by_schema_id(), with a blank SchemaId as its parameter and thus a StopIteration exception. One option would be to allow the database manager to wipe all saved queries, but that might lose work. I've made the crash output clearer (in the table_comments branch), suggesting a change in database structure as a cause. Good enough?

martinburchell commented 9 months ago

Reproduced by entering SELECT foo from bar in the box at /crate/query and then clicking on Send to query builder then Add to output (SELECT)