aws cli dynamodb query count example

Recent changes might not be reflected in this value. AWSが提供するキーバリュー型のマネージドデータストアサービスです。 データが3つのAZに分散して格納されるため耐久性が高く、格納容量に上限がありません。 If no matching item, then it does not return any data and there will be no Item element in the response. The number of items in the specified table. aws dynamodb query --table-name Music --key-conditions file://key-conditions.json Using the AWS CLI with Downloadable DynamoDB The AWS CLI can also interact with DynamoDB (Downloadable Version) that runs on your computer. A tutorial on how to create and query a DynamoDB table using the AWS CLI. The general required steps for a query in Java include creating a DynamoDB class instance, Table class instance for the target table, and calling the query method of the Table instance to receive the query object. Amazon DynamoDB is a fully managed NoSQL database service offered by Amazon Web Services (AWS). AWSのDynamoDBを構築し、簡単なテーブル操作をAWSコンソール及びAWS CLI上で試す. delete ( { TableName : "my-table" , Key : { id : "123" , // id is the Partition Key, '123' is the value of it } , } ) . Causes DynamoDB to evaluate the value before attempting a conditional operation: If Exists is true, DynamoDB will check to see if that attribute value already exists in the table.If it is found, then the operation succeeds. If you're looking for similar cheat sheet but for Python, you can find it here, and for Node.js - here. In a DynamoDB table, you need to use the Scan operation to read all the items in your table. DynamoDB how to get items count for a partition keys using .net core? I don't want to steal @mkobit's original work, but this is a way to do it using fluent chaining: Just to complete your answer, as pointed out you may have to repeat the call until LastEvaluatedKey is no longer present in the results and this may look like this (comes to the end of the code above): @JHH I've just tried this and it does appear to use read capacity units. docs.aws.amazon.com/amazondynamodb/latest/developerguide/…, https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html#DynamoDBMapper.Methods.query. DynamoDB works best for the use cases for which it was originally designed—scenarios where data can be organized by hand to match a constrained set of predetermined query patterns; where low latency from a single region is enough; and where multi-document updates are the exception, not the rule. DynamoDB . How to structure a DynamoDB database to allow queries for trending posts? The query retrieves all records for Item_ID i10001 from the table Items. but as Saumitra mentioned above be careful with resultsets largers than 1 MB, in that case use LastEvaluatedKey til it returns null to get the last updated count value. const AWS = require ("aws-sdk") AWS. The following example performs the same query as the first example, but returns results in reverse order and uses strongly consistent reads. Here is the most important to understand: there are no additional data processing engine here. It is easier to manager AWS S3 buckets and objects from CLI. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide. DynamoDBとは. This string consists of the service namespace, resource type, and scaling property. How did Trump's January 6 speech call for insurrection and violence? In the current post, I give an overview of DyanmoDB and what it can be used for. Copyright ©document.write(new Date().getFullYear()); All Rights Reserved, IOS set navigation bar height programmatically, Assigning an object to null is a code smell, Httpcontext does not contain a definition for current asp.net core. Join Stack Overflow to learn, share knowledge, and build your career. DynamoDB automatically supports your access patterns as long as the traffic against a given item does not exceed 3,000 read capacity units … With the aws dynamodb cli you can get it via scan as follows: notice that this information is in real time in contrast to the describe-table api. Do I have to stop other application processes before receiving an offer? In a moment, we’ll load this data into the DynamoDB table we’re about to create. As you can see in the preceding example, for initiating a query request to DynamoDB, you need to use the aws dynamodb query command on AWS CLI. Today, we released the Amazon DynamoDB key diagnostics library, which enables you to view graphs and dashboards of your most accessed database items. By Franck Pachot . Table of Contents. AFAIK from trying to figure this out for months is you can't get a count of matching records. DynamoDB requires a minimal amount of setup and maintenance on the part of a developer while offering great performance and scalability. log ( data . your coworkers to find and share information. This allows us to use Key Expressions to query our data, allowing DynamoDB to quickly find the Items that satisfy our Query. Arbitrarily large finite irreducible matrix groups in odd dimension? Stop the robot by changing value of variable Z. How to set limit of matching items returned by DynamoDB using Java? In the current post, I give an overview of DyanmoDB and what it can be used for. ReplacePart to substitute a row in a Matrix. The query retrieves all records for Item_ID i10001 from the table Items. You must make creative use of queries, scans, indices, and assorted tools to perform these tasks. I can querying for DynamoDB, but I only want to know 'total count of item'. When we query an item, we get a very detailed JSON output. Install the Amazon SDK using npm, which is part of node: npm install aws-sdk update ({region: "us-east-1"}) const dynamoDB = new AWS. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. Can aileron differential eliminate adverse yaw? The AWS Command Line Interface (AWS CLI) provides support for all of the AWS database services, including Amazon DynamoDB. # DynamoDB updates this … If you want to try these examples on your own, you’ll need to get the data that we’ll be querying with. DynamoDB is a NoSQL key-value store. You may only have 20 matching records and would get 20 as the count. aws dynamodb query requires some parameters. This post is part of AWS examples in C# – working with SQS, DynamoDB, Lambda, ECS series. After that when I need to know the total count by owner, I do in parallel the query to the counter table and to the data from the other DynamoDB table (limit of 10 results), with this I have isolated the counts by owner without to do a full scan and I have the total pages and total elements available for a … How to keep a DynamoDb query within provisioned throughput? In German, can I have a sentence with multiple cases? You can access the AWS Management Console for Amazon DynamoDB at Manage Time to Live (TTL) to define when items in a table expire so that they can be automatically deleted from the database. Explain for kids — Why isn't Northern Ireland demanding a stay/leave referendum like Scotland? This post is part of AWS examples in C# – working with SQS, DynamoDB, Lambda, ECS series. Instead, provide the last result of the previous query as the starting point for the next query… Were there any computers that did not support virtual memory? If provided with no value or the value input , prints a sample input JSON that can be used as an argument for - … Hope it helps someone. I'm working with The AWS Command Line Interface for DynamoDB. The insert_items.py script in the example directory opens our CSV file with the Starbucks locations, iterates over the rows, and stores them in our DynamoDB table with the given structure. How does one take advantage of unencrypted traffic? I'm posting this answer for anyone using C# that wants a fully functional, well-tested answer that demonstrates using query instead of scan. Then simply operate on those values through an object. I read through the docs once more and I actually found a statement regarding counts that I previously missed: "Getting the count of items uses the same quantity of read capacity units and is subject to the same item size calculations, because DynamoDB has to read each item in order to increment the count.". Well then, first make sure you … But if you don’t yet, make sure to try that first. Where is the location of this large stump and monument (lighthouse?) Macrometa GDN can be used as the data store for apps written for AWS DynamoDB. It just shows total rows in table, not the count of resultset of my query. SELECT count(*) FROM ; Be sure to replace with the name of your table. Thanks for contributing an answer to Stack Overflow! KeyConditions - Amazon DynamoDB, String value comparisons for greater than, equals, or less than are based on aws dynamodb query \ --table-name Music \ --key-condition-expression 'Artist = :a The Query operation in Amazon DynamoDB finds items based on primary key values. If Exists is false, DynamoDB assumes that the attribute value does not exist in the table. We give some examples below, but first we need some data: Install DynamoDB and run it locally, as we explained in How To Add Data in DynamoDB. Install node so we can run some JavaScript code. With the aws dynamodb cli you can get it via scan as follows: aws dynamodb scan --table-name --select "COUNT" The response will look similar to this: { "Count": 123, "ScannedCount": 123, "ConsumedCapacity": null } notice that this information is … By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy. Also, an important note from the documentation as noted by Saumitra R. Bhave in the comments on this answer: If the size of the Query result set is larger than 1 MB, ScannedCount and Count represent only a partial count of the total items. The Overflow Blog Tales from documentation: Write for your clueless users. Note: this may take a while since there … Install the Amazon SDK using npm, which is part of node: npm install aws-sdk RSS. I used scan to get total count of the required tableName.Following is a Java code snippet for same. Most of the time problems with AWS CLI occur either due to the following reasons: outdated version of AWS CLI. You can use the AWS CLI for ad hoc operations, such as creating a table. I'm [suffix] to [prefix] it, [infix] it's [whole], Noun to describe a person who wants to please everybody, but sort of in an obsessed manner. For usage examples, see Pagination in the AWS Command Line Interface User Guide. In this tutorial we will be using Amazons DynamoDB (DynamoDB Local) to host a sample dataset consisting of music data that I retrieved from the iTunes API, which we will be using the aws cli tools to interact with the data. wrong version of Python/dependencies. background? 1.6K Followers. DocumentClient ( ) dynamoDB . I’m assuming you have the AWS CLI installed and configured with AWS credentials and a region. Get started. We give some examples below, but first we need some data: Install DynamoDB and run it locally, as we explained in How To Add Data in DynamoDB. And it would exceed the limits of the query size. DynamoDB API's most notable commands via CLI: aws dynamodb aws dynamodb get-item returns a set of attributes for the item with the given primary key. Once you've configured AWS CLI , you should be ready to use dynein. To list the AWS CLI commands for DynamoDB, use the following command. This doesn't work if you have more than 1MB of items. You can use the Select parameter and use COUNT in the request. Then, let's load our items into DynamoDB. In this tutorial we will be using Amazons DynamoDB (DynamoDB Local) to host a sample dataset consisting of music data that I retrieved from the iTunes API, which we will be using the aws cli tools to interact with the data. There are two different ways we can handle this further segmentation. As you can see in the preceding example, for initiating a query request to DynamoDB, you need to use the aws dynamodb query command on AWS CLI. Making statements based on opinion; back them up with references or personal experience. Cory Maklin. For example, suppose that you have provisioned 100 read capacity units for your DynamoDB table. For more information, see Working with Queries in DynamoDB in the Amazon DynamoDB Developer Guide. The filter expression (whatever query other attribute you want) Load sample data. You must provide the name of the partition key attribute and a single value for that attribute. You will need to perform multiple Query operations in order to retrieve all of the results". DynamoDB CLI Operation Examples. Difference between client.query and Table.query in Dynamodb. site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. They are updated periodically, roughly every six hours.". aws dynamodb put-item \--table-name Trial \--item \ '{"Name": {"S": "All That and Dim Sum"}}' Now we have our first row of data! Open in app. Using AWS Console CLI with Macrometa¶. Removing my characters does not change my meaning. According to the DynamoDB console my query consumed about 12 units (only 1 is configured); I assume it's utilising burst capacity to service the query. For more information on working with DynamoDB through the … For example, 'SELECT COUNT(*) FROM ... WHERE ...' in MySQL. The ideal way is to build the element we want to query into the RANGE key. If you want to list tables within other region, you can force alternative region via command line switch: aws --region us-west-1 dynamodb list-tables. You get something like this (it has been built from the get-item in order to be almost exhaustive (the NULL type has been omitted) aws command line help: Result.data.Count will give you what you are looking for. Install node so we can run some JavaScript code. Asking for help, clarification, or responding to other answers. aws dynamodb scan \--table-name \--select COUNT I checked my items with a SELECT but was limited in the ORDER BY clause. Triggering AWS Lambda when a DynamoDB table grows to a certain size, AWS DynamoDB count query results without retrieving, DynamoDbEnhanced: count Items without returning them. How to see DynamoDB Query result count in AWS management,i can see total item count in DynamoDB table in Overview tab, but when i query any DynamoDB table, I get results in AWS Management Console,  If you don't need to emulate the WHERE clause, you can use a DescribeTable request and use the resulting item count to get an estimate. The following AWS CLI command shows how to use a Scan and return the COUNT of items read. The following sample aws-cli commands use the --query and --output options to extract the desired output fields so that we can assign them to shell variables: aws --query Examples. Let's explore the query … Troubleshooting. The new --query option is far easier to use than jq, grep+cut, or Perl, my other fallback tools for parsing the output. Ref: https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html#DynamoDBMapper.Methods.query, will give you the count of the filtered rows. This will let you read 409,600 bytes per second (100 … What does a faster storage device affect? This cheat sheet will help you perform basic query operations, table manipulations and item updates with DynamoDB and AWS CLI. To learn more, see our tips on writing great answers. You can copy or download my sample data and save it locally somewhere as data.json. The code used for this series of blog posts is located in aws.examples.csharp GitHub repository. Browse other questions tagged amazon-dynamodb aws-lambda or ask your own question. Let's explore the query … Go to overview tab on table, you will see item count. If count of $result is 100,000, $result is too much big. In the previous post I insertd a few rows in a Demo table using the SQL-like new API on DynamoDB. Is my back-of-the-envelope calculation about taking out a loan to invest into the markets flawed? If you happen to reach here, and you are working with C#, here is the code: Similar to Java in PHP only set Select PARAMETER with value 'COUNT'. Follow. If it is not found, the operation fails with a ConditionCheckFailedException.. DynamoDB API's most notable commands via CLI: aws dynamodb aws dynamodb get-item returns a set of attributes for the item with the given primary key. This tutorial explains the basics of how to manage S3 buckets and its objects using aws s3 cli using the following examples: For quick reference, here are the commands. Example 2: To query a table using strongly consistent reads and traverse the index in descending order. If you want to count the number of items: import boto3 client = boto3.client('dynamodb','us-east-1') response = client.describe_table(TableName='test') print(response['Table']['ItemCount']) #ItemCount (integer) --The number of items in the specified table. --generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. DynamoDB updates this value approximately every six hours. A DynamoDB table can be used in two different capacity modes—provisioned and on-demand. Replace the table name and use the below query to get the data on your local environment: Replace the table name and remove the endpoint url to get the data on production environment. Unfortunately, offset of how many records to skip does not make sense for DynamoDb. ScalableDimension -> (string) The scalable dimension. Eight examples of using Node.js to get data out of a DynamoDB table using the AWS SDK for JavaScript. this code gets the all users data higher than my point. AWS DynamoDB Query : finding the count of matching records, Confusion about terminology : Finite difference for option pricing. @HelenNeely Yes, this way provides the latest item count. Also, if we want to see the count of a query, it cant be done in Overview tab. The filter expression (whatever query other attribute you want) Load sample data. The question is how to get a count of the records matching a filter expression, hence the comparison to the WHERE statement. $ aws dynamodb list-tables). And then instead of using Count (which I am guessing is a function in PHP) on the 'Items' you can use the Count value from the response - $result['Count']: If you don't need to emulate the WHERE clause, you can use a DescribeTable request and use the resulting item count to get an estimate. You need to perform multiple Query operations to retrieve all the results (see Paginating Table Query Results). However there may be 40 in the next 1000 records, and so on. Stack Overflow for Teams is a private, secure spot for you and Why DynamoDB scan with Limit and FilterExpression not return the items that match the filter requirements? config. ... AWS CLI DynamoDB Query Example… Yes, but this has limitations: "Storage size and item count are not updated in real-time. About. For details on how these commands work, read the rest of … I'm Not familiar with PHP but here is how you could use it with Java. This answer is not correct, at least in the context of the question. The answers/resolutions are collected from stackoverflow, are licensed under Creative Commons Attribution-ShareAlike license. Are there any stars that orbit perpendicular to the Milky Way's galactic plane? Example: arn:aws:kafka:us-east-1:123456789012:cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5 . To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Query and scan a table. This is solution for AWS JavaScript SDK users, it is almost same for other languages. Switch to using GDN by just changing the connection URL, accessKey and secretKey.You can continue using aws dynamodb sdk and cli you are familiar with. it calls loadAllResults() that would lazily load next available result until allResultsLoaded. Can be seen from UI as well. You can review the instructions from the post I mentioned above, or you can quickly create your new DynamoDB table with the AWS CLI like this: But, since this is a Python post, maybe you want to do this in Python instead? DynamoDB - Aggregation - DynamoDB does not provide aggregation functions. There’s more you can do here, but the scope gets expansive, and we still have a lot to cover. promise ( ) . Post summary: Introduction to NoSQL, introduction to DynamoDB and what are its basic features and capabilities. The code used for this series of blog posts is located in aws.examples.csharp GitHub repository. It "returns the number of matching items, rather than the matching items themselves". Post summary: Introduction to NoSQL, introduction to DynamoDB and what are its basic features and capabilities. If you want to get just the count of Items that satisfy a Query, you can use the --select option to return that: $ aws dynamodb query \ --table-name UserOrdersTable \ --key-condition-expression "Username = :username" \ --expression-attribute-values '{ ":username": { "S": "daffyduck" } }' \ --select COUNT \ $LOCAL In particular, this answer handles more than 1MB size of items to count. Please include an explanation with your answer. One convenient way to check if your AWS credential configuration is ok to use dynein is to install and try to execute AWS CLI in your environment (e.g. Utilize indices and a query/scan to retrieve and filter values before processing. The AWS CLI for DynamoDB supports various commands, such as batch-get-item, batch-write-item, create-table, delete-item, delete-table, describe-table, get-item, list-tables, put-item, query, scan, update-item, update-table, wait, and so on. then ( data => console . aws dynamodb query requires some parameters. dynamoDB will go through each record in the table or index and return those matching the filter, 1000 records at a time. Important, as brought up by Saumitra R. Bhave in a comment, "If the size of the Query result set is larger than 1 MB, then ScannedCount and Count will represent only a partial count of the total items. $ I want to know item count with DynamoDB querying. If no matching item, then it does not return any data and there will be no Item element in the response. First up, if you want to follow along with these examples in your own DynamoDB table make sure you create one! You can also use it to embed DynamoDB operations within utility scripts. To get started, we need to first configure the AWS CLI: ecs:service:DesiredCount - The desired task count of an ECS service. @Zodman thanks for trying it! One might think that caching the count, at least within eventually consistent boundaries, would be feasible to make it only consume one single CU, but maybe getting only the count isn't a very common scenario. rev 2021.1.15.38320, Stack Overflow works best with JavaScript enabled, Where developers & technologists share private knowledge with coworkers, Programming & related technical career opportunities, Recruit tech talent & build your employer brand, Reach developers & technologists worldwide, I think there is a small catch here though, as per. In particular, this answer is not correct, at least in the AWS CLI provides. 100,000, $ result is too much big ( whatever query other attribute you want load... Dynamodb will go through each record in the Amazon DynamoDB would get 20 as the data for... Items returned by DynamoDB using Java some JavaScript code share information found, the operation fails a. But this has limitations: `` us-east-1 '' } ) const DynamoDB = new AWS tools to perform these.. Service, privacy policy and cookie policy to invest into the markets flawed and. Answer is not correct, at least in the request records for Item_ID from! For your clueless users the Scan operation to read all the items that the. Are there any computers that did not support virtual memory Scan to get total count of '. Clarification, or responding to other answers used Scan to get data out a..., scans, indices, and for Node.js - here finding the count sheet will help you basic! Should be ready to use a Scan and return those matching the filter expression whatever. I10001 from the table items are there any computers that did not support virtual memory then simply operate on values. And would get 20 as the data store for apps written for AWS DynamoDB most of filtered! Records, and for Node.js - here through an object the items that match the expression. Due to the following Command https: //docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/DynamoDBMapper.Methods.html # DynamoDBMapper.Methods.query, will give you you! Command Line Interface User Guide Attribution-ShareAlike license configured AWS CLI use count in the by... @ HelenNeely Yes, but returns results in reverse order and uses consistent! The scalable dimension: finding the count of a developer while offering great performance scalability! C # – working with SQS, DynamoDB assumes that the attribute value does not return data... Will give you what you are looking for of setup and maintenance on the part of AWS CLI ad. Interface User Guide items that satisfy our query retrieve and filter values before processing can do,. What it can be used in two different capacity modes—provisioned and on-demand the index in descending.. Virtual memory © 2021 Stack Exchange Inc ; User contributions licensed under cc by-sa about... Browse other questions tagged amazon-dynamodb aws-lambda or ask your own question more information, see in... Yes, this answer handles more than 1MB size of items to count matching the filter expression whatever... The limits of the partition key attribute and a single value for that attribute than the matching items themselves.. Such as creating a table CLI ) provides support for all of the time problems with CLI! Current post, i give an overview of DyanmoDB and what it be... 1Mb size of items JavaScript SDK users, it is almost same for other.! > ( string ) the scalable dimension use key Expressions to query into the markets flawed scope gets expansive and... Will be no item element in the response set limit of matching items returned by DynamoDB using Java attribute does! Item updates with DynamoDB and what it can be used as the first example, suppose that you have 100... Yet, make sure to try that first results ) be done in overview tab two different we... Privacy policy and cookie policy sheet will help you perform basic query operations, such as creating a table data. Record in the next 1000 records at a time of a developer while great! The Overflow blog Tales from documentation: Write for your DynamoDB table, you need to use the example... Important to understand: there are no additional data processing engine here Exchange ;... It here, and for Node.js - here until aws cli dynamodb query count example sending an API.... Indices, and scaling property available result until allResultsLoaded example performs the same query as count. Query: finding the count of the AWS database services, including Amazon DynamoDB the scalable...., then it aws cli dynamodb query count example not return any data and there will be no item in... Records for Item_ID i10001 from the table tips on writing great answers items to.... Value of variable Z - the desired task count of an ECS service you have more 1MB! Than the matching items returned by DynamoDB using Java and there will be no item element the. Context of the partition key attribute and a region tagged amazon-dynamodb aws-lambda or ask own... Type, and we still have a lot to cover record in the context of the required is. Operation fails with a SELECT but was limited in the AWS Command Line Interface ( AWS CLI commands DynamoDB. Console CLI with Macrometa¶ to DynamoDB and AWS CLI for ad hoc operations, such as creating table. Scan to get data out of a DynamoDB table using the AWS CLI to learn share... This answer handles more than 1MB size of items to count are there any computers that did not virtual! Database to allow queries for trending posts of service, privacy policy and cookie policy is. Scans, indices, and for Node.js - here it to embed DynamoDB operations within utility scripts all results..., you will need to perform multiple query operations, such as creating a...., privacy policy and cookie policy you must provide the name of the required is!, not the count of items manipulations and item updates with DynamoDB.. In table, you agree to our terms of service, privacy policy and cookie policy finding count. Query other attribute you want ) load sample data we ’ ll load this data into the RANGE.... Query results ) stump and monument ( lighthouse? ideal way is to build element... Aws Command Line Interface User Guide # DynamoDBMapper.Methods.query, will give you what you are looking similar. Way is to build the element we want to query a DynamoDB table, will! May take a while since there … using AWS Console CLI with Macrometa¶ to invest into the RANGE key the. The response the count of the service namespace, resource type, and we still have a to... An API request you can find it here, and for Node.js -.. Example: arn: AWS: kafka: us-east-1:123456789012: cluster/demo-cluster-1/6357e0b2-0e6a-4b86-a0b4-70df934c2e31-5 tab on table, you will item. Items themselves '' will be no item element in the table or index and return the that... Any stars that orbit perpendicular to the following AWS CLI occur either due to the WHERE statement data! Need to perform aws cli dynamodb query count example query operations, such as creating a table using the SQL-like new API on DynamoDB not! Download my sample data and save it locally somewhere as data.json us-east-1 '' } ) const DynamoDB = new.! To know item count with DynamoDB querying filter, 1000 records, Confusion about terminology Finite. Pagination in the AWS CLI for ad hoc operations, such as creating a.... Handle this further segmentation, Confusion about terminology: Finite difference for option pricing = new AWS opinion... Of setup and maintenance on the part of AWS examples in C –. About to create ( * ) from... WHERE... ' in MySQL you 've configured AWS CLI you... Sqs, DynamoDB assumes that the attribute value does not return any data and there will no! Those values through an object the all users data higher than my point, such as a. 'Re looking for similar cheat sheet will help you perform basic query operations table... Have to stop other application processes before receiving an offer you don ’ t yet make! Some JavaScript code should be ready to use dynein Confusion about terminology: Finite for! Any stars that orbit perpendicular to the WHERE statement ) that would lazily load next available result allResultsLoaded... To see the count used Scan to get data out of a developer while offering great and! Statements based on opinion ; back them up with references or personal experience hoc operations, such as a!
aws cli dynamodb query count example 2021