Skip to end of banner
Go to start of banner

DynamoDB Query

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

Snap type:

Read

Description:

This Snap retrieves data from DynamoDB by executing a DynamoDB Query via the REST API. It processes Snap properties and formats the HTTP request entity body according to the syntax defined in the AWS DynamoDB Query API Reference. It can be used to retrieve data from DynamoDB table as well as Global Secondary Index or Local Secondary Index. Refer to AWS DynamoDB Query API Reference for further details.

Input & Output

  • InputThis Snap can have an upstream Snap that can pass a document output view such as Mapper or JSON Generator. If the upstream Snap is connected, this Snap executes once per each input document and produces the query results as a stream of documents to the output view. Each input document is used to evaluate expression properties in the Snap.

  • Output: This Snap can have an downstream Snap that has a document input view such as Mapper or JSON Formatter.

Modes

Prerequisites:

None

Limitations and Known Issues:

None at this time.

Configurations:

Account & Access

A valid DynamoDB account is required.

Views

InputThis Snap has at most one document input view.
OutputThis Snap has exactly one document output view and produces a stream of documents, one for each item matching the query criteria.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.
Troubleshooting:The Snap produces an error document if DynamoDB fails to execute the submitted query. The "request_entity" field in the error document contains the HTTP entity body of the submitted query and may be useful when troubleshooting the pipeline. The Snap processes the Snap properties and prepares the HTTP entity body for the query. The "error_entity" fields in the error document is the error message from the DynamoDB server describing which part of the query has caused the error.

Settings

Label


Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Table name

Required. The name of the DynamoDB table. Table names can be suggested if the expression property is disabled. The input document schema and pipeline parameters can be suggested when the expression property is enabled.

Example: EmployeeEvents, $TableName, _TableName

Default value: None

Secondary index name

The name of Global Secondary Index or Local Secondary Index if used in the query. The Amazon DynamoDB document explains this as following:

"Amazon DynamoDB provides fast access to items in a table by specifying primary key values. However, many applications might benefit from having one or more secondary (or alternate) keys available, to allow efficient access to data with attributes other than the primary key."

Please refer to Improving Data Access with Secondary Indexes for more details.

Example: EffectiveDate-index, $secondary_index, _secondary_index

Default value: None

Projection expression

A string that identifies one or more attributes to retrieve from the table. The attributes in the expression must be separated by commas. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

Example: "EffectiveDate, EmpID, EventID, #name" (without double-quote), or $attributes or _attributes

Default value: None

Key condition expression

The condition that specifies the key value(s) for items to be retrieved by the Query action. The condition must perform an equality test on a single partition key value. The condition can also perform one of several comparison tests on a single sort key value. Query can use KeyConditionExpression to retrieve one item with a given partition key value and sort key value, or several items that have the same partition key value but different sort key values. Refer to the KeyConditionExression section in the AWS DynamoDB Query API Reference for more details.

Example: EffectiveDate = :val1

Default value: None

Filter expression

A string that contains conditions that DynamoDB applies after the Query operation, but before the data is returned to the Snap. Items that do not satisfy the filter expression criteria are not returned. A filter expression does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.

Note: A filter expression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see the "Filter Expression for Query" section in Working with Queries.

Example: #v >= :num

Default value: None

Expression attribute values

Specify the placeholders for the Expression Attribute Names and/or Expression Attribute Values.ed words as attribute names in expressions.

DynamoDB reserves certain words and they are called reserved names. You must not use reserved words as attribute names in expressions. If you must write an expression that contains a word that conflicts with a DynamoDB reserved word, then you can define an expression attribute name to use in the place of the reserved word. For more information, see Expression Attribute Names.

Similarly, you cannot use certain values as attribute values in expressions and instead must define an expression attribute name. For more information, see Expression Attribute Values.


  • Attribute: The expression attribute name. Begins with a # for names and : for values. 
  • Type: The attribute type. Blank for Expression Attribute Names. S for string, N for number, and so on, for Values.
  • Value: The actual literal to be used in the query condition.

Example

If your table contains a column named uuid (a reserved word) and you want to read a value from the uuid column, then you must assign a placeholder for the column name because you cannot use a reserved word directly in your expression. We can define the Attribute #U, leave the Type blank, and enter the value as uuid. In the Snap Filter expression condition, we enter #u=:val1. :val1 is the placeholder for the value in the table which is defined as Attribute :val1 of Type B with Value dGhpcyB0ZXh0.

Attribute
 Type
Value
 #u UUID

Action

Enter COUNT to get only the number of items after query execution or DESCRIBE TABLE to get the table metadata at the output view, or QUERY for normal query operations.

Example: QUERY, COUNT, DESCRIBE TABLE

Default value: QUERY

Consistent read

Determines the read consistency model. If set to true, then the operation uses strongly consistent reads. Otherwise, the operation uses eventually consistent reads. Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with 'Consistent read' set to true, you will receive an Exception.

Default value: False

Pass through

If true, the input document is passed through to the output view under the 'original' key.

Default value: False

Page lookup error: page "Anaplan Read" not found.

If you're experiencing issues please see our Troubleshooting Guide.

Page lookup error: page "Anaplan Read" not found.

If you're experiencing issues please see our Troubleshooting Guide.


Examples


  1. Sample query for Global Secondary Index:

    Refer to the attached file: DynamoDB Query for GlobalSecondaryIndex.slp

The 'EmployeeEvents' table has the following items in the above example:

EmpIDNameEventIDEffectiveDate
{"N":"3"}{"S":"Paul"}{"S":"103"}{"N":"20170703"}
{"N":"2"}{"S":"John"}{"S":"102"}{"N":"20170703"}
{"N":"3"}{"S":"Paul"}{"S":"102"}{"N":"20170703"}
{"N":"20170210"}
{"S":"foobar"}
{"N":"1828"}
{"S":"Preferred Name Change Event"},{"N":"1475218800000"},
{"N":"1"}
{"S":"101"}{"N":"20170802"}

 The Snap processes Snap properties and sends the following HTTP request entity to DynamoDB:

{
    "TableName": "EmployeeEvents",
    "IndexName": "EffectiveDate-index",
    "ProjectionExpression": "EffectiveDate, EmpID, EventID, #nam",
    "KeyConditionExpression": "EffectiveDate = :val1",
    "ExpressionAttributeNames": {
        "#name": "Name"
    },
    "ExpressionAttributeValues": {
        ":val1": {
            "N": "20170703"
        }
    },
    "ReturnConsumedCapacity": "INDEXES"
}


 Then, the Snap produces the output documents as following:

EmpIDNameEventIDEffectiveDate
{"N":"3"}{"S":"Paul"}{"S":"103"}{"N":"20170703"}
{"N":"2"}{"S":"John"}{"S":"102"}{"N":"20170703"}
{"N":"3"}{"S":"Paul"}{"S":"102"}{"N":"20170703"}


2. Sample query for Table:

Refer to the attached file: DynamoDB Query for Table.slp

 The Snap processes Snap properties and sends the following HTTP request entity to DynamoDB:

{
    "TableName": "EmployeeEvents",
    "ProjectionExpression": "EffectiveDate, EmpID, EventID, #nam",
    "KeyConditionExpression": "EventID = :val2 AND EmpID > :val3",
    "ExpressionAttributeNames": {
        "#name": "Name"
    },
    "ExpressionAttributeValues": {
        ":val2": {
            "S": "102"
        },
        ":val3": {
            "N": "1"
        }
    },
    "ReturnConsumedCapacity": "INDEXES"
}


Then, the Snap produces the output documents as following:

EmpIDNameEventIDEffectiveDate
{"N":"2"}{"S":"John"}{"S":"102"}{"N":"20170703"}
{"N":"3"}{"S":"Paul"}{"S":"102"}{"N":"20170703"}

Downloads

  File Modified
No files shared here yet.

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
November 2024main29029 StableUpdated and certified against the current SnapLogic Platform release.
August 2024main27765 StableUpdated and certified against the current Snaplogic Platform release.
May 2024main26341 StableUpdated and certified against the current SnapLogic Platform release.
February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023main23721 StableUpdated and certified against the current SnapLogic Platform release.

August 2023

main22460

 


Stable

Updated and certified against the current SnapLogic Platform release.

May 2023main21015 StableUpgraded with the latest SnapLogic Platform release.

February 2023

main19844 StableUpgraded with the latest SnapLogic Platform release.
January 2023431patches19383 Latest

The DynamoDB Snap Pack supports the IAM role in the DynamoDB account.

November 2022main18944 StableUpgraded with the latest SnapLogic Platform release.
430 Patch430patches18355 LatestThe lineage for Ultra Pipelines containing the DynamoDB Bulk Get and DynamoDB Bulk Write Snaps is now preserved only when the Batch Size is 1.
430 Patch430patches18211 Latest

The DynamoDB Bulk Write Snap now does not fail with the Duplicate keys <table-name> are provided error when the Batch size or the Thread count is high.

August 2022main17386 StableThe DynamoDB Account includes AWS Security Token field to pass the security token when making calls using temporary credentials.
4.29 Patch429patches16169 Latest

Fixed an issue with the DynamoDB Snaps where the Snaps did not route the errors to the error view when the Snap encountered an exception and the Pipeline failed. Now the Snap route the errors to the error view and does not fail when it encounters an exception. If the error view is disabled, Snap stops the execution.

4.29 Patch

429patches15954 Latest

Enhanced the DynamoDB Account with AWS Security Token field to pass the security token when making calls using temporary credentials.

4.29main15993 Stable

Upgraded with the latest SnapLogic Platform release.

4.28main14627 StableUpgraded with the latest SnapLogic Platform release.

4.27

main12833

 StableUpgraded with the latest SnapLogic Platform release.
4.26426patches11593 LatestFixed an issue with the DynamoDB Update Snap, where the data type conversion for input keys caused an error.
4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25425patches10571 Latest

Updated the AWS SDK from version 1.11.688 to 1.11.1010 in the DynamoDB Snap Pack and added a custom SnapLogic User Agent header value.

4.25main9554
 
StableUpgraded with the latest SnapLogic Platform release.
4.24 Patch424patches9031 Latest
  • Supports autoscaling by adding retry logic with exponential backoff to the Snaps.
  • Enhanced the Dynamo DB Account  to support the expression enabler for account properties and creation of dynamic account.
  • Improved memory consumption in DynamoDB Bulk Write and Bulk Get Snaps.
4.24main8556
StableUpgraded with the latest SnapLogic Platform release.
4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22main6403
 
StableUpgraded with the latest SnapLogic Platform release.
4.21 Patch421patches5851 Latest

Removed the Snap timeout setting while waiting for the threads to complete processing.

4.21 Patchdynamodb8854 LatestFixed the DynamoDB Scan Snap pagination issue where the second page of output and beyond cannot be accessed during execution and validation.   
4.21snapsmrc542

 

StableUpgraded with the latest SnapLogic Platform release.
4.20 Patchdynamodb8709 Latest

Fixed the DynamoDB Scan Snap and the DynamoDB Update Snap where:

  • The DynamoDB Scan Snap is unable to produce a preview output on validation. (Instead, the Snap passes the output to the downstream Snap.)
  • The DynamoDB Update Snap produces two error documents for the same error during preview output.
4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19snaprsmrc528
 
StableUpgraded with the latest SnapLogic Platform release.
4.18 PatchMULTIPLE7778 Latest

Updated the AWS SDK library version to default to Signature Version 4 Signing process for API requests across all regions.

4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17ALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest

Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16snapsmrc508
 
StableUpgraded with the latest SnapLogic Platform release.
4.15 Patchdynamodb6670 Latest

Added new functionality to the property Expression attribute values in the Delete Table Item, Scan, Update, and Bulk Get Snaps. The property now handles columns that are named after the DynamoDB reserve words.

4.15snapsmrc500
 
StableUpgraded with the latest SnapLogic Platform release.
4.14snapsmrc490
 
StableUpgraded with the latest SnapLogic Platform release.
4.13

snapsmrc486

 
StableUpgraded with the latest SnapLogic Platform release.
4.12

snapsmrc480

 
StableUpgraded with the latest SnapLogic Platform release.
4.11snapsmrc465
 
Stable

Added a new DynamoDB Query Snap with Secondary Index support.

4.10 Patchdynamodb3950 Latest

Resolved an issue with the DynamoDB Scan Snap which was not able to perform the scan operation on the table with huge amount of data (Actual description Error executing scan process, 0 after the 4.10 release)

4.10

snapsmrc414

 
Stable

DynamoDB ScanBulk WriteDelete Table Item and Update Snaps support the Set types (Binary, List and Map).

4.9 Patchdynamodb3329 Latest

DynamoDB Scan Snap - Fixed NPE during the Table name support.

4.9snapsmrc405
 
StableUpgraded with the latest SnapLogic Platform release.
4.8

snapsmrc398

 
Stable
  • Added the new Snaps DynamoDB Delete Table and DynamoDB Delete Table Item.
  • Info tab added to accounts.
  • Database accounts now invalidate connection pools if account properties are modified and login attempts fail.
4.7 Patchdynamodb2557 Latest

DynamoDB Bulk Get now writes the original object to error view and output view on error.

4.7 Patchdynamodb2279 Latest

Addressed a issue with generated signatures when non-ASCII data is used and ensured the original document is passed the Error View.

4.7

snapsmrc382

 
Stable

Updated the DynamoDB Bulk Get Snap with the new field, Batch Size.

4.6snapsmrc362
 
StableUpgraded with the latest SnapLogic Platform release.
4.5

snapsmrc344

 
Stable

All database Snaps have had updates in connection pooling.

4.4.1NA StableUpgraded with the latest SnapLogic Platform release.
4.4NA Stable
  • Resolved an issue with the DynamoDB account not validating if credentials did not have access to ListTables operation.
  • Added expression support to the Where clause property for Select Snaps.
4.3.2NA Stable
  • DynamoDB Bulk Write Snap now has Batch size and Request delay properties to help control the speed of the bulk write.
4.2.2NANAStable
  • Resolved an issue with the DynamoDB Scan Snap throwing an exception if Total segments was provided.
  • Resolved an issue with the DynamoDB Scan Snap not returning the specified attribute names list if Projection expression was set to an attribute name.

  • No labels