Skip to content

Commit 34efdc6

Browse files
committed
Creating skeleton to receive DynamoDB features
1 parent 117fe02 commit 34efdc6

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

awswrangler/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from awswrangler.aurora import Aurora # noqa
1414
from awswrangler.emr import EMR # noqa
1515
from awswrangler.sagemaker import SageMaker # noqa
16+
from awswrangler.dynamodb import DynamoDB # noqa
1617
import awswrangler.utils # noqa
1718
import awswrangler.data_types # noqa
1819

@@ -51,6 +52,7 @@ def __getattr__(self, name):
5152
athena: Athena = DynamicInstantiate("athena", Athena) # type: ignore
5253
aurora: Aurora = DynamicInstantiate("aurora", Aurora) # type: ignore
5354
redshift: Redshift = DynamicInstantiate("redshift", Redshift) # type: ignore
55+
dynamodb: DynamoDB = DynamicInstantiate("dynamodb", DynamoDB) # type: ignore
5456
sagemaker: SageMaker = DynamicInstantiate("sagemaker", SageMaker) # type: ignore
5557
cloudwatchlogs: CloudWatchLogs = DynamicInstantiate("cloudwatchlogs", CloudWatchLogs) # type: ignore
5658

awswrangler/dynamodb.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import TYPE_CHECKING
2+
from logging import getLogger, Logger
3+
4+
from boto3 import client # type: ignore
5+
6+
if TYPE_CHECKING:
7+
from awswrangler.session import Session
8+
9+
logger: Logger = getLogger(__name__)
10+
11+
12+
class DynamoDB:
13+
def __init__(self, session: "Session"):
14+
self._session: "Session" = session
15+
self._client_dynamodb: client = session.boto3_session.client(service_name="dynamodb",
16+
use_ssl=True,
17+
config=session.botocore_config)

awswrangler/session.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from awswrangler.aurora import Aurora
1616
from awswrangler.emr import EMR
1717
from awswrangler.sagemaker import SageMaker
18+
from awswrangler.dynamodb import DynamoDB
1819
from awswrangler.exceptions import AWSCredentialsNotFound
1920

2021
PYSPARK_INSTALLED: bool = False
@@ -120,6 +121,7 @@ def __init__(self,
120121
self._aurora: Optional[Aurora] = None
121122
self._spark: Optional[Spark] = None
122123
self._sagemaker: Optional[SageMaker] = None
124+
self._dynamodb: Optional[DynamoDB] = None
123125

124126
def _load_new_boto3_session(self) -> None:
125127
"""
@@ -310,6 +312,12 @@ def sagemaker(self) -> SageMaker:
310312
self._sagemaker = SageMaker(session=self)
311313
return self._sagemaker
312314

315+
@property
316+
def dynamodb(self) -> DynamoDB:
317+
if self._dynamodb is None:
318+
self._dynamodb = DynamoDB(session=self)
319+
return self._dynamodb
320+
313321
@property
314322
def spark(self):
315323
if PYSPARK_INSTALLED is False:

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pytest-cov~=2.8.1
55
scikit-learn~=0.22.1
66
cfn-lint~=0.27.2
77
twine~=3.1.1
8-
wheel~=0.33.6
8+
wheel~=0.34.0
99
sphinx~=2.3.1
1010
pyspark~=2.4.4
1111
pyspark-stubs~=2.4.0.post7

0 commit comments

Comments
 (0)