Home > Blockchain >  How do I get Dynamodb Item count from item summary NOT scan
How do I get Dynamodb Item count from item summary NOT scan

Time:10-31

I'm trying to return the item count from my dynamodb table. I already have a getLiveItemCount() function which looks something like this:

func GetLiveItemCount(tableName string) *int64 {
    dynamodbClient := createDynamoDBClient()

    items, _ := dynamodbClient.Scan(&dynamodb.ScanInput{
        TableName: aws.String(tableName),
    })

    return items.Count
}

However, I'm looking to have another function that returns the item count from the most recently updated item metrics that item summary uses (items summary includes item count, table size, and Average item size which are updated every 6 hours). Is there any way to get this value in Golang?

CodePudding user response:

To get those values you call DeacribeTable:

https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html

  • Related