Skip to content

fix(athena): cancelling a connection cancels the athena query #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Jrmyy
Copy link
Contributor

@Jrmyy Jrmyy commented Mar 5, 2025

resolves #406

Problem

When a dbt invocation is canceled, the query still runs in Athena, leading to error such as Destination table already exists and concurrent requests creating the same table (the one not cancelled and the new one relaunched by the retry).

Solution

The issue was that the cancel_open in the ConnectionsManager was not implemented. I changed the way the Connection is aware of the current cursors and requests running, and creating a cancel method in the Connection cancelling all the requests of the cursors.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

Copy link

cla-bot bot commented Mar 5, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @Jrmyy

Copy link
Contributor

github-actions bot commented Mar 5, 2025

Thank you for your pull request! We could not find a changelog entry for this change in the dbt-athena package. For details on how to document a change, see the Contributing Guide.

Copy link

cla-bot bot commented Mar 5, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @Jrmyy

Copy link

cla-bot bot commented Mar 5, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @Jrmyy

@cla-bot cla-bot bot added the cla:yes The PR author has signed the CLA label Mar 5, 2025
@Jrmyy Jrmyy marked this pull request as ready for review March 6, 2025 09:12
@Jrmyy Jrmyy requested a review from a team as a code owner March 6, 2025 09:12
@colin-rogers-dbt
Copy link
Contributor

@cla-bot recheck

@Jrmyy
Copy link
Contributor Author

Jrmyy commented Mar 31, 2025

👋🏻 Hello @colin-rogers-dbt, what would be the next steps for this PR? It is not critical but a little bit annoying to cancel a dbt invocation without cancelling the athena query, which leads to concurrent queries creating the same table...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes The PR author has signed the CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Cancelling dbt invocation does not cancel the query on Athena
2 participants