Code generation

Generate SDK code for your current query, scan or PartiQL statement.

Tablyne can turn whatever you’ve set up in the search panel — a scan, a query, or a PartiQL statement — into ready-to-paste code for the AWS SDK or CLI, so you can move from exploring to shipping without retyping it by hand.

Opening the panel

Click Gerar código (code) in the grid’s bottom toolbar. A panel opens with tabs for each target language and the generated code for your current search state. A copy button puts it on the clipboard.

What it generates

The generator reflects your current search configuration:

  • In Busca mode, it mirrors the routing decision — a Query if you’ve pinned the partition key, otherwise a Scan — including the key names and values you entered.
  • In SQL mode, it wraps your PartiQL statement in an ExecuteStatement call.
TargetOutput
JS/TS (SDK v3)@aws-sdk/client-dynamodb + lib-dynamodb DynamoDBDocumentClient with ScanCommand / QueryCommand / ExecuteStatementCommand
Python (boto3)boto3.client("dynamodb") with scan() / query() / execute_statement()
AWS CLIaws dynamodb scan / query / execute-statement

Each snippet includes the region and table name and prints the returned items.

Query example (JS/TS)

A query pinning the partition key pk with a begins_with sort-key condition generates expression placeholders correctly:

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, ScanCommand, QueryCommand, ExecuteStatementCommand } from "@aws-sdk/lib-dynamodb";

const client = new DynamoDBClient({ region: "us-east-1" });
const ddb = DynamoDBDocumentClient.from(client);

const res = await ddb.send(new QueryCommand({
  TableName: "orders",
  KeyConditionExpression: "#pk = :pk AND begins_with(#sk, :sk)",
  ExpressionAttributeNames: { "#pk": "pk", "#sk": "sk" },
  ExpressionAttributeValues: { ":pk": "USER#42", ":sk": "ORDER#" },
}));
console.log(res.Items);

The Python and CLI variants produce the equivalent calls, with the CLI using attribute-value JSON for the expression values. A scan generates the minimal ScanCommand / ddb.scan() / aws dynamodb scan form, and a PartiQL SELECT generates the ExecuteStatement / execute_statement() / execute-statement form wrapping your statement text verbatim.

Scan example (Python)

import boto3
ddb = boto3.client("dynamodb", region_name="us-east-1")

res = ddb.scan(TableName="orders")
print(res["Items"])

Switch tabs to see the same operation in JS/TS or as an AWS CLI command — the panel regenerates instantly, so you can grab whichever target your project uses without re-describing the read.

How accurate is it

The generated code is a faithful starting point for the read you configured: the operation, table, region, key condition and (for SQL) the statement text. It’s intended as a copy-paste-and-go skeleton, so a few things are intentionally left to you:

  • It generates the key condition; it doesn’t translate the grid’s separate FilterExpression filters into the snippet.
  • It uses = and begins_with for the sort key; other sort-key operators are simplified to a key starting point you can extend.
  • It doesn’t add pagination loops (LastEvaluatedKey / NextToken) — see /learn/pagination/ to wire that in.

Treat it as scaffolding: paste it, then add filters, pagination and error handling for production. A common next step is to wrap the call in a pagination loop that follows LastEvaluatedKey (or NextToken for PartiQL) until it’s exhausted, and to project only the attributes you need to cut payload size.

Limitations to keep in mind

  • Code generation reflects the read (scan/query/PartiQL SELECT), not the grid’s staged writes or bulk operations.
  • The grid’s separate filter conditions and exotic sort-key operators may need to be added to the generated snippet by hand.
  • No retry/pagination/auth boilerplate is generated — the snippet assumes your environment already resolves AWS credentials.