Skip to content

Commit

Permalink
Fix wrong role create db#285 (aws-samples#286)
Browse files Browse the repository at this point in the history
* first commit

* always pass glue session credentials to the client

* revert first commit

* indent

* keep use_interactive_session_role_for_api_calls but change the default value to True

---------

Co-authored-by: Vincent.PAUWELS <vincent.pauwels@airliquide.com>
  • Loading branch information
sanga8 and Vincent.PAUWELS authored Dec 14, 2023
1 parent d2d31f1 commit 1416de8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/glue/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GlueCredentials(Credentials):
seed_mode: Optional[str] = "overwrite"
default_arguments: Optional[str] = None
iceberg_glue_commit_lock_table: Optional[str] = "myGlueLockTable"
use_interactive_session_role_for_api_calls: bool = False
use_interactive_session_role_for_api_calls: bool = True
lf_tags: Optional[str] = None
glue_session_id: Optional[str] = None
glue_session_reuse: Optional[bool] = False
Expand Down
14 changes: 7 additions & 7 deletions dbt/adapters/glue/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def get_connection(self):
RoleSessionName="dbt"
)
credentials = assumed_role_object['Credentials']
session = boto3.Session(
aws_access_key_id=credentials['AccessKeyId'],
aws_secret_access_key=credentials['SecretAccessKey'],
aws_session_token=credentials['SessionToken']
)
glue_client = boto3.client("glue", region_name=glueSession.credentials.region,
aws_access_key_id=credentials['AccessKeyId'],
aws_secret_access_key=credentials['SecretAccessKey'],
aws_session_token=credentials['SessionToken'])
return glueSession, glue_client

client = boto3.client("glue", region_name=glueSession.credentials.region)
glue_client = boto3.client("glue", region_name=glueSession.credentials.region)

return glueSession, client
return glueSession, glue_client

def list_schemas(self, database: str) -> List[str]:
session, client = self.get_connection()
Expand Down

0 comments on commit 1416de8

Please sign in to comment.