title: DynamoDB PartiQL Request Parameter In Select
body: <p>I am attempting to use PartiQL to query a set of data that looks like this:</p>
  <pre><code>{
    &quot;userId&quot;: {
      &quot;S&quot;: &quot;someuserID&quot;
    },
    &quot;mapWithData&quot;: {
      &quot;M&quot;: {
        &quot;1&quot;: {
          &quot;M&quot;: {
            &quot;neededVal&quot;: {
              &quot;S&quot;: &quot;A Needed Value1&quot;
            },
            &quot;name&quot;: {
              &quot;S&quot;: &quot;A Name1&quot;
            }
          }
        },
        &quot;2&quot;: {
          &quot;M&quot;: {
            &quot;neededVal&quot;: {
              &quot;S&quot;: &quot;&quot;A Needed Value12&quot;
            },
            &quot;name&quot;: {
              &quot;S&quot;: &quot;A Name2&quot;
            }
          }
        }
      }
    },
    &quot;userName&quot;: {
      &quot;S&quot;: &quot;someuserName&quot;
    }
  }
  </code></pre>
  <p>I am developing this query using the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.html" rel="nofollow noreferrer">NoSQL Workbench</a>. I want to use a Request Parameter in the query to get a specific object from the <code>mapWithData</code> based on its key value. For instance, if I wanted to get the n-th value from the map, I could use this query:</p>
  <pre><code>SELECT &quot;mapWithData&quot;.&quot;N&quot;.&quot;neededVal&quot;
  FROM &quot;some-table&quot;
  WHERE &quot;userId&quot; = 'someuserID'
  </code></pre>
  <p>But I would like to be able to make the <code>&quot;N&quot;</code> and the <code>'someruserID'</code> into Request Parameters to prevent any PartiQL injections (assuming the Request Parameters are actually cleansed). So what I'm trying to do is this:</p>
  <pre><code>SELECT &quot;mapWithData&quot;.?.&quot;neededVal&quot;
  FROM &quot;some-table&quot;
  WHERE &quot;userId&quot; = ?
  </code></pre>
  <p>This does not work unfortunately and I get this error:</p>
  <blockquote>
  <p>Execute PartiQL statement failed: Validation Error: Statement wasn't well formed, can't be processed: Invalid path dot component</p>
  </blockquote>
  <p>So then I tried to use a different format like this:</p>
  <pre><code>SELECT &quot;mapWithData&quot;[ ? ][&quot;neededVal&quot;]
  FROM &quot;some-table&quot;
  WHERE &quot;userId&quot; = ?
  </code></pre>
  <p>But when I do that, I get this error:</p>
  <blockquote>
  <p>Execute PartiQL statement failed: Validation Error: Unexpected path component at 1:23:1</p>
  </blockquote>
  <p>Is it possible to include a <code>?</code> for inserting request parameters in the <code>SELECT</code> part of this statement? Is there another way to do this that I'm missing?</p>