aws / aws/aws-appsync-community

How to handle escaping quotes in mutations against SQL Datasource?

Open
#44 11 comments 9 reactions 0 assignees View on GitHub
feature-request
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Hello,

I have a question on how to handle escaping quotes when AppSync mutation runs against Aurora Serverless datasource.

This is the example from the reference:

```
{
"version": "2018-05-29",
"statements": [
"insert into BOOKS VALUES (:AUTHOR, :TITLE, :ISBN13)",
"select * from BOOKS WHERE isbn13 = :ISBN13"
],
"variableMap": {
":AUTHOR": "$ctx.args.newBook.author",
":TITLE": "$ctx.args.newBook.title",
":ISBN13": "$ctx.args.newBook.isbn13"
}
}
```
However if input parameters `author` or `title` contains a signle quote, this will break VTL.

What is the best way to work around this?

Contributor guide

Open the contributing guide

Research direction

Start with the AppSync mutation reference example and the Aurora Serverless datasource context described in the issue, focusing on the variableMap and VTL input handling. Done would be a clear, documented way to handle quote-containing author or title values without breaking the mutation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql, sql
Domain
api, backend-api-design, databases
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.