4 ms·
Yes. Last year I made an app that _kinda_ does this ( https://www.seamless.cloud https://www.seamless.cloud ). It solves the security issue by making you defin
by vlucas 6y ago
Yes. Last year I made an app that _kinda_ does this ( https://www.seamless.cloud https://www.seamless.cloud ).
It solves the security issue by making you define the query first in Seamless, and then you get a REST API endpoint to run that query, with optional parameters that are run in a prepared statement.
Query (in the Seamless backend)
> SELECT * FROM posts WHERE author_id = ${author_id} LIMIT 50
And corresponding REST endpoint for that:
> GET https://primary.dbapi.seamless.cloud/somecompany/queries/run/queryName?access_token=abc123&authorId=42 https://primary.dbapi.seamless.cloud/somecompany/queries/run...
I dogfooded it while writing the serverless backend for BudgetSheet, and in practice I got tired of having to pre-define each query up front in the app before I could run it from the app. It was kinda painful to switch back and forth vs. just having the queries in the codebase. So... I have definitely been thinking a lot more about how to move the SQL to the client, but in a secure way (perhaps in cobination with the Seamless app that only allows "verified" queries to run in production, etc.) There is definitely some room here for a little innovation.