From 6f9eca32267e8a826bad72456397eb9b3fbc2b21 Mon Sep 17 00:00:00 2001 From: Guilherme Morone Date: Thu, 6 Apr 2023 17:39:34 -0300 Subject: [PATCH] DynamoDB resource bug fixed --- .github/workflows/publish.yml | 4 ++-- pyproject.toml | 2 +- pyscora_wrangler/aws/dynamodb/__init__.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c0ec0b8..ab1dd67 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,8 +35,8 @@ jobs: uses: marvinpinto/action-automatic-releases@v1.2.1 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - title: 'v1.1.2 Ldap module added' + title: 'v1.1.3 DynamoDB resource bug fixed' prerelease: false - automatic_release_tag: v1.1.2 + automatic_release_tag: v1.1.3 files: | LICENSE diff --git a/pyproject.toml b/pyproject.toml index 39cab7e..47a3295 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pyscora-wrangler" -version = "1.1.2" +version = "1.1.3" description = "Python lib for DE" authors = ["Oncase "] maintainers = ["Guilherme Morone "] diff --git a/pyscora_wrangler/aws/dynamodb/__init__.py b/pyscora_wrangler/aws/dynamodb/__init__.py index 0e7e532..33424fa 100644 --- a/pyscora_wrangler/aws/dynamodb/__init__.py +++ b/pyscora_wrangler/aws/dynamodb/__init__.py @@ -98,11 +98,11 @@ def get_data_by_key( """ session = get_boto3_session(boto3_session) - client = session.client(DYNAMODB_SERVICE_NAME) + resource = session.resource(DYNAMODB_SERVICE_NAME) data = None - dynamo_table = client.Table(table_name) + dynamo_table = resource.Table(table_name) response = dynamo_table.query(KeyConditionExpression=Key(key).eq(value)) response = response.get("Items", []) @@ -167,9 +167,9 @@ def put_item( """ session = get_boto3_session(boto3_session) - client = session.client(DYNAMODB_SERVICE_NAME) + resource = session.resource(DYNAMODB_SERVICE_NAME) - table = client.Table(table_name) + table = resource.Table(table_name) encoded_data = get_data_encoded(data) if encode_data else data item = table.put_item(Item=encoded_data, *dynamodb_additional_args, **dynamodb_additional_kwargs)