-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-2860] Add IAM Authentication to dbt-postgres #8187
[CT-2860] Add IAM Authentication to dbt-postgres #8187
Conversation
66d8c77
to
7a66fe3
Compare
7a66fe3
to
81ba4a6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8187 +/- ##
==========================================
- Coverage 86.22% 83.02% -3.21%
==========================================
Files 174 174
Lines 25515 25498 -17
==========================================
- Hits 22001 21169 -832
- Misses 3514 4329 +815 ☔ View full report in Codecov by Sentry. |
81ba4a6
to
532d392
Compare
I have fixed the tests. Also tested it against a real Amazon RDS for PostgreSQL using IAM Auth, which worked for me without any issue. |
46274f0
to
30de338
Compare
I have changed the The classmethod I have changed it, so that the dataclass
This way |
30de338
to
6760e82
Compare
6760e82
to
8917638
Compare
This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days. |
Thanks for taking the time to open this PR @christopherscholz! Since opening, we've decoupled dbt Adapters from dbt Core, and this code now lives in a separate repo: dbt-postgres. A consequence of the decoupling is that PR can't be merged anymore as is, so we're closing it. For more context see #9171. The linked issue has already been transferred. Please don't hesitate to re-open your proposed code changes within this PR in the dbt-postgres repo. |
resolves dbt-labs/dbt-postgres#14
docs #3798
Problem
It is not possible to use AWS IAM Authentication with dbt-postgres.
Solution
This adds IAM Authentication to dbt-postgres in order to connect to Amazon RDS Aurora PostgreSQL and Amazon RDS for PostgreSQL.
It does it in the same fashion as dbt-redshift. It is refactoring the connection function by providing it through a connection factory.
The following profile configurations change
password
becomes optionalmethod
is added: defaultdatabase
; options:database
,iam
iam_profile
is added: defaultNone
, used to overwrite default AWS IAM profileregion is
added: defaultNone
, used to overwrite default AWS RegionIf
iam
is chosen asmethod
, then before connecting to the PostgreSQL db usingpsycopg2.connect
, it wouldgenerate_db_auth_token
and pass it to kwargs as passwordif
method
is not set or set todatabase
, the current password connection is usedChecklist