hasura / hasura/graphql-engine

Support providing SQL query parameters to `run_sql`

Open
#9,228 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

I'd like to make use of Hasura's connection pooling to execute arbitrary administrative SQL. The [`run_sql` endpoint](https://hasura.io/docs/latest/api-reference/schema-api/run-sql/#schema-run-sql) seems well suited for this, except it doesn't seem to support SQL query parameters.

### Describe the solution you'd like

I'd like the `run_sql` arguments to accept an JSON object containing query parameters.

### Describe alternatives you've considered

An alternative at the moment would be attempting to construct the SQL string manually by escaping / sanitizing query parameters myself. However my reading on the subject indicates that this is dangerous, error prone, and not something that should generally be done.

Contributor guide

Open the contributing guide

Research direction

Start with the linked run_sql API reference and trace how the endpoint currently accepts and executes its arguments. Define the JSON query-parameter shape and verify that parameterized SQL works through the endpoint without requiring manual SQL construction.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
api, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.