Skip to content
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

Add AWS Athena profile mapping #578

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

benjamin-awd
Copy link
Contributor

@benjamin-awd benjamin-awd commented Oct 6, 2023

Description

This PR adds an Athena profile mapping using the aws connection type (unfortunately, there is no specific connection type for Athena, unlike Redshift).

This PR allows the user to avoid storing sensitive credentials in a profiles.yml file on Airflow, and instead store them in Airflow as an AWS connection.

Related Issue(s)

Closes #201

Checklist

  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works

@benjamin-awd benjamin-awd requested a review from a team as a code owner October 6, 2023 07:51
@benjamin-awd benjamin-awd requested a review from a team October 6, 2023 07:51
@netlify
Copy link

netlify bot commented Oct 6, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit 0e08feb
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/652005e1fa0f2a00087a68bc

Copy link
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution, @benjamin-awd. It looks great!
I left minor comments. I'll approve and merge once the checks pass.

cosmos/profiles/athena/access_key.py Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@tatiana tatiana added this to the 1.2.0 milestone Oct 6, 2023
@pre-commit-ci pre-commit-ci bot temporarily deployed to external October 6, 2023 11:12 Inactive
@benjamin-awd benjamin-awd temporarily deployed to external October 6, 2023 11:30 — with GitHub Actions Inactive
@benjamin-awd
Copy link
Contributor Author

Hi @tatiana -- changes made, let me know if there's anything else

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (435a699) 92.83% compared to head (0e08feb) 92.90%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #578      +/-   ##
==========================================
+ Coverage   92.83%   92.90%   +0.06%     
==========================================
  Files          49       51       +2     
  Lines        1983     2000      +17     
==========================================
+ Hits         1841     1858      +17     
  Misses        142      142              
Files Coverage Δ
cosmos/profiles/__init__.py 96.29% <100.00%> (+0.14%) ⬆️
cosmos/profiles/athena/__init__.py 100.00% <100.00%> (ø)
cosmos/profiles/athena/access_key.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tatiana
Copy link
Collaborator

tatiana commented Oct 6, 2023

Hi @tatiana -- changes made, let me know if there's anything else

Thank you very much, @benjamin-awd ! If you could improve the code coverage, by addressing the following comments, it would be great.

Screenshot 2023-10-06 at 13 08 51

@benjamin-awd benjamin-awd temporarily deployed to external October 6, 2023 13:04 — with GitHub Actions Inactive
@benjamin-awd
Copy link
Contributor Author

benjamin-awd commented Oct 6, 2023

@tatiana

If you could improve the code coverage, by addressing the following comments, it would be great.

I realized that the mock profile wasn't actually needed, so I removed it -- the other profile mappings that add the child mock_profile property do so in order to add specific default values.

@tatiana tatiana merged commit 3786703 into astronomer:main Oct 10, 2023
39 checks passed
@tatiana tatiana mentioned this pull request Oct 13, 2023
tatiana added a commit that referenced this pull request Oct 13, 2023
**Features**

* Add support to model versioning available since dbt 1.6 by @binhnq94
in #516
* Add AWS Athena profile mapping by @benjamin-awd in #578
* Support customizing how dbt nodes are converted to Airflow by @tatiana
in #503
* Make the arg ``dbt_project_path`` in the ``ProjectConfig`` optional by
@MrBones757 in #581

**Bug fixes**

* Fix Cosmos custom selector to support filtering a single model by
@jlaneve and @harels in #576
* Fix using ``GoogleCloudServiceAccountDictProfileMapping`` together
with ``LoadMethod.DBT_LS`` by @joppevos in #587
* Fix using the ``full_refresh`` argument in projects that contain tests
by @EgorSemenov and @tatiana in #590
* Stop creating symbolic links for ``dbt_packages`` (solves
``LocalExecutor`` concurrency issue) by @tatiana in #600

**Others**

* Docs: add reference to original Jaffle Shop project by @erdos2n in
#583
* Docs: retries & note about DagBag error by @TJaniF in #592
* pre-commit updates in #575 and #585
@tatiana
Copy link
Collaborator

tatiana commented Oct 13, 2023

@benjamin-awd This was released as part of 1.2:

@@ -21,6 +22,7 @@
from .trino.ldap import TrinoLDAPProfileMapping

profile_mappings: list[Type[BaseProfileMapping]] = [
AthenaAccessKeyProfileMapping,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, should this have been included in the all export on line 60?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good spot.

I have an upcoming PR for the Athena profile mapping, so I'll probably squeeze the fix in there.

This shouldn't affect anyone, unless they're doing from cosmos.profiles import *

tatiana pushed a commit that referenced this pull request Nov 10, 2023
Adds the `aws_session_token` argument to Athena, which was added to
dbt-athena 1.6.4 in dbt-labs/dbt-athena#459

Closes: #609

Also addresses this comment:
#578 (comment)
arojasb3 pushed a commit to arojasb3/astronomer-cosmos that referenced this pull request Jul 14, 2024
Adds the `aws_session_token` argument to Athena, which was added to
dbt-athena 1.6.4 in dbt-labs/dbt-athena#459

Closes: astronomer#609

Also addresses this comment:
astronomer#578 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

community connectors support (athena)
3 participants