question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamodb batch_execute_statement not supported

See original GitHub issue

When running a batch_execute_statement, the following exception occurs:

AttributeError: 'DynamoHandler' object has no attribute 'batch_execute_statement'

Here is the complete trace:

>       result = app.lambda_handler(event, '')

tests/unit/test_merge_decode_results.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/decode_video_state_machine/merge_results/app.py:70: in lambda_handler
    results = get_data_from_secrets(secrets)
src/decode_video_state_machine/merge_results/app.py:52: in get_data_from_secrets
    results = dynamodb.batch_execute_statement(
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/client.py:357: in _api_call
    return self._make_api_call(operation_name, kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/client.py:662: in _make_api_call
    http, parsed_response = self._make_request(
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/client.py:682: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/endpoint.py:102: in make_request
    return self._send_request(request_dict, operation_model)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/endpoint.py:136: in _send_request
    while self._needs_retry(attempts, operation_model, request_dict,
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/endpoint.py:253: in _needs_retry
    responses = self._event_emitter.emit(
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:356: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:228: in emit
    return self._emit(event_name, kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:211: in _emit
    response = handler(**kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:183: in __call__
    if self._checker(attempts, response, caught_exception):
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:250: in __call__
    should_retry = self._should_retry(attempt_number, response,
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:269: in _should_retry
    return self._checker(attempt_number, response, caught_exception)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:316: in __call__
    checker_response = checker(attempt_number, response,
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:222: in __call__
    return self._check_caught_exception(
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/retryhandler.py:359: in _check_caught_exception
    raise caught_exception
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/endpoint.py:197: in _do_get_response
    responses = self._event_emitter.emit(event_name, request=request)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:356: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:228: in emit
    return self._emit(event_name, kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/botocore/hooks.py:211: in _emit
    response = handler(**kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/moto/core/models.py:322: in __call__
    status, headers, body = response_callback(
../../API-my-copy/API/venv/lib/python3.9/site-packages/moto/core/responses.py:202: in dispatch
    return cls()._dispatch(*args, **kwargs)
../../API-my-copy/API/venv/lib/python3.9/site-packages/moto/core/responses.py:312: in _dispatch
    return self.call_action()
../../API-my-copy/API/venv/lib/python3.9/site-packages/moto/core/utils.py:277: in _wrapper
    response = f(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <moto.dynamodb2.responses.DynamoHandler object at 0x1143d9d30>

    @amzn_request_id
    def call_action(self):
        self.body = json.loads(self.body or "{}")
        endpoint = self.get_endpoint_name(self.headers)
        if endpoint:
            endpoint = camelcase_to_underscores(endpoint)
>           response = getattr(self, endpoint)()
E           AttributeError: 'DynamoHandler' object has no attribute 'batch_execute_statement'

../../API-my-copy/API/venv/lib/python3.9/site-packages/moto/dynamodb2/responses.py:86: AttributeError

The code I’m running looks something like this:

import boto3

dynamodb = boto3.client('dynamodb')

statements = ... # leaving this out because I believe it is irrelevant

results = dynamodb.batch_execute_statement(
    Statements=statements
)

The reason I raise this as an issue is because the readme for the project states that “all endpoints” are supported for DynamoDB2, which led me to believe that batch_execute_statement would be supported. I just wanted to check that this is indeed not supported, and so it is expected behavior.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
bblommerscommented, Aug 26, 2021

Hi @evanhackett, thanks for raising this. Correct, this is not yet supported - looks like the README is wrong. We’ll update that soon. Will mark it as an enhancement to also implement this feature.

FWIW, there is a more up-to-date (and hopefully more accurate…) list of implemented endpoints here: https://github.com/spulec/moto/blob/master/IMPLEMENTATION_COVERAGE.md#dynamodb

0reactions
ronkorvingcommented, Dec 12, 2022

@bblommers I’m avoiding using it altogether right now, so can’t provide an example query 😅 But appreciate you sharing the issue! I searched for select_object_content in the issue tracker and didn’t find anything, but it seems my search wasn’t broad enough. I’m thrilled to see interest in the matter. I’ll stop distracting from this DynamoDB issue now 🙇

Read more comments on GitHub >

github_iconTop Results From Across the Web

BatchExecuteStatement - Amazon DynamoDB
This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL. Each read statement in a BatchExecuteStatement...
Read more >
amazon-dynamodb-developer-guide/ql-reference ... - GitHub
(Required) A PartiQL for DynamoDB supported statement. The entire batch must consist of either read statements or write statements; you cannot mix both...
Read more >
dynamodb PartiQL SELECT query returns ValidationException
I interpret it as referring to that the tableName (in from) in the select query is not correct but the name is matching...
Read more >
DynamoDB with PartiQL - DEV Community ‍ ‍
Because PartiQL is supported for all DynamoDB data-plane operations, ... aws dynamodb batch-execute-statement --statements ...
Read more >
How to use PartiQL with DynamoDB in Node.js | by Marco Lüthy
A quick primer showing how to use PartiQL to query DynamoDB with Node.js ... in an error: ValidationException: Aliasing is not supported ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found