dynamo.connector
Overview
The dynamo.connector function serves as a bridge between the Vantage analytics platform and Amazon DynamoDB, enabling users to perform read operations on DynamoDB tables seamlessly. This function utilizes the provided credentials and session details to authenticate and execute various read operations, such as scanning or querying data from specified tables. It is essential for users looking to leverage data stored in DynamoDB within the Vantage ecosystem, facilitating enhanced data analysis and decision-making.
Settings
1. inputs
- Type: Object
- Description: This object contains parameters required for DynamoDB operations. Its sub-properties define the specifics of the read operation to be executed including the table name and queries.
Sub-properties:
- tableName
- Type: String
- Description: The name of the DynamoDB table from which data will be read. Providing an invalid or non-existing table name will trigger an error response.
- Default Value: None (Required field)
- operation
- Type: String
- Description: Defines the type of read operation to be performed on the DynamoDB table. Common operations include
scanandquery. Changing this will alter the method used to retrieve data:scan: Retrieves all items in the table.query: Retrieves items based on the specified key conditions.
- Default Value:
scan
- keyCondition
- Type: String (DynamoDB Query Expression)
- Description: A condition that specifies the key values for the
queryoperation. This is required when the operation isquery. If specified during ascan, it will be ignored. - Default Value: None (Required field if
operationisquery)
- filterExpression
- Type: String (DynamoDB Filter Expression)
- Description: This optional condition is applied to filter the results of the read operation for more refined data output. If not specified, all items retrieved by the primary operation will be returned. Changes will refine the data output based on key attributes.
- Default Value: None (Optional)
2. config
- Type: Object
- Description: Configuration object that controls specific implementation details of the
dynamo.connectorfunctionality.
Note: The code sample does not explicitly utilize config, but it is passed as a parameter and can be extended for future enhancements.
How It Works
-
Authentication: Initially, the function checks for server session authentication using the server session. It verifies that a valid user is logged in and extracts the
clientId. -
Table Availability: Using the
clientId, it checks if the DynamoDB service exists for that client. If not, it responds with a message indicating the absence of the service. -
Credential Retrieval: The function retrieves the necessary encrypted credentials for the DynamoDB service from the database. If credentials are missing or not found, an error message is shown.
-
Integration and Data Fetching: Once authenticated, the function constructs an integration object that allows interaction with the DynamoDB tables. Depending on the specified operation, it executes a read operation, either
scanorquery, using the provided parameters. -
Error Handling: If any step fails, appropriate error messages are generated and returned to the user detailing the issue.
Data Expectations
- inputs.tableName: Must be a valid string representing the DynamoDB table name.
- inputs.operation: Should be set to either
scanorquery. - inputs.keyCondition: Required when using
query, must adhere to DynamoDB query expression syntax. - inputs.filterExpression: Optional but should match DynamoDB filter expression syntax if used.
AI Integrations and Billing Impacts
Currently, there are no direct AI integrations associated with dynamo.connector, as it primarily facilitates data retrieval operations from DynamoDB. However, any AI-based functionality (like predictive analytics) that utilizes the retrieved data would be applicable as a downstream process.
Billing Considerations
- DynamoDB Read Costs: Each read operation (scan or query) performed via the
dynamo.connectormay incur costs according to the DynamoDB pricing model, which is based on the amount of data read, the number of read capacity units consumed, and whether you are using on-demand capacity or provisioned capacity with auto-scaling. - Vantage Platform Usage: Using this connector will also contribute to Vantage API billing, which may depend on the volume of requests or data processed through the platform.
Use Cases & Examples
Use Case 1: Inventory Management
A retail company can utilize dynamo.connector to retrieve data regarding the availability of products stored in a DynamoDB table. This can facilitate inventory audits and data analysis for future stock recommendations.
Use Case 2: User Analytics
A SaaS (Software as a Service) provider can use the dynamo.connector to fetch user analytics data stored in DynamoDB. This allows the business to quickly assess user engagement metrics, gather insights from the data, and improve service offerings.
Concrete Example Configuration
Use Case: User Analytics
Scenario: The SaaS provider needs to retrieve user engagement data from a DynamoDB table named "UserEngagement".
Configuration Data:
{
"inputs": {
"tableName": "UserEngagement",
"operation": "query",
"keyCondition": "userId = :userId",
"filterExpression": "engagementScore > :minScore",
"expressionAttributeValues": {
":userId": { "S": "123456" },
":minScore": { "N": "50" }
}
},
"config": {}
}Explanation: This configuration allows the dynamo.connector to query the "UserEngagement" table, fetching data for a specific user identified by userId, while only returning records with an engagement score greater than 50. The use of a filterExpression ensures that only relevant and high-value engagement data is retrieved for analysis.