4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS DynamoDB テーブル一覧取得 メモ

Posted at

テーブル一覧取得

resource

import boto3

dynamodb = boto3.resource('dynamodb')
response = dynamodb.tables.all()
print(type(response))
print(response)
print('------------')
for x in response:
    print(x, x._name, type(x))
<class 'boto3.resources.collection.dynamodb.tablesCollection'>
dynamodb.tablesCollection(dynamodb.ServiceResource(), dynamodb.Table)
------------
dynamodb.Table(name='TestTable1') TestTable1 <class 'boto3.resources.factory.dynamodb.Table'>
dynamodb.Table(name='TestTable2') TestTable2 <class 'boto3.resources.factory.dynamodb.Table'>

client

import boto3

dynamodb = boto3.client('dynamodb')
response = dynamodb.list_tables()
print(type(response))
print(response['TableNames'])
<class 'dict'>
['TestTable1', 'TestTable2']

参考記事

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?