From 9a2e84dfa5e17cc49abae3273e86a1c8eced09fe Mon Sep 17 00:00:00 2001 From: aashikam Date: Fri, 19 Jan 2024 11:21:45 +0530 Subject: [PATCH] Add changes from code review --- ballerina/Module.md | 5 +++++ ballerina/Package.md | 6 ------ examples/README.md | 4 ++-- examples/execute/Ballerina.toml | 8 ++++++++ examples/{ => execute}/execute.bal | 0 examples/execute/execute.md | 28 ++++++++++++++++++++++++++++ examples/query/Ballerina.toml | 8 ++++++++ examples/{ => query}/query.bal | 0 examples/query/query.md | 28 ++++++++++++++++++++++++++++ 9 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 examples/execute/Ballerina.toml rename examples/{ => execute}/execute.bal (100%) create mode 100644 examples/execute/execute.md create mode 100644 examples/query/Ballerina.toml rename examples/{ => query}/query.bal (100%) create mode 100644 examples/query/query.md diff --git a/ballerina/Module.md b/ballerina/Module.md index 51bf77a..c8f78b0 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -8,9 +8,11 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Am To effectively utilize the Ballerina AWS Redshift connector, you must have an Amazon Redshift cluster. Follow these steps to create an AWS Redshift cluster. ### Step 1: Login to AWS Console + 1. Begin by logging into the [AWS Management Console](https://aws.amazon.com/). ### Step 2: Navigate to Amazon Redshift and Create a Cluster + 1. In the AWS Console, navigate to the Amazon Redshift service. Click on the "Create cluster" button to initiate the process of creating a new Amazon Redshift cluster. Create cluster @@ -18,6 +20,7 @@ To effectively utilize the Ballerina AWS Redshift connector, you must have an Am Create cluster ### Step 3: Configure Cluster Settings + 1. Follow the on-screen instructions to configure your Redshift cluster settings, including cluster identifier, database name, credentials, and other relevant parameters. Basic configs @@ -33,6 +36,7 @@ To effectively utilize the Ballerina AWS Redshift connector, you must have an Am 4. Finally, review your configuration settings, and once satisfied, click "Create cluster" to launch your Amazon Redshift cluster. ### Step 4: Wait for Cluster Availability + 1. It may take some time for your Redshift cluster to be available. Monitor the cluster status in the AWS Console until it shows as "Available". Availability @@ -84,6 +88,7 @@ check from record {} result in resultStream ``` #### Insert data into the database + ```ballerina sql:ParameterizedQuery sqlQuery = `INSERT INTO your_table_name (firstname, lastname, state, email, username) VALUES ('Cody', 'Moss', 'ON', 'dolor.nonummy@ipsumdolorsit.ca', 'WWZ18EOX');`; diff --git a/ballerina/Package.md b/ballerina/Package.md index bd86f31..a7becea 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -4,12 +4,6 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Amazon Redshift, offering Ballerina users a convenient and expressive way to connect, query, and interact with Redshift clusters. -## Compatibility -| | Version | -|-------------------------------|--------------------------------------| -| Ballerina Language | Ballerina Swan Lake 2201.8.0 | -| Ballerina AWS Redshift Driver | ballerinax/aws.redshift.driver:0.1.0 | - ## Set up guide To effectively utilize the Ballerina AWS Redshift connector, you must have an Amazon Redshift cluster. Follow these steps to create an AWS Redshift cluster. diff --git a/examples/README.md b/examples/README.md index a9cf298..9b00b3d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,9 +2,9 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Amazon Redshift, offering Ballerina users a convenient and expressive way to connect, query, and interact with Redshift clusters. -1. [Read data from the database](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/query.bal) - Connects to AWS Redshift using the Redshift connector and performs a simple SQL query to select all records from a specified table with a limit of 10. +1. [Read data from the database](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/query) - Connects to AWS Redshift using the Redshift connector and performs a simple SQL query to select all records from a specified table with a limit of 10. -2. [Insert data in to the database](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/execute.bal) - Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table +2. [Insert data in to the database](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/execute) - Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table ## Prerequisites diff --git a/examples/execute/Ballerina.toml b/examples/execute/Ballerina.toml new file mode 100644 index 0000000..e1a6f69 --- /dev/null +++ b/examples/execute/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "sample" +name = "execute" +version = "0.1.0" +distribution = "2201.8.2" + +[build-options] +observabilityIncluded = true diff --git a/examples/execute.bal b/examples/execute/execute.bal similarity index 100% rename from examples/execute.bal rename to examples/execute/execute.bal diff --git a/examples/execute/execute.md b/examples/execute/execute.md new file mode 100644 index 0000000..a9e2c44 --- /dev/null +++ b/examples/execute/execute.md @@ -0,0 +1,28 @@ +# Execute function + +Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table. + +## Prerequisites + +### 1. Set up + +Refer to the set up guide in [ReadMe](../../../README.md) for necessary credentials. + +### 2. Configuration + +Configure AWS Redshift API credent ials in Config.toml in the example directory: + +```toml + jdbcUrl="" + user="" + password="" +``` + + +## Run the Example + +Execute the following command to run the example: + +```bash +bal run +``` diff --git a/examples/query/Ballerina.toml b/examples/query/Ballerina.toml new file mode 100644 index 0000000..85a39d9 --- /dev/null +++ b/examples/query/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "sample" +name = "query" +version = "0.1.0" +distribution = "2201.8.2" + +[build-options] +observabilityIncluded = true diff --git a/examples/query.bal b/examples/query/query.bal similarity index 100% rename from examples/query.bal rename to examples/query/query.bal diff --git a/examples/query/query.md b/examples/query/query.md new file mode 100644 index 0000000..263fc6d --- /dev/null +++ b/examples/query/query.md @@ -0,0 +1,28 @@ +# Query function + +Connects to AWS Redshift using the Redshift connector and performs a simple SQL query to select all records from a specified table with a limit of 10. + +## Prerequisites + +### 1. Set up + +Refer to the set up guide in [ReadMe](../../../README.md) for necessary credentials. + +### 2. Configuration + +Configure AWS Redshift API credentials in Config.toml in the example directory: + +```toml + jdbcUrl="" + user="" + password="" +``` + + +## Run the Example + +Execute the following command to run the example: + +```bash +bal run +```