Beginner6 min read

How to Query DynamoDB with AI (Natural Language)

"Show me last week's open tickets" is a one-liner in your head and a KeyConditionExpression with placeholder maps on the wire.

The DynamoDB API itself has no natural-language endpoint: every request is still expressions or . AI sits in the tooling layer, translating your intent into them.

Whether that translation helps or hurts depends on one thing: whether the model can see your real schema.

How do I query DynamoDB using natural language?

You have three options:

  • Ask a general LLM to draft PartiQL and run it yourself. Fast, but the model is guessing your attribute names.
  • Connect an AI agent through an MCP server, so it can inspect the table and run reads for real.
  • Use a client with a schema-aware agent. DynoTable's AI chat turns plain language into PartiQL or SQL against your indexed schema, computes whole-table aggregates, and stages any write for your review.

Option 1: LLM-drafted PartiQL, run by you

Describe the query to any capable model, get PartiQL back, and run it in the console's PartiQL editor or with the CLI:

aws dynamodb execute-statement \
  --statement "SELECT * FROM \"Tickets\" WHERE PK = 'TICKET#1001'"

It works, and it fails in three predictable ways:

  • The model can't see your table. It will invent attribute names and key shapes (ticketId when yours is PK = TICKET#<id>), and you debug hallucinated schema.
  • PartiQL's limits still apply. A SELECT reads one table, and a WHERE that doesn't pin the partition key becomes a full table scan. Give the model your keys and ask for = or IN on the partition key, or query a GSI on its own key: FROM "Tickets"."StatusIndex" WHERE "status" = 'OPEN'. A GSI read without that WHERE scans the whole index.
  • Pasting data into a chatbot sends it outside your account. Sample items in a prompt are production data leaving your boundary.

To make scans impossible rather than unlikely, deny dynamodb:PartiQLSelect in IAM when dynamodb:FullTableScan is true (AWS example). PartiQL vs SQL explains what the SQL surface buys.

For the data-governance problem, paste the aws dynamodb describe-table output and a redacted sample instead of real items, or use a model on Amazon Bedrock under your own AWS account, where model providers have no access to your prompts and completions (Option 3 does that).

Good for one-off queries on a schema you can paste from memory; shaky as a workflow.

Option 2: an AI agent connected via MCP

The structural fix for "the model can't see your table" is to give the agent tools instead of a pasted schema.

An MCP server exposes DynamoDB operations as typed tools. Any MCP-capable agent (Claude Code, Cursor, Codex, custom agents) can then list tables, inspect keys and run reads, with real results feeding back into the conversation.

DynamoDB MCP server covers the options, how to run any of them on read-only credentials, and the write-safety questions. DynoTable ships one: loopback-only, consent per connection, and it never passes your AWS keys to the agent.

This is the right architecture when you already work in an agent (a coding assistant in your editor or terminal) or when the agent is the product, such as an internal support bot.

Option 3: a schema-aware agent in your DynamoDB client

DynoTable's built-in agent lives next to your tables (⌘;). It reads your indexed schema: the tables under the active profile, their keys and indexes, the attribute paths and types found by table indexing, even sample values.

"Filter this to last week" resolves against your real attribute names. Type @ to reference a @table, @column or @gsi explicitly.

The DynoTable AI chat docked beside a table tab: a plain-language question, the generated query, and the result opening as a view.
The DynoTable AI chat docked beside a table tab: a plain-language question, the generated query, and the result opening as a view.

What it does with a question (the full list is in the AI tools docs):

  • Writes the query for you: read-only PartiQL, or Workbench SQL when the question needs JOIN / GROUP BY / aggregates (the analytics DynamoDB's API doesn't have). It proposes the result as a chip you click to open as a real tab.
  • Computes aggregates. A sum, average, or per-group breakdown runs through Workbench SQL. An eligible key condition can use Query. Broader reads can scan the table, and large SQL downloads stop at the agent's download budget. The agent labels partial answers.
  • Stages changes for review. See the proposed edits in the staging area and commit them when you are ready.
  • Asks before costly reads, in Manual mode. Manual, the default, prompts per tool. Auto approves the grants you saved; Full Auto approves every call except your denies and an S3 export. Every gated decision lands in a local audit log.

The built-in agent can use your Claude subscription through Claude Code, your ChatGPT subscription through Codex, or AWS Bedrock on your own AWS account. Connect a provider and choose a model in the profile where you want to use it. This powers DynoTable's own chat. MCP connects an agent in another app to your tables.

Inference goes to the provider you choose. Bedrock runs in your AWS account. On Claude or ChatGPT, your prompts and the schema and rows the agent reads go to Anthropic or OpenAI under your plan. A custom API endpoint receives that data if configured. Inference goes directly from the app without a DynoTable relay. See AI chat setup and privacy.

Tool results reach the model as data, with an instruction to treat them as untrusted. A row can still influence the model. Review proposed changes and choose which reads, exports and staging operations the agent can run.

What AI does not change about DynamoDB

  • Access patterns still rule. "Where status = X" on its own needs a scan when status is a non-key attribute. An eligible key condition can limit the candidates first. If a question keeps forcing scans, fix the data model: a GSI or a better sort key.
  • Reads cost real capacity. A whole-table aggregate is a whole-table read. The pricing calculator tells you what a full pass costs before you approve it.
  • Hand-build the queries you ship. For a query you'll run in production for years, build the expression once in the Expression Builder and ship the exact names/values maps. Use AI to explore and the builder for the code you commit.

FAQ

Can I query DynamoDB in plain English? Not against the API, which only speaks expressions and PartiQL. An AI layer can translate: an LLM drafting PartiQL, an MCP-connected agent, or a schema-aware agent like DynoTable's that runs the query against your real schema.

Does DynamoDB have a built-in AI query feature? No natural-language endpoint exists in the API. AI querying comes from the tooling on top, so evaluate its safety model: read gates, staged writes, and whose credentials it runs on.

Is it safe to let AI near production data? It's a permissions question. Look for reads gated behind approval, writes that land in a reviewable staging area, an audit log, and inference on credentials you control. A chatbot holding pasted data gives you none of those.

Can the AI join tables or do GROUP BY? Not via the DynamoDB API: no engine exists for it. DynoTable's agent uses Workbench SQL for JOIN, GROUP BY, CTEs, subqueries, and count/sum/average. Eligible key conditions can use Query. Broader statements may need the data read locally.

What does it cost? DynamoDB bills for reads. Inference follows the provider you choose: AWS bills Bedrock usage, Claude and ChatGPT use your subscription's limits, and a custom endpoint follows its operator's terms. The agent and Workbench SQL need an active DynoTable trial or paid plan. Agent SQL downloads stop at roughly 100,000 items or 100 MB. Queries you run yourself in the Workbench have separate limits. See pricing.

Download DynoTable, connect your provider, and ask a question about your tables in plain language.

By Dmitriy · Updated