docs/integrations/data-integrations/amazon-dynamodb.mdx
This documentation describes the integration of MindsDB with Amazon DynamoDB, a serverless, NoSQL database service that enables you to develop modern applications at any scale.
<Tip> This data source integration is thread-safe, utilizing a connection pool where each thread is assigned its own connection. When handling requests in parallel, threads retrieve connections from the pool as needed. </Tip>Before proceeding, ensure that MindsDB is installed locally via Docker or Docker Desktop.
Establish a connection to your Amazon DynamoDB from MindsDB by executing the following SQL command:
CREATE DATABASE dynamodb_datasource
WITH
engine = 'dynamodb',
parameters = {
"aws_access_key_id": "PCAQ2LJDOSWLNSQKOCPW",
"aws_secret_access_key": "U/VjewPlNopsDmmwItl34r2neyC6WhZpUiip57i",
"region_name": "us-east-1"
};
Required connection parameters include the following:
aws_access_key_id: The AWS access key that identifies the user or IAM role.aws_secret_access_key: The AWS secret access key that identifies the user or IAM role.region_name: The AWS region to connect to.Optional connection parameters include the following:
aws_session_token: The AWS session token that identifies the user or IAM role. This becomes necessary when using temporary security credentials.Retrieve data from a specified table by providing the integration name and the table name:
SELECT *
FROM dynamodb_datasource.table_name
LIMIT 10;
Indexes can also be queried by adding a third-level namespace:
SELECT *
FROM dynamodb_datasource.table_name.index_name
LIMIT 10;
There are a few limitations to keep in mind when querying data from Amazon DynamoDB (some of which are specific to PartiQL):
LIMIT, GROUP BY and HAVING clauses are not supported in PartiQL SELECT statements. Furthermore, subqueries and joins are not supported either. Refer to the PartiQL documentation for SELECT statements for more information.INSERT statements are not supported by this integration. However, this can be overcome by issuing a 'native query' via an established connection. An example of this is provided below.
</Tip>
Run PartiQL queries directly on Amazon DynamoDB:
SELECT * FROM dynamodb_datasource (
--Native Query Goes Here
INSERT INTO "Music" value {'Artist' : 'Acme Band1','SongTitle' : 'PartiQL Rocks'}
);