<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sidharth Bangera</title>
    <description>The latest articles on DEV Community by Sidharth Bangera (@sidharth_bangera).</description>
    <link>https://dev.to/sidharth_bangera</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4167066%2F2504cd58-3050-4161-95b8-d7e57c7c1685.jpg</url>
      <title>DEV Community: Sidharth Bangera</title>
      <link>https://dev.to/sidharth_bangera</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sidharth_bangera"/>
    <language>en</language>
    <item>
      <title>Running, Saving, and Reopening a Parameterized DynamoDB PartiQL SELECT in Tables</title>
      <dc:creator>Sidharth Bangera</dc:creator>
      <pubDate>Thu, 08 Oct 2026 18:02:07 +0000</pubDate>
      <link>https://dev.to/sidharth_bangera/running-saving-and-reopening-a-parameterized-dynamodb-partiql-select-in-tables-48d4</link>
      <guid>https://dev.to/sidharth_bangera/running-saving-and-reopening-a-parameterized-dynamodb-partiql-select-in-tables-48d4</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When I reuse a database query, I want the query structure to stay consistent while the input value can change.&lt;/p&gt;

&lt;p&gt;In this walkthrough, I use &lt;a href="https://tables.serverlesscreed.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;Tables by ServerlessCreed&lt;/strong&gt;&lt;/a&gt;, a DynamoDB GUI with a PartiQL Workbench, to run a parameterized DynamoDB PartiQL &lt;code&gt;SELECT&lt;/code&gt;, verify the returned items, save the statement, restart the application, reopen the saved query, and verify the result again.&lt;/p&gt;

&lt;p&gt;I also include a simple syntax-error recovery check. The test uses a deterministic fixture, so I know the expected result before execution and can verify the workflow against actual data rather than relying only on a success message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To reproduce the workflow, you need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://tables.serverlesscreed.com/" rel="noopener noreferrer"&gt;Tables by ServerlessCreed&lt;/a&gt; installed. The installer is available from the &lt;a href="https://tables.serverlesscreed.com/downloads" rel="noopener noreferrer"&gt;official download page&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Access to a non-production DynamoDB environment.&lt;/li&gt;
&lt;li&gt;A table with predictable test data.&lt;/li&gt;
&lt;li&gt;A known expected result that you can compare with the query output.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this test, I used a table named &lt;code&gt;table_bulk&lt;/code&gt; with 120 deterministic items. The fixture was prepared so that 30 items had:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Status = BULK_EDITED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this table, &lt;code&gt;OrderId&lt;/code&gt; is the partition key and &lt;code&gt;Status&lt;/code&gt; is the sort key. Because &lt;code&gt;BULK_EDITED&lt;/code&gt; appears on multiple items, &lt;code&gt;Status&lt;/code&gt; was a useful field for testing a parameterized query that returned more than one record.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The query I wanted to reuse
&lt;/h2&gt;

&lt;p&gt;Instead of putting the filter value directly into the SQL, I used a named parameter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_bulk"&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nv"&gt;"Status"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;statusValue&lt;/span&gt;&lt;span class="p"&gt;}};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parameter value for this run was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;statusValue = BULK_EDITED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps the query structure reusable while letting the value be supplied separately when the statement is run.&lt;/p&gt;

&lt;p&gt;I opened the &lt;strong&gt;PartiQL Workbench&lt;/strong&gt;, selected &lt;code&gt;table_bulk&lt;/code&gt;, and entered the statement. Autocomplete suggestions were available again in the v3.3.37 build while I was typing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffmz0j2mqrxplebnmq0eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffmz0j2mqrxplebnmq0eg.png" alt="Tables PartiQL Workbench showing table_bulk selected and the Status attribute suggested by autocomplete" width="781" height="252"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After selecting &lt;code&gt;table_bulk&lt;/code&gt;, Tables shows the &lt;code&gt;Status&lt;/code&gt; attribute in autocomplete while I build the PartiQL SELECT.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Supplying the parameter and reviewing the query
&lt;/h2&gt;

&lt;p&gt;When I ran the parameterized statement, Tables opened a &lt;strong&gt;Query parameters&lt;/strong&gt; dialog and detected &lt;code&gt;statusValue&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I entered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BULK_EDITED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and chose &lt;strong&gt;Load for review&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Tables then resolved the parameterized statement to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_bulk"&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nv"&gt;"Status"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'BULK_EDITED'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This review step was useful because I could see the exact statement that would be executed before running it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4gtmh1l9a6shfyc6yae5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4gtmh1l9a6shfyc6yae5.png" alt="Tables PartiQL Workbench showing the parameterized SELECT before entering the query parameter." width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkd0b3o760rufv57bxxlg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkd0b3o760rufv57bxxlg.png" alt="Tables Query parameters dialog prompting for the statusValue input before loading the query for review." width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwqiyr9a3k4aidiypqqko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwqiyr9a3k4aidiypqqko.png" alt="Tables Query parameters dialog showing statusValue with the value BULK_EDITED." width="800" height="388"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After running the parameterized statement, Tables prompts for statusValue; I entered BULK_EDITED and loaded the resolved query for review.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Verifying the first result
&lt;/h2&gt;

&lt;p&gt;I then ran the resolved query.&lt;/p&gt;

&lt;p&gt;The expected result was 30 matching items because the fixture had been prepared with exactly 30 items whose &lt;code&gt;Status&lt;/code&gt; value was &lt;code&gt;BULK_EDITED&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Tables returned &lt;strong&gt;30 items&lt;/strong&gt;, which matched that expectation.&lt;/p&gt;

&lt;p&gt;This was the important verification point for the first run. I was not relying only on a generic success message; I had a known fixture and an expected result before execution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fax9jcvugeqq6x9a74qrc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fax9jcvugeqq6x9a74qrc.png" alt="Tables PartiQL results showing a successful query with 30 returned BULK_EDITED items." width="800" height="514"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After running the resolved SELECT, Tables returns the expected 30 items from the deterministic fixture.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Saving the statement and reopening it after restart
&lt;/h2&gt;

&lt;p&gt;Next, I saved the &lt;strong&gt;parameterized template&lt;/strong&gt; rather than only the resolved literal query.&lt;/p&gt;

&lt;p&gt;The saved statement retained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_bulk"&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nv"&gt;"Status"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;statusValue&lt;/span&gt;&lt;span class="p"&gt;}};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then restarted Tables, returned to the PartiQL Workbench, and selected the saved statement from &lt;strong&gt;My statements&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The parameterized query itself was still there after restart, but the previous parameter value was not retained. Selecting the saved query opened the &lt;strong&gt;Query parameters&lt;/strong&gt; dialog again, so I entered &lt;code&gt;BULK_EDITED&lt;/code&gt; a second time.&lt;/p&gt;

&lt;p&gt;That behavior is important: Tables preserved the reusable query template, while the input value had to be supplied again when reopening it.&lt;/p&gt;

&lt;p&gt;After loading the value for review and rerunning the query, Tables again returned the expected 30 items.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;First run&lt;/th&gt;
&lt;th&gt;Reopened run&lt;/th&gt;
&lt;th&gt;Expected keys/items&lt;/th&gt;
&lt;th&gt;Actual keys/items&lt;/th&gt;
&lt;th&gt;Difference&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Query template&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;{{statusValue}}&lt;/code&gt; present&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;{{statusValue}}&lt;/code&gt; present&lt;/td&gt;
&lt;td&gt;Same saved statement&lt;/td&gt;
&lt;td&gt;Same saved statement reopened&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parameter value&lt;/td&gt;
&lt;td&gt;Entered &lt;code&gt;BULK_EDITED&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Re-entered &lt;code&gt;BULK_EDITED&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Same input value&lt;/td&gt;
&lt;td&gt;Same input value&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Result&lt;/td&gt;
&lt;td&gt;30 items&lt;/td&gt;
&lt;td&gt;30 items&lt;/td&gt;
&lt;td&gt;30 deterministic fixture items matching &lt;code&gt;Status = BULK_EDITED&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Same 30-item result set observed after restart&lt;/td&gt;
&lt;td&gt;None observed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I did not export a separate key manifest for this run, so the comparison was based on the deterministic fixture and the matching 30-item result before and after restart.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yqpub0mwr2rh0lypa2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8yqpub0mwr2rh0lypa2l.png" alt="Tables PartiQL Workbench showing the saved parameterized statement reopened with a Query parameters dialog for statusValue." width="799" height="481"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After restarting Tables and reopening the saved statement, the parameterized query remains intact and Tables prompts me to enter statusValue again.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Recovering from a syntax error
&lt;/h2&gt;

&lt;p&gt;I also tested a simple recovery case by deliberately changing the statement to invalid syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;SELECCC&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"table_bulk"&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nv"&gt;"Status"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'BULK_EDITED'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tables rejected the statement and displayed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Statement wasn't well formed, can't be processed: Expected data manipulation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The malformed statement remained visible in the editor, so I could correct it directly instead of recreating it from scratch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn986ys3so8lg132p1xba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn986ys3so8lg132p1xba.png" alt="Tables PartiQL Workbench showing a malformed SELECCC statement and the resulting syntax error." width="800" height="511"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After running the deliberately malformed SELECCC statement, Tables reports a syntax error while leaving the statement in the editor for correction.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I corrected the query and ran it again. Tables reported a successful execution and returned &lt;strong&gt;30 items&lt;/strong&gt;, matching the expected fixture result.&lt;/p&gt;

&lt;p&gt;The query history also kept the failed statement and the successful corrected statement as separate entries during this retest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa05xxd5b33yw7213bagy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa05xxd5b33yw7213bagy.png" alt="Tables PartiQL Workbench showing the corrected SELECT and a successful 30-row result after syntax-error recovery." width="800" height="517"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After correcting the statement, Tables executes the SELECT successfully and returns the expected 30 matching items.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This test confirmed the full workflow I wanted to verify in Tables: creating a parameterized DynamoDB PartiQL query, supplying the parameter value, checking the returned items, saving the query template, reopening it after restart, and running it again with the same expected result.&lt;/p&gt;

&lt;p&gt;The saved statement retained the &lt;code&gt;{{statusValue}}&lt;/code&gt; placeholder, while the parameter value had to be entered again after reopening. With the same &lt;code&gt;BULK_EDITED&lt;/code&gt; input and unchanged fixture, both runs returned the expected 30 items.&lt;/p&gt;

&lt;p&gt;The syntax-error check also showed that a malformed statement remained available for correction, and the corrected query returned the expected result afterward.&lt;/p&gt;

&lt;p&gt;For this test, the most useful part of the workflow was keeping the query reusable without hard-coding the input value into the saved template, while still verifying the result against a deterministic fixture.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>dynamodb</category>
      <category>database</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
