Skip to content

feat: add contract delete SDK methods (DQ-665)#903

Merged
Aryamanz29 merged 2 commits intomainfrom
dq-665-contract-delete-sdk
Apr 21, 2026
Merged

feat: add contract delete SDK methods (DQ-665)#903
Aryamanz29 merged 2 commits intomainfrom
dq-665-contract-delete-sdk

Conversation

@shivahanumanthula-atlan
Copy link
Copy Markdown
Contributor

Summary

  • Adds client.contracts.delete(guid) — hard-deletes all versions of a data contract and cleans up asset attributes
  • Adds client.contracts.delete_latest_version(guid) — hard-deletes only the latest version, promotes previous version
  • Adds extra_headers param to _call_api() for per-request custom headers (used by delete_latest_version to pass x-atlan-contract-delete-scope: single)
  • Implemented across all 4 client variants: sync/async × legacy(pydantic v1)/v9(msgspec)

Files changed (9)

File Change
pyatlan/client/protocol.py Added extra_headers=None to ApiCaller and AsyncApiCaller Protocol
pyatlan/client/atlan.py Added extra_headers param to _call_api()
pyatlan/client/aio/client.py Added extra_headers param to async _call_api()
pyatlan/client/contract.py Added delete() and delete_latest_version()
pyatlan/client/aio/contract.py Added async delete() and delete_latest_version()
pyatlan_v9/client/atlan.py Added extra_headers param to _call_api()
pyatlan_v9/client/aio/atlan.py Added extra_headers param to async _call_api()
pyatlan_v9/client/contract.py Added delete() and delete_latest_version() using _parse_mutation_response()
pyatlan_v9/client/aio/contract.py Added async delete() and delete_latest_version() using _parse_mutation_response()

Usage

# Delete all versions of a contract
response = client.contracts.delete(contract_guid)

# Delete only the latest version (promotes previous)
response = client.contracts.delete_latest_version(latest_guid)

Backend PR

Test plan

  • E2E tested on dq-dev with FCT_ORDERS asset (V1-V10 VERIFIED + V11 DRAFT)
  • Verified delete-latest correctly promotes previous version
  • Verified delete-all cascade removes all versions and cleans asset
  • Unit tests for new methods

🤖 Generated with Claude Code

…(DQ-665)

Adds SDK support for DataContract deletion — both delete-all (cascade)
and delete-latest-only modes — across sync/async and legacy/v9 clients.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread pyatlan/client/atlan.py Outdated
Comment thread pyatlan/client/contract.py Outdated
Comment thread pyatlan/client/protocol.py Outdated
@Aryamanz29 Aryamanz29 self-assigned this Apr 20, 2026
@Aryamanz29 Aryamanz29 added feature New feature or request bugfix Bug fix pull request labels Apr 20, 2026
…e (DQ-665)

- Add DataContractSpec unit tests (parsing, mutation, YAML roundtrip) and
  ContractClient unit tests (generate_initial_spec, delete, delete_latest_version
  header assertions) to both pyatlan and pyatlan_v9 test suites
- Add sync integration tests for generate_initial_spec, spec-based contract
  creation, delete_all, and delete_latest_version (xfail: Atlas NPE on dq-dev
  until backend version-chain schema is deployed) in data_mesh_test.py and v9
- Add async integration tests for the same scenarios in aio/test_client.py
  for both pyatlan and pyatlan_v9
- Move CONTRACT_DELETE_SCOPE_HEADER constant from contract.py / aio/contract.py
  into pyatlan/client/constants.py (single source of truth across 4 files)
- Add Optional[Dict[str, str]] type hints to extra_headers param in atlan.py,
  aio/client.py, and protocol.py (ApiCaller + AsyncApiCaller)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Aryamanz29 Aryamanz29 disabled auto-merge April 20, 2026 12:37
Copy link
Copy Markdown
Member

@Aryamanz29 Aryamanz29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @shivahanumanthula-atlan!

@Aryamanz29 Aryamanz29 merged commit a34d753 into main Apr 21, 2026
71 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix pull request feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants