Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
awslabs avatar

Dsql

  • 34 installs
  • 850 repo stars
  • Updated August 3, 2026
  • awslabs/agent-plugins

DSQL is a Claude skill for building with Amazon Aurora DSQL, a serverless PostgreSQL-compatible distributed SQL database, covering schemas, queries, migrations, IAM auth, OCC retries, and bulk data loading.

About

DSQL is a skill for building applications with Amazon Aurora DSQL, a serverless, PostgreSQL-compatible distributed SQL database. A developer uses it to manage schemas, run queries and migrations, diagnose query plans, handle IAM auth and multi-tenant patterns, and load data in bulk. It covers converting MySQL and PostgreSQL schemas to DSQL, replacing foreign keys, and implementing optimistic-concurrency-control retry logic.

  • Builds with Aurora DSQL: schemas, queries, migrations, and query-plan diagnostics
  • Covers MySQL-to-DSQL and PostgreSQL-to-DSQL conversion, FK replacement, and OCC retry patterns
  • Includes ORM migration (Django/Hibernate/Rails), IAM auth, and bulk data loading

Dsql by the numbers

  • 34 all-time installs (skills.sh)
  • Ranked #483 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

dsql capabilities & compatibility

Requires an AWS account; Aurora DSQL usage is billed by AWS

Capabilities
database migration · schema conversion · query optimization
Works with
aws · postgres · mysql
Use cases
database · api development
Pricing
Bring your own API key
From the docs

What dsql says it does

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, load data, and develop applications with a serverless, distributed SQL database.
SKILL.md
Aurora DSQL is a serverless, PostgreSQL-compatible distributed SQL database.
SKILL.md
npx skills add https://github.com/awslabs/agent-plugins --skill dsql

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs34
repo stars850
Last updatedAugust 3, 2026
Repositoryawslabs/agent-plugins

What it does

Build and migrate a schema, queries, and app code against Amazon Aurora DSQL with OCC retries and IAM auth.

Who is it for?

Building, migrating, and querying schemas on Amazon Aurora DSQL with multi-tenant and OCC patterns

Skip if: Non-DSQL databases or workloads that do not use Aurora DSQL

When should I use this skill?

You are building an application on Aurora DSQL and need schema, migration, query-plan, IAM auth, or OCC retry guidance.

What you get

A working DSQL schema, migrations, and application data-access code with IAM auth and OCC retry handling.

  • DSQL schema and migrations
  • Query-plan diagnostics
  • OCC retry and app-layer FK code

By the numbers

  • table recreation pattern for tables exceeding 3,000 rows
  • supports MySQL and PostgreSQL to DSQL conversion

Files

SKILL.mdMarkdownGitHub ↗

Amazon Aurora DSQL Skill

Aurora DSQL is a serverless, PostgreSQL-compatible distributed SQL database. This skill covers direct query execution via MCP tools, schema management, migrations, multi-tenant isolation, IAM auth, and bulk data loading via aurora-dsql-loader.

---

Reference Files

Load these files as needed for detailed guidance:

Core:

ReferenceWhen to LoadContains
development-guide.mdALWAYS before schema changes or DB operationsBest practices, DDL rules, transaction limits, app-layer referential integrity
language.mdMUST load for language-specific choicesDriver selection, DSQL Connectors, connection code
access-control.mdMUST load for roles, grants, or sensitive dataScoped role setup, IAM-to-database role mapping
troubleshooting.mdSHOULD load for errors or unexpected behaviorOCC errors, connection failures, cluster state errors, token expiry, DDL rejection causes
dsql-examples.mdLoad for implementation examplesMulti-tenant schema examples, batch operations, FK validation patterns, connection pooling
onboarding.mdUser requests "Get started with DSQL"Interactive step-by-step guide
occ-retry-patterns.mdMUST load for OCC retry code or conflict mitigationDSQL Connectors, manual retry pattern, idempotent design

MCP:

ReferenceWhen to LoadContains
mcp-setup.mdAlways for MCP server guidanceSetup instructions, 2 configuration options
mcp-tools.mdFor MCP tool syntax and examplesTool parameters, input validation
dsql-lint.mdMUST load before running dsql_lint or processing external SQLTool reference, fix statuses, unfixable error resolution

DDL Migrations:

ReferenceWhen to LoadContains
ddl-migrations/overview.mdMUST load for DROP COLUMN, ALTER TYPE, DROP CONSTRAINTTable recreation pattern, verify & swap
ddl-migrations/column-operations.mdDROP COLUMN, ALTER TYPE, SET/DROP NOT NULL/DEFAULTColumn-level migration patterns
ddl-migrations/constraint-operations.mdADD/DROP CONSTRAINT, MODIFY PRIMARY KEYConstraint and structural changes
ddl-migrations/batched-migration.mdTables exceeding 3,000 rowsBatching patterns, progress tracking

MySQL Migrations:

ReferenceWhen to LoadContains
mysql-migrations/type-mapping.mdMUST load for MySQL → DSQL migrationData type mappings, feature alternatives
mysql-migrations/ddl-operations.mdTranslating MySQL DDL to DSQLAUTO_INCREMENT, ENUM, SET, FK patterns
mysql-migrations/full-example.mdComplete MySQL table migrationEnd-to-end example with decision summary

PostgreSQL Migrations:

ReferenceWhen to LoadContains
pg-migrations/type-mapping.mdMUST load for PG → DSQL type questionsC collation rules, NUMERIC precision, JSON/JSONB
pg-migrations/fk-replacement.mdMUST load for FK validation code generationTenant-scoped validate_fk_*() template, cascade
pg-migrations/index-conversion.mdMUST load for unfixable index diagnosticsGIN/GiST/BRIN → btree, partial, expression indexes
pg-migrations/schema-objects.mdMUST load for ENUM, materialized views, extensions, multi-schemaENUM → CHECK, views, role/IAM mapping
pg-migrations/multi-region.mdMulti-region, active-active, or HA questionsArchitecture, geographic partitioning

ORM Guides:

ReferenceWhen to LoadContains
orm-guides/overview.mdMigrating any ORM to DSQLAdapter names, key gotchas for Django/Hibernate/Rails/SQLAlchemy

Data Loading:

ReferenceWhen to LoadContains
data-loading.mdPlanning or running bulk loads with aurora-dsql-loaderFresh-vs-warm partitions, resume/retry, --on-conflict semantics, throughput diagnostics

Query Plan Explainability:

ReferenceWhen to LoadContains
query-plan/plan-interpretation.mdMUST load at Workflow 9 Phase 0DSQL node types, Node Duration math, estimation-error bands
query-plan/catalog-queries.mdMUST load at Workflow 9 Phase 0pg_class/pg_stats/pg_indexes SQL, correlated-predicate verification
query-plan/guc-experiments.mdMUST load at Workflow 9 Phase 0GUC experiment procedures, 30-second skip protocol
query-plan/report-format.mdMUST load at Workflow 9 Phase 0Required report structure, element checklist, support request template

---

MCP Tools Available

The aurora-dsql MCP server provides these tools:

Database Operations:

1. readonly_query - Execute SELECT queries (returns list of dicts) 2. transact - Execute DDL/DML statements in transaction (takes list of SQL statements) 3. get_schema - Get table structure for a specific table

SQL Validation:

1. dsql_lint - Validate SQL for DSQL compatibility and optionally auto-fix issues. Use before executing externally-sourced SQL.

Documentation & Knowledge:

1. dsql_search_documentation - Search Aurora DSQL documentation 2. dsql_read_documentation - Read specific documentation pages 3. dsql_recommend - Get DSQL best practice recommendations

Note: There is no list_tables tool. Use readonly_query with information_schema.

See mcp-setup.md for detailed setup instructions. See mcp-tools.md for detailed usage and examples.

AWS Knowledge MCP (awsknowledge)

Consult for verifying DSQL service limits before advising users. The numeric limits below are defaults that may change — when a user's decision depends on an exact limit, verify it first:

LimitDefaultVerify query
Max rows per transaction3,000aurora dsql transaction limits
Max data size per transaction10 MiBaurora dsql transaction limits
Max transaction duration5 minutesaurora dsql transaction limits
Max connections per cluster10,000aurora dsql connection limits
Auth token expiry15 minutesaurora dsql authentication token
Max connection duration60 minutesaurora dsql connection limits
Max indexes per table24aurora dsql index limits
Max columns per index8aurora dsql index limits
IDENTITY/SEQUENCE CACHE values1 or >= 65536aurora dsql sequence cache
Supported column data typesSee docsaurora dsql supported data types

When to verify: Before recommending batch sizes, connection pool settings, or schema designs where hitting a limit would cause failures; any time the exact number can affect user decision.

Fallback: If awsknowledge is unavailable, use the defaults above and flag that limits should be verified against DSQL documentation.

CLI Scripts Available

Bash scripts in scripts/ for cluster management (create, delete, list, cluster info), psql connection, and bulk data loading from local/s3 csv/tsv/parquet files. See scripts/README.md for usage and hook configuration.

---

Quick Start

1. Explore: Use readonly_query with information_schema to list tables. Use get_schema for table structure. 2. Query: Use readonly_query for SELECT queries. MUST include tenant_id in WHERE for multi-tenant apps. MUST build SQL with safe_query.build(). 3. Schema changes: Use transact with one DDL per transaction. MUST batch DML under 3,000 rows. MUST use CREATE INDEX ASYNC in a separate call. Use dsql_lint to validate first. 4. Bulk load data: Use aurora-dsql-loader for CSV/TSV/Parquet. Load data-loading.md for details. Use --dry-run first.

---

Common Workflows

Workflow 1: Create Multi-Tenant Schema

1. Create main table with tenant_id column using transact 2. Create async index on tenant_id in separate transact call 3. Create composite indexes for common query patterns (separate transact calls) 4. Verify schema with get_schema

  • MUST include tenant_id in all tables
  • MUST use CREATE INDEX ASYNC exclusively
  • MUST issue each DDL in its own transact call: transact(["CREATE TABLE ..."])
  • MUST serialize arrays as JSONB; expand at query time with jsonb_array_elements_text(data)

Workflow 2: Safe Data Migration

MUST validate every DDL with dsql_lint(fix=true) before executing. DML does not require linting.

1. Validate DDL with dsql_lint(sql=..., fix=true) — handle diagnostics per dsql-lint.md 2. Add column: transact(["ALTER TABLE ... ADD COLUMN ..."]) 3. Populate existing rows with UPDATE (batched under 3,000 rows) 4. Verify with readonly_query COUNT 5. Create index if needed: validate then transact(["CREATE INDEX ASYNC ..."])

  • MUST issue each ALTER TABLE in its own transact call — DSQL rejects multi-DDL transactions with multiple ddl statements not supported in a transaction
  • MUST add column with only name and type; apply DEFAULT via separate UPDATE
  • MUST batch updates under 3,000 rows in separate transact calls

Recovery: Resume failed batches by filtering WHERE new_column IS NULL.

Workflow 3: Bulk Data Loading

Use aurora-dsql-loader for CSV, TSV, or Parquet loads. MUST load data-loading.md before advising on throughput or diagnosing slow loads.

1. Validate with --dry-run first 2. Run with --manifest-dir on persistent storage (not /tmp — tmpfs on AL2023, lost on crash) and --header if file has a header row 3. On failure: resume with --resume-job-id; for duplicates use --on-conflict do-nothing 4. For large tables: create secondary indexes after load using CREATE INDEX ASYNC

Workflow 4: Application-Layer Referential Integrity

INSERT: MUST validate parent exists with readonly_query → throw error if not found → insert child with transact.

DELETE: MUST check dependents with readonly_query COUNT → return error if dependents exist → delete with transact if safe.

Workflow 5: Query with Tenant Isolation

1. MUST authorize the caller against the tenant — format validation does not establish authorization 2. MUST build SQL with `safe_query.build()` — use allow()/regex() for values (emits 'v'), ident() for table/column names (emits "v"). See input-validation.md 3. MUST include tenant_id in the WHERE clause; reject cross-tenant access at the application layer

Workflow 6: Set Up Scoped Database Roles

MUST load access-control.md for role setup, IAM mapping, and schema permissions.

Workflow 7: Table Recreation DDL Migration

Use the Table Recreation Pattern for ALTER COLUMN TYPE, DROP COLUMN, DROP CONSTRAINT, or MODIFY PRIMARY KEY. This is a destructive workflow that requires user confirmation at each step. Every generated DDL in the pattern (CREATE new, INSERT ... SELECT, DROP old, RENAME) MUST be validated with dsql_lint(sql=..., fix=true) before execution.

MUST load ddl-migrations/overview.md before attempting any of these operations.

Workflow 8: Validate and Migrate to DSQL

MUST load dsql-lint.md before running dsql_lint. Run dsql_lint(sql=source_sql, fix=true) to validate and auto-convert. For MySQL-origin SQL, MUST cross-check against mysql-migrations/type-mapping.md even when lint returns clean. On parse_error, fall back to manual conversion then re-lint.

Workflow 9: Query Plan Explainability

Explains why the DSQL optimizer chose a particular plan. Triggered by slow queries, high DPU, unexpected Full Scans, or plans the user doesn't understand. REQUIRES a structured Markdown diagnostic report as the deliverable.

MUST load all four reference files at Phase 0: query-plan/plan-interpretation.md, query-plan/catalog-queries.md, query-plan/guc-experiments.md, query-plan/report-format.md. The phase procedures (capture plan, gather evidence, experiment, produce report) are defined in those files.

Safety. Plan capture uses readonly_query exclusively. Rewrite DML to SELECT for plan capture. MUST NOT use transact --allow-writes for plan capture.

Workflow 10: Full PostgreSQL → DSQL Schema Migration

MUST load pg-migrations/type-mapping.md and pg-migrations/schema-objects.md. Run dsql_lint(fix=true) first for mechanical fixes, then apply semantic conversions from the pg-migrations references for unfixable diagnostics and patterns the linter cannot handle. Re-lint the final output before deploying.

Workflow 11: ORM Migration (Django/Hibernate/Rails)

Load orm-guides/overview.md for adapter names and framework-specific gotchas.

Error Scenarios

  • `awsknowledge` returns no results: Use the default limits in the table above and note that limits should be verified against DSQL documentation.
  • `dsql_lint` unavailable or timing out: See the Error Handling section of dsql-lint.md. Do not silently skip validation — inform the user and require explicit confirmation before proceeding with manual rules from development-guide.md.
  • OCC serialization error: Retry the transaction. If persistent, check for hot-key contention — see troubleshooting.md.
  • Transaction exceeds limits: Split into batches under 3,000 rows — see batched-migration.md.
  • Token expiration mid-operation: Generate a fresh IAM token — see authentication-guide.md. See troubleshooting.md for other issues.

Additional Resources

Related skills

FAQ

What is Aurora DSQL?

A serverless, PostgreSQL-compatible distributed SQL database; this skill covers schema management, migrations, multi-tenant isolation, IAM auth, and bulk data loading.

How does it handle foreign keys?

It generates foreign-key replacement code and app-layer referential integrity, since DSQL requires different patterns than standard SQL.

Databasesdatabasesetl

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.