Why does running a select query using system.db.runQuery return a pyDataset while running a select query using system.db.runNamedQuery returns a dataset?
I built an entire script starting with a query using system.db.runQuery and then after I was done I moved the query into a named query and expected the script to continue working. I ended up having to make several changes. While this wasn’t a huge problem it begs the question: Why the difference? If I run the same select query in either script it would be simpler if they both returned the same thing.
It’s probably a mistake/bug that the Dataset you get from runNamedQuery
is not a PyDataset under the hood.
If it’s not too late, you can work around this using system.dataset.toPyDataSet()
.
This is essentially what I ended up doing. FWIW, the documentation for these scripting functions does correctly say that they return differing data types.
Would it be possible to add the option of how I want the data returned like I can with a query binding?
ie. I’d like to specify that the result is returned as a json. I can do this using a query binding but not via script.
1 Like
Seems like a reasonable feature request. It would probably be easy to implement because somewhere in the Perspective module the logic for turning a Dataset into JSON already exists…