stephenslab / dsc

Repo for Dynamic Statistical Comparisons project
https://stephenslab.github.io/dsc-wiki
MIT License
12 stars 12 forks source link

dsc allows sql keywords #229

Open pcarbo opened 2 years ago

pcarbo commented 2 years ago
dsc <- dscquery("dsc_result",
                c("fit.update", "evaluate"))
# Calling: dsc-query dsc_result -o /tmp/Rtmpb7j76A/file1ea9366fe952.csv 
#  --target "fit.update evaluate" --force
# INFO: Loading database ...
# INFO: Running queries ...
ERROR: (sqlite3.OperationalError) near "update": syntax error
# [SQL: SELECT "simulate".DSC_REPLICATE AS simulate_DSC_FIELD_DSC_REPLICATE,
#  "fit".update AS fit_DSC_FIELD_update, "evaluate_train".__output__ AS
# evaluate_train_DSC_OUTPUT_ FROM "evaluate_train" INNER JOIN "fit" ON
# "evaluate_train".__parent__ = "fit".__id__ INNER JOIN "simulate" ON "fit".__parent__ 
# = "simulate".__id__]
# (Background on this error at: https://sqlalche.me/e/14/e3q8)
pcarbo commented 2 years ago

This is what @gaow said:

I suspect it's because dsc-query relies on SQL and update is an SQL keyword.

I did have a list of keywords to block off: https://github.com/stephenslab/dsc/blob/master/src/query_engine.py#L31 What's weird is that the parser should catch this and not let Yunqi use this keyword as parameter in the first place.

pcarbo commented 2 years ago

Also from @gaow:

Ahh actually i tried to fix this problem here. By somehow modify the keywords a bit. But apparently this failed to catch the problem.