The boto3
library provides several factory methods that returns resources. For example:
dynamo = (
boto3
.resource('dynamodb')
.Table(os.environ['DYNAMODB_TABLE'])
)
I want to annotate those resources so I can get better type checking and completion, but the only type alike I could find was from boto3.dynamodb.table import TableResource
.
When I add that annotation:
dynamo: TableResource = (
boto3
.resource('dynamodb')
.Table(os.environ['DYNAMODB_TABLE'])
)
The only method offered by auto-completion is batch_writer(self, overwrite_by_pkeys)
, even though the docs lists several others.
Is this the wrong class to use as annotation? Inspecting that variable type in the terminal I could see that it was <class 'boto3.resources.factory.dynamodb.Table'>
, but it doesn't seem to be possible to get that type statically.