Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Unreleased changes
## Fixes
- Allow `sql.s3_to_postgres()` to rely on an IAM role by omitting `aws_commons.create_aws_credentials()` when the S3 connection has no login or password.

# ea_airflow_util v0.4.1
## Fixes
- Explicitly pass `bucket_name` into all method calls to `S3Hook`.


# ea_airflow_util v0.4.0
## New features
- Add `snowflake_keypair` callable for generating Snowflake RSA keypairs and rotating Snowflake user public keys.
Expand Down
8 changes: 6 additions & 2 deletions ea_airflow_util/callables/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ def s3_to_postgres(
elif truncate and delete_qry:
raise ValueError('Only specify one of truncate, delete_qry')

aws_credentials = ''
if s3_creds.login or s3_creds.password:
aws_credentials = f""",
aws_commons.create_aws_credentials('{s3_creds.login}', '{s3_creds.password}', '')"""

copy_qry = f"""
select aws_s3.table_import_from_s3(
'{dest_table}',
'{column_customization}',
'{options}',
aws_commons.create_s3_uri('{s3_bucket}', '{s3_key}', '{s3_region}'),
aws_commons.create_aws_credentials('{s3_creds.login}', '{s3_creds.password}', '')
aws_commons.create_s3_uri('{s3_bucket}', '{s3_key}', '{s3_region}'){aws_credentials}
);
"""

Expand Down