Skip to content

Commit 9820f72

Browse files
committed
upadted: sql++ query in resolver
1 parent 5b4c133 commit 9820f72

File tree

1 file changed

+2
-2
lines changed
  • tutorial/markdown/nodejs/dataApi-appsync-tutorial

1 file changed

+2
-2
lines changed

tutorial/markdown/nodejs/dataApi-appsync-tutorial/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export function request(ctx) {
200200

201201
// Construct a SQL++ query to filter hotels by city
202202
// The query_context below lets us use "hotel" instead of "travel-sample.inventory.hotel"
203-
const sql_query = `SELECT c.* FROM ${collection} AS c WHERE city = $city`;
203+
const sql_query = `SELECT c.* FROM ${collection} AS c WHERE city = $1`;
204204

205205
// Build the HTTP request object for the Data API Query Service
206206
const requestObject = {
@@ -215,7 +215,7 @@ export function request(ctx) {
215215
body: JSON.stringify({
216216
query_context: `default:${bucket}.${scope}`, // Namespace shortcut
217217
statement: sql_query, // The SQL++ query
218-
args: { city: city }, // Pass parameters securely
218+
args: [ city ], // Pass parameters securely
219219
timeout: '30m' // Query timeout (generous for demo)
220220
})
221221
}

0 commit comments

Comments
 (0)