youtype / mypy_boto3_builder

Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.
https://youtype.github.io/mypy_boto3_builder/
MIT License
544 stars 36 forks source link

Support meta on aioboto3 Table #198

Closed tekumara closed 1 year ago

tekumara commented 1 year ago

Describe your idea

Types for the meta object on types_aiobotocore_dynamodb.service_resource.Table

Code sample

eg:

table.meta.client.describe_table(TableName=self.table_name)

Additional context

❯ pip freeze  | grep boto
aioboto3==11.1.0
aiobotocore==2.5.0
boto3==1.26.76
botocore==1.29.76
botocore-stubs==1.29.125
types-aioboto3==11.1.0
types-aiobotocore==2.5.0.post2
types-aiobotocore-dynamodb==2.5.0.post1
vemel commented 1 year ago

Hello!

Since Table is inherited from boto3.resources.base.ServiceResource, it already has meta:

from types_aiobotocore_dynamodb.service_resource import Table

async def test(table: Table) -> None:
    reveal_type(table.meta)  # information: Type of "table.meta" is "ResourceMeta"
    reveal_type(table.meta.client)  # information: Type of "table.meta.client" is "BaseClient"

Please let me know if it works for you.