0
votes

When trying to perform a query on a SQL calculated (Cloud SQL) model from server script, I get "Error: Unsupported datasource type: SQL" and it points to the line where I call run() on the query object.
I don't see anything in the documentation saying it's not possible to perform that kind of query (I'm not using the keywords property in the SQL query, it's only pure SQL with GROUP BY, LEFT JOIN, SORT BY...).

var moreRecentDocsQ = app.models.more_recent_docs.newQuery(); // `more_recent_docs` is a SQL calculated model
var moreRecentDocs = moreRecentDocsQ.run(); // this throws the error

From front-side, I'm able to retrieve the items of this calculated model without problems (using app.datasources.more_recent_docs.load()).

Anyone facing this issue ?

Thanks for your help

1

1 Answers

0
votes

Currently calculated SQL datasource can't be called from Server Script due to a bug. We'll work on the fix.

The only workaround to run arbitrary SQL I can think of is to use Apps Script Jdbc service.

Sorry for the inconvenience.