Skip to content

Commit eb10682

Browse files
Use the region name from the database ARN (#61)
1 parent cb4fb8f commit eb10682

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pydataapi/pydataapi.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,13 @@ def __init__(
462462
self.secret_arn: str = secret_arn
463463
self.database: Optional[str] = database
464464

465+
client_kwargs = {}
466+
region_name = resource_arn.split(':')[3]
467+
if region_name:
468+
client_kwargs['region_name'] = region_name
469+
465470
self._transaction_id: Optional[str] = transaction_id
466-
self._client: boto3.session.Session.client = client or boto3.client('rds-data')
471+
self._client: boto3.session.Session.client = client or boto3.client('rds-data', **client_kwargs)
467472
self._transaction_status: Optional[str] = None
468473
self.rollback_exception: Optional[Type[Exception]] = rollback_exception
469474

0 commit comments

Comments
 (0)