LoginSignup
0
0

More than 1 year has passed since last update.

pythonを利用したDynamoDBからのデータ取得(取得件数の制限)

Last updated at Posted at 2022-02-18

はじめに

dynamoDBから取得するレコード数の最大数を指定したかったので、調査した。

レコード数制限のかけ方

queryなどの引数にLimitを追加するだけでOK。

import boto3
from boto3.dynamodb.conditions import Key

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('TABLE_NAME')

# ここの引数にLimitを入れる
response = table.query(
        KeyConditionExpression = Key('pk').eq('XXX'),
    Limit = 3
)
0
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
0
0