DynamoDB
DynamoDB is a fast and flexible NoSQL database service offered by Amazon Web Services (AWS).
Setup
To connect to DynamoDB you will need to know the region that your database is located.
In addition, you will need an access key and secret key. Both of these can be obtained by following this guide.
Connect
Add a new datasource, and select DynamoDB.
You will be prompted to enter in the necessary credentials.
It is important to note that if you are hosting on amazonaws.com then your region field should match the region used in the endpoint field.
Query types
The DynamoDB connector has a variety of query types beyond the typical CRUD options.
Name | Description |
---|---|
Create (Put) | Creates a new item, or replaces an old item with a new item |
Scan | Returns one or more items and item attributes by accessing every item in a table or a secondary index (limit of 1 MB of data). |
Describe | Returns information about the table, including the current status of the table, when it was created, the primary key schema, and any indexes on the table. More info |
Get | Returns a single item given the primary key of that item |
Update | Edits an existing item's attributes, or adds a new item to the table if it does not already exist |
Delete | Deletes a single item in a table by primary key |
Read (Query) | Returns one or more items and item attributes by accessing every item in a table or a secondary index (maximum of 1 MB of data). |
More information on the client library used can be found here.
DynamoDB query operations are further detailed here.
Create
To create an item, select the Create function, enter a table name, and provide an Item object with the appropriate table fields.
If the primary key in your query matches an existing record, then Create will update that record. For example assuming the entry for 'Carol' has just been created, the following would perform an update:
{
"Item": {
"id": "3",
"Name": "Donna"
}
}
Furthermore, any additional fields that are included within the Item payload will be added to your documents.
Scan
If you exclude the payload, then the scan query will simply return all rows of the specified table.
You can however provide a filter expression in the query box such as:
{
"FilterExpression": "#studentName = :studentName",
"ExpressionAttributeValues": { ":studentName": "Adam" },
"ExpressionAttributeNames": { "#studentName": "Name" }
}
Get
This function will return a single item based on a primary key specified as follows:
{
"Key": {
"id": "2"
}
}
To return the item data, a minor change will be required in the Transformer
Update
Similar to the Get function, Update requires a key and thus only updates one item at a time.
To perform an update, an update expression must also be provided. For example:
As you can see, you can also include bindings within your expressions.
Delete
To delete a single item, select the Delete function, and provide the primary key of the document within your query payload.
{
"Key": {
"id": "1"
}
}
Updated 10 months ago