feat(databases-on-aws): add VALIDATE CONSTRAINT ASYNC guidance for DSQL - #238
Open
agarwal-govind wants to merge 2 commits into
Open
feat(databases-on-aws): add VALIDATE CONSTRAINT ASYNC guidance for DSQL#238agarwal-govind wants to merge 2 commits into
agarwal-govind wants to merge 2 commits into
Conversation
agarwal-govind
requested review from
a team,
krokoko,
scottschreckengaust and
theagenticguy
July 21, 2026 22:55
agarwal-govind
requested review from
Benjscho,
Morlej,
gxjx-x,
jaichabria,
pkale,
praba2210 and
spencercorwin
July 21, 2026 22:55
Member
|
Looks like the formatter failed, can you run and/or and amend the commit? |
anwesham-lab
pushed a commit
to awslabs/aurora-dsql-tools
that referenced
this pull request
Jul 22, 2026
…#112) ## Summary DSQL now supports `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` (the `ASYNC` keyword is required), following the same async DDL pattern as `CREATE INDEX ASYNC`. This updates `dsql-lint` so the `VALIDATE CONSTRAINT` diagnostic guides users to the correct ASYNC form instead of rejecting the operation as unsupported. See the [Aurora DSQL ALTER TABLE docs](https://docs.aws.amazon.com/aurora-dsql/latest/userguide/working-with-postgresql-compatibility.html) for the newly announced support. ## Changes - Rename `LintRule::AtUnsupportedValidateConstraint` → `ValidateConstraintAsync` - Change the diagnostic from "not supported in DSQL" to "requires the ASYNC keyword in DSQL", suggesting `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` (monitor via `sys.jobs`) - Update `fixture_for_rule()` for the renamed variant ## Note on scope Kept as `Unfixable` for now: `sqlparser-dsql` 0.62.1 cannot yet parse the `ALTER TABLE ASYNC` form, so auto-fix and clean-pass of the valid ASYNC syntax will follow once the parser supports it. ## Testing `cargo test` in `dsql-lint/` — all tests pass. --- **Part of the `VALIDATE CONSTRAINT ASYNC` rollout across the DSQL ecosystem:** - dsql-lint: #112 - agent-plugins (canonical steering): awslabs/agent-plugins#238 - mcp (mirror steering): awslabs/mcp#4300
agarwal-govind
force-pushed
the
enable-validate-constraint-async
branch
from
July 22, 2026 21:39
9bcfe41 to
13e0877
Compare
DSQL now supports adding CHECK constraints with NOT VALID and validating them asynchronously via ALTER TABLE ASYNC ... VALIDATE CONSTRAINT. Add this as the preferred approach for CHECK constraints (avoids full table recreation), following the same async DDL pattern as CREATE INDEX ASYNC. - constraint-operations.md: add 'ADD CHECK CONSTRAINT (Preferred)' section (NOT VALID -> VALIDATE CONSTRAINT ASYNC -> monitor via sys.jobs); split the old ADD CONSTRAINT section so UNIQUE/PK keep table recreation - development-guide.md: add the ASYNC validate-constraint DDL rule and Quick Reference example alongside CREATE INDEX ASYNC - SKILL.md: add VALIDATE CONSTRAINT to the constraint-operations load trigger; align DDL Migrations table column widths - Bump databases-on-aws plugin + marketplace to 1.7.0
agarwal-govind
force-pushed
the
enable-validate-constraint-async
branch
from
July 22, 2026 23:46
59c2446 to
051fd7f
Compare
amaksimo
approved these changes
Aug 3, 2026
amaksimo
enabled auto-merge
August 3, 2026 23:34
amaksimo
added a commit
to awslabs/aurora-dsql-orms
that referenced
this pull request
Aug 3, 2026
… Django, SQLAlchemy, Hibernate (#528) ## Summary DSQL now supports adding `CHECK` constraints to existing tables via `ALTER TABLE ... ADD CONSTRAINT ... NOT VALID` followed by an asynchronous `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT`, and supports inline `CHECK` constraints at `CREATE TABLE`. This PR enables real `CHECK` constraint support across the Django, SQLAlchemy, and Hibernate adapters, which previously skipped or disabled it. ## Changes ### Django (`python/django`) - `features.py`: `supports_table_check_constraints = True`. - `schema.py`: `sql_create_check` emits `ADD CONSTRAINT ... CHECK (...) NOT VALID`; `add_constraint` issues `ALTER TABLE ASYNC ... VALIDATE CONSTRAINT` as a follow-up so existing rows are validated. Removed the old skip logic (inline CREATE TABLE checks and `DROP CONSTRAINT` are supported). - `reference/ADAPTER_BEHAVIOR.md`: replaced the "check constraints skipped" section with async-validation behavior and the `NOT VALID` caveat. ### SQLAlchemy (`python/sqlalchemy`) - `base.py`: override `visit_add_constraint` to append `NOT VALID` for `CheckConstraint` (non-CHECK unaffected). `supports_alter` stays `False` (it also gates FK/PK-via-ALTER auto-ordering, still unsupported). The async `VALIDATE CONSTRAINT` step is run separately (e.g. `op.execute(...)` in Alembic), documented in the README. - Inline `CHECK` at `CREATE TABLE` already worked and is unchanged. ### Hibernate (`java/hibernate`) - `AuroraDSQLDialect.java`: `supportsColumnCheck()` returns `true` (inline column CHECK at CREATE TABLE). ## Behavior caveat `VALIDATE CONSTRAINT ASYNC` returns immediately; validation of existing rows runs as an async DDL job. The constraint is enforced on new writes right away. If existing rows violate it, the async job fails and the constraint stays `NOT VALID` (track via `sys.jobs`). ## Testing - Unit tests pass: Django (`pytest` schema + features), SQLAlchemy compiler assertions, Hibernate (`gradlew test`). - **Verified end-to-end against a gamma DSQL cluster** for all three: inline CREATE TABLE checks; post-creation `ADD CONSTRAINT ... NOT VALID` + `VALIDATE CONSTRAINT ASYNC` (job `submitted` → `completed`, constraint enforced); async failure on dirty data (`sys.jobs` status `failed`, constraint stays `NOT VALID`); and confirmed a plain `ADD CONSTRAINT ... CHECK` without `NOT VALID` is rejected by DSQL. --- **Part of the `VALIDATE CONSTRAINT ASYNC` rollout across the DSQL ecosystem:** - dsql-lint: awslabs/aurora-dsql-tools#112 - agent-plugins (canonical steering): awslabs/agent-plugins#238 - mcp (mirror steering): awslabs/mcp#4300 - aurora-dsql-orms (this PR) --- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the [project license](https://github.com/awslabs/aurora-dsql-orms/blob/main/LICENSE). --------- Co-authored-by: Aleksandar Maksimovic <amaksimovic3@hotmail.com>
spencercorwin
approved these changes
Aug 3, 2026
jaichabria
approved these changes
Aug 4, 2026
pkale
approved these changes
Aug 4, 2026
pkale
left a comment
There was a problem hiding this comment.
Lgtm! Once this change goes in, we should add some eval tests to the agent to confirm that the agents behave in the expected manner as per the "preferred guidelines" provided in this ski update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DSQL now supports adding CHECK constraints with
NOT VALIDand validating them asynchronously viaALTER TABLE ASYNC ... VALIDATE CONSTRAINT. This adds that as the preferred approach for CHECK constraints (avoids full table recreation), following the same async DDL pattern asCREATE INDEX ASYNC.This is the canonical steering home; the mirror in
awslabs/mcpis updated in a sibling PR (see below).Changes
constraint-operations.md: add "ADD CHECK CONSTRAINT (Preferred)" section —NOT VALID→VALIDATE CONSTRAINT ASYNC→ monitor viasys.jobs/sys.wait_for_job. Split the old ADD CONSTRAINT section so UNIQUE/PK keep the table recreation pattern (only CHECK supportsNOT VALID).development-guide.md: add the ASYNC validate-constraint DDL rule and a Quick Reference example alongsideCREATE INDEX ASYNC.SKILL.md: addVALIDATE CONSTRAINTto the constraint-operations load trigger.databases-on-awsplugin (.claude-plugin+.codex-plugin) andmarketplace.jsonto1.7.0.Part of the
VALIDATE CONSTRAINT ASYNCrollout across the DSQL ecosystem:Contributor Statement:
"By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license."