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.

sqs get_queue_attributes() has the wrong type for AttributeNames

See original GitHub issue

Describe the bug The boto3 documentation clearly state that AttributeNames has over 20 valid values, but mypy_boto3 is giving it the QueueAttributeFilterType literals which only has 10 different values.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html#SQS.Client.get_queue_attributes

To Reproduce Steps to reproduce the behavior:

  1. Install boto3-stubs[sqs]
  2. Run mypy/pyright on the following code sample
import boto3

import mypy_boto3_sqs

sqs_client: mypy_boto3_sqs.Client = boto3.client('sqs')
sqs_client.get_queue_attributes(QueueUrl='anything', AttributeNames=('LastModifiedTimestamp',))

Argument “AttributeNames” to “get_queue_attributes” of “SQSClient” has incompatible type “Tuple[str]”; expected “Sequence[Literal[‘AWSTraceHeader’, ‘All’, ‘ApproximateFirstReceiveTimestamp’, ‘ApproximateReceiveCount’, ‘MessageDeduplicationId’, ‘MessageGroupId’, ‘SenderId’, ‘SentTimestamp’, ‘SequenceNumber’, ‘SqsManagedSseEnabled’]]” [arg-type] (7:41)


In mypy_boto3_sqs.client.pyi:
```python
    def get_queue_attributes(
        self, *, QueueUrl: str, AttributeNames: Sequence[QueueAttributeFilterType] = ...
    ) -> GetQueueAttributesResultTypeDef:

should be:

    def get_queue_attributes(
        self, *, QueueUrl: str, AttributeNames: Sequence[QueueAttributeNameType] = ...
    ) -> GetQueueAttributesResultTypeDef:

Additional context macOS 12.5.1, Python 3.10.6.

pip install boto3==1.24.59 'boto3-stubs[sqs]==1.24.59'

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
sodulcommented, Aug 25, 2022

@vemel it worked for me. Thanks for the quick turnaround!

0reactions
vemelcommented, Aug 25, 2022

Fixed in mypy-boto3-sqs1.24.60.

Please check and let me know if it works as it should.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetQueueAttributes - Amazon Simple Queue Service
The URL of the Amazon SQS queue whose attribute information is retrieved. Queue URLs and names are case-sensitive. Type: String. Required: Yes. Response ......
Read more >
SQS.ReceiveMessage has the wrong list of valid values for ...
A list of attributes that need to be returned along with each message. These attributes include: All – Returns all values.
Read more >
Retrieve multiple messages from SQS - java - Stack Overflow
So my code is like: ReceiveMessageRequest receive_request = new ReceiveMessageRequest() .withQueueUrl(QUEUE_URL) .withWaitTimeSeconds(20) .
Read more >
Working with Amazon SQS in Python using Boto3
In the above example, we set DelaySeconds and MaximumMessageSize attributes for the queue. The set_queue_attributes() method does not return any ...
Read more >
3 surprising facts about AWS SQS FIFO queues - Tom Gregory
The first-in-first-out (FIFO) queue is the type of AWS SQS queue that ... QUEUE_SIZE=$(aws sqs get-queue-attributes --attribute-names ...
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