Skip to content

Commit

Permalink
switch to updating the default session
Browse files Browse the repository at this point in the history
  • Loading branch information
frctnlss committed Apr 5, 2024
1 parent 66c27c3 commit 7c02ec4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions target_s3_parquet/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from typing import Dict, List, Optional
import awswrangler as wr
from boto3.session import Session
from boto3 import setup_default_session
from pandas import DataFrame
from singer_sdk import Target
from singer_sdk.sinks import BatchSink
Expand Down Expand Up @@ -36,10 +36,11 @@ def __init__(
) -> None:
super().__init__(target, stream_name, schema, key_properties)

self._session = Session() if self._is_using_hmac() else Session(
aws_access_key_id=self.config.get("aws_access_key_id"),
aws_secret_access_key=self.config.get("aws_secret_access_key"),
)
if self._is_using_hmac():
setup_default_session(
aws_access_key_id=self.config.get("aws_access_key_id"),
aws_secret_access_key=self.config.get("aws_secret_access_key"),
)

self._glue_schema = self._get_glue_schema()

Expand Down Expand Up @@ -102,7 +103,6 @@ def process_batch(self, context: dict) -> None:
partition_cols=["_sdc_started_at"],
schema_evolution=True,
dtype=dtype,
boto3_session=self._session,
)

self.logger.info(f"Uploaded {len(context['records'])}")
Expand Down

0 comments on commit 7c02ec4

Please sign in to comment.