Loading DynamoDB to SQL Converter...
Please wait a moment

DynamoDB to SQL Converter Online — Convert DynamoDB Operations to SQL Queries

Paste your DynamoDB params JSON above and get the equivalent SQL query next to it. Handles FilterExpression, ExpressionAttributeNames, typed attribute values, reads, writes, updates and deletes, and the whole conversion runs in your browser.

How to Convert DynamoDB to SQL — Step-by-Step

Step 1

Input Your DynamoDB Params

Got a DynamoDB params object you need to understand as SQL? Three ways to load it:

•
Paste directly: Copy the DynamoDB params JSON from your code and paste it in. Code such as const params = {...} or new QueryCommand({...}) works too, and so does Scan output with an Items list
•
Upload a file: Click "Upload" to select a .json or .js file
•
Load a sample: Click "Sample" to see a DynamoDB Scan with FilterExpression converted to SQL

Example: DynamoDB Scan Params

Here is a typical DynamoDB Scan params object you might want to understand as SQL:

{
  "TableName": "users",
  "FilterExpression": "#status = :statusVal",
  "ExpressionAttributeNames": {
    "#status": "status"
  },
  "ExpressionAttributeValues": {
    ":statusVal": { "S": "active" }
  },
  "Limit": 25
}
Step 2

Automatic Conversion to SQL

The converter parses your DynamoDB API params and generates readable SQL:

•
Resolves placeholders: ExpressionAttributeNames (#name) and ExpressionAttributeValues (:value) are replaced with actual column names and values
•
Converts functions: DynamoDB-specific contains(), begins_with(), and attribute_exists() become familiar SQL LIKE and IS NOT NULL
•
Extracts types: DynamoDB typed values like {"S": "active"} become SQL-friendly 'active'

Example: SQL Output

The DynamoDB params from Step 1 converted to SQL:

SELECT *
FROM users
WHERE status = 'active'
LIMIT 25;
Step 3

Copy or Download Your SQL Query

When it looks right, grab it:

•
Copy to clipboard: One click — paste into your SQL client, documentation, or migration script
•
Download as file: Save as a .sql file
•
Try other converters: Convert the same query to MongoDB, or go back from SQL to DynamoDB. You can also format the SQL output for even cleaner results.

Frequently Asked Questions — DynamoDB to SQL

Which DynamoDB calls does it understand?

Scan and Query become SELECT, with KeyConditionExpression and FilterExpression joined by AND. GetItem becomes a SELECT on the key, PutItem an INSERT, UpdateItem an UPDATE (SET, REMOVE and numeric ADD) and DeleteItem a DELETE. BatchWriteItem, BatchGetItem and TransactWriteItems are split into their statements, and Scan or Query output with an Items list turns into INSERT rows.

How does it tell GetItem from DeleteItem?

Both take the same params: a TableName and a Key. If your code wraps them, as in new DeleteItemCommand({...}) or docClient.delete({...}), the page follows the command name. With bare JSON it writes a SELECT, because reading a row is the safe guess, and says so in a note above the SQL.

What happens to typed values like S, N and M?

S becomes a quoted string, N is written as a bare number exactly as it appears inside the quotes, BOOL becomes TRUE or FALSE and NULL becomes NULL. Maps, lists and sets (M, L, SS, NS, BS) are written as JSON text, and B is kept as its Base64 text. Plain values from the DocumentClient work too.

Will long IDs or prices change on the way through?

No. DynamoDB sends numbers as text, so an N value of 8901240544102066246 is written as 8901240544102066246, not rounded the way a JavaScript number would be, and 14.50 stays 14.50. A string such as 00501 stays a quoted string, so the leading zeros survive.

Is the SQL safe to run?

Quotes inside values are doubled, so a value like O'Brien or one containing a DROP TABLE trick stays a plain string. Table and column names are put in double quotes when they hold spaces, dots or reserved words. The output follows standard SQL, which suits PostgreSQL, SQLite, SQL Server and Oracle; for MySQL, see the note the page shows when a value contains a backslash. Still read the statement before running it against real data.

What does contains() or begins_with() become?

begins_with(name, 'adm') becomes name LIKE 'adm%' and contains(name, 'x') becomes name LIKE '%x%'. A % or _ in your value is escaped so it is matched literally. attribute_exists() and attribute_not_exists() become IS NOT NULL and IS NULL, and size() becomes LENGTH(). On a list or set, contains() checks for a member in DynamoDB, which LIKE does not do, so the page adds a note.

Does my data leave the browser?

No. The conversion runs in this page, nothing you paste is uploaded, and nothing is kept: reloading the page starts with an empty editor.

More NoSQL converters: MongoDB to SQL, SQL to DynamoDB, MongoDB to DynamoDB and, for ordinary JSON rows, JSON to SQL.