Skip to content

Add debug logging and fix exception handling in DynamoDB hook#64629

Merged
potiuk merged 1 commit intoapache:mainfrom
shivaam:fix/dynamodb-debug-logging-exception-handling
Apr 2, 2026
Merged

Add debug logging and fix exception handling in DynamoDB hook#64629
potiuk merged 1 commit intoapache:mainfrom
shivaam:fix/dynamodb-debug-logging-exception-handling

Conversation

@shivaam
Copy link
Copy Markdown
Contributor

@shivaam shivaam commented Apr 2, 2026

Part of the Debugging Improvements — Airflow 3 project. I am not sure if the project is still active as the last activity was in Oct 2024

Add debug logging and fix exception handling in the DynamoDB hook
(write_batch_data and get_import_status), following the pattern
established by the Airbyte provider in #51503.

Debug logging:
Add DEBUG-level logs before/after API calls — table loading, batch
write start/complete, and describe_import calls with response details.

Exception handling:

  • Add from e exception chaining to preserve __cause__ in tracebacks
  • Replace raise e with bare raise to avoid extra traceback frame
  • Include import_arn in the ImportNotFoundException error message

Testing: Existing tests in test_dynamodb.py pass unchanged —
assertions use exception type checks and substring matching, both
compatible with these changes.

If this approach looks good, I plan to apply the same pattern to
other AWS provider hooks (RDS, SQS, EC2, Lambda, etc.).


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 4.6)

Generated-by: Claude Code (Claude Opus 4.6) following the guidelines

- Add debug logging before/after API calls in write_batch_data and
  get_import_status, following the pattern established in the Airbyte
  provider (PR apache#51503)
- Fix exception chaining: add `from e` to preserve __cause__ so
  tracebacks show the full causal chain
- Fix `raise e` → bare `raise` in get_import_status to avoid adding
  a misleading extra frame to the traceback
- Include import_arn in ImportNotFoundException error message for
  easier debugging
- Rename shadowing variable `describe_import` → `response`
- Rename `general_error` → `e` for consistency

Part of the Airflow 3 Debugging Improvements initiative.
@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Apr 2, 2026
@shivaam shivaam marked this pull request as ready for review April 2, 2026 15:39
@shivaam shivaam requested a review from o-nikolas as a code owner April 2, 2026 15:39
@potiuk potiuk merged commit e89163b into apache:main Apr 2, 2026
179 of 181 checks passed
shivaam added a commit to shivaam/airflow that referenced this pull request Apr 3, 2026
- Add debug logging before/after API calls in all four hooks,
  following the pattern from the Airbyte provider (apache#51503) and
  DynamoDB hook (apache#64629)
- Fix `raise e` → bare `raise` in RDS hook (get_export_task_state,
  get_event_subscription_state) to avoid misleading extra traceback
  frames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants