From 17da68ee7c6e4a54debfdb5f998edc4b50d62276 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 10:28:55 +0530 Subject: [PATCH 1/8] Fix build workflow badge --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cfe050..b9437c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Build on: push: branches: - - master + - main - 2201.[0-9]+.x repository_dispatch: types: check_connector_for_breaking_changes From 1b01f4c352406c99f51c23e331b4db800f1a5f0b Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 10:33:39 +0530 Subject: [PATCH 2/8] Fix example --- examples/query/query.bal | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/query/query.bal b/examples/query/query.bal index a0a267e..c9b0c1d 100644 --- a/examples/query/query.bal +++ b/examples/query/query.bal @@ -27,11 +27,18 @@ configurable string password = ?; // Initialize the Redshift client redshift:Client dbClient = check new (jdbcUrl, user, password); +// Create the result record to match the columns of the table being queried. +type User record {| + string name; + string email; + string state; +|}; + public function main() returns error? { - sql:ParameterizedQuery sqlQuery = `SELECT * FROM your_table_name limit 10`; - stream resultStream = dbClient->query(sqlQuery); - check from record {} result in resultStream + sql:ParameterizedQuery sqlQuery = `SELECT * FROM Users limit 10`; + stream resultStream = dbClient->query(sqlQuery); + check from User user in resultStream do { - io:println("Full details of users: ", result); + io:println("Full details of users: ", user); }; } From 39cf4e96ec7eee448f8bb836b1baa14fadd3e4dd Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 10:44:19 +0530 Subject: [PATCH 3/8] Update docs --- README.md | 13 ++++++++++--- ballerina/Module.md | 13 ++++++++++--- ballerina/Package.md | 13 ++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e1c8bb2..5b1a414 100644 --- a/README.md +++ b/README.md @@ -84,11 +84,18 @@ Now, utilize the available connector operations. #### Read data from the database ```ballerina +// Create the result record to match the columns of the table being queried. +type User record {| + string name; + string email; + string state; +|}; + sql:ParameterizedQuery sqlQuery = `SELECT * FROM Users limit 10`; -stream resultStream = dbClient->query(sqlQuery); -check from record {} result in resultStream +stream resultStream = dbClient->query(sqlQuery); +check from User user in resultStream do { - io:println("Full details of users: ", result); + io:println("Full details of users: ", user); }; ``` diff --git a/ballerina/Module.md b/ballerina/Module.md index 61740bc..6a21e32 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -79,11 +79,18 @@ Now, utilize the available connector operations. #### Read data from the database ```ballerina +// Create the result record to match the columns of the table being queried. +type User record {| + string name; + string email; + string state; +|}; + sql:ParameterizedQuery sqlQuery = `SELECT * FROM Users limit 10`; -stream resultStream = dbClient->query(sqlQuery); -check from record {} result in resultStream +stream resultStream = dbClient->query(sqlQuery); +check from User user in resultStream do { - io:println("Full details of users: ", result); + io:println("Full details of users: ", user); }; ``` diff --git a/ballerina/Package.md b/ballerina/Package.md index 6fab16d..91fb75a 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -80,11 +80,18 @@ Now, utilize the available connector operations. #### Read data from the database ```ballerina +// Create the result record to match the columns of the table being queried. +type User record {| + string name; + string email; + string state; +|}; + sql:ParameterizedQuery sqlQuery = `SELECT * FROM Users limit 10`; -stream resultStream = dbClient->query(sqlQuery); -check from record {} result in resultStream +stream resultStream = dbClient->query(sqlQuery); +check from User user in resultStream do { - io:println("Full details of users: ", result); + io:println("Full details of users: ", user); }; ``` From 35dca7068332c0b60520ec909b507041648a15bc Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 10:47:38 +0530 Subject: [PATCH 4/8] Update setup link --- examples/music-store/music_store.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/music-store/music_store.md b/examples/music-store/music_store.md index d6635e9..973238c 100644 --- a/examples/music-store/music_store.md +++ b/examples/music-store/music_store.md @@ -18,7 +18,7 @@ Configure AWS Redshift API credentials in `Config.toml` within the setup and mus ## Run the Example -1. First, run the [`setup`](setup) ballerina program to set up the `MUSIC_STORE` database used in the sample. Execute the following command: +1. First, run the [`setup`](../setup) ballerina program to set up the `MUSIC_STORE` database used in the sample. Execute the following command: ```bash cd setup bal run From c1c23511b91d3be6ea39e1ef3bc40c67a144cf90 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 10:56:18 +0530 Subject: [PATCH 5/8] Add music store in examples page --- examples/README.md | 2 ++ examples/music-store/music_store.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 9b00b3d..14818ca 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,6 +6,8 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Am 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 +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic CRUD operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. + ## Prerequisites 1. Follow the [instructions](https://github.com/ballerina-platform/module-ballerinax-aws.redshift#set-up-guide) to set up the AWS Redshift cluster. diff --git a/examples/music-store/music_store.md b/examples/music-store/music_store.md index 973238c..12d9b87 100644 --- a/examples/music-store/music_store.md +++ b/examples/music-store/music_store.md @@ -18,7 +18,7 @@ Configure AWS Redshift API credentials in `Config.toml` within the setup and mus ## Run the Example -1. First, run the [`setup`](../setup) ballerina program to set up the `MUSIC_STORE` database used in the sample. Execute the following command: +1. First, run the [`setup`](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store/setup) ballerina program to set up the `MUSIC_STORE` database used in the sample. Execute the following command: ```bash cd setup bal run From 5f2465caede010ab5654d4d56b2cef01945c6219 Mon Sep 17 00:00:00 2001 From: Niveathika Date: Tue, 6 Feb 2024 10:59:25 +0530 Subject: [PATCH 6/8] Fix indentation --- examples/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/README.md b/examples/README.md index 14818ca..52a663b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -13,11 +13,11 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Am 1. Follow the [instructions](https://github.com/ballerina-platform/module-ballerinax-aws.redshift#set-up-guide) to set up the AWS Redshift cluster. 2. For each example, create a new Ballerina project. Copy the provided example code into the project, and include a `config.toml` file with the necessary JDBC URL, username, and password. Below is an example illustrating how your `config.toml` file should be structured: -```toml - jdbcUrl="" - user="" - password="" -``` + ```toml + jdbcUrl="" + user="" + password="" + ``` ## Running an Example From 10fd04883f5a72d6319ffd29015d8c4efcfb9860 Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 11:02:32 +0530 Subject: [PATCH 7/8] Update example description --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 52a663b..cf7daa7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,7 +6,7 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Am 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 -3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic CRUD operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This guide explains how to create an HTTP RESTful API using Ballerina for performing basic CRUD operations on a database by connecting to AWS Redshift. ## Prerequisites From 8edae82f58d49da57f9bd71c34a4f66972e8438d Mon Sep 17 00:00:00 2001 From: aashikam Date: Tue, 6 Feb 2024 11:07:17 +0530 Subject: [PATCH 8/8] Update example references --- README.md | 6 ++++++ ballerina/Module.md | 6 ++++++ ballerina/Package.md | 6 ++++++ examples/README.md | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b1a414..44b42b9 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,12 @@ _ = check dbClient->execute(sqlQuery); The `aws.redshift` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/tree/master/examples). +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) - Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table + +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic CRUD operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. + ## Issues and projects The **Issues** and **Projects** tabs are disabled for this repository as this is part of the Ballerina library. To report bugs, request new features, start new discussions, view project boards, etc., visit the Ballerina library [parent repository](https://github.com/ballerina-platform/ballerina-library). diff --git a/ballerina/Module.md b/ballerina/Module.md index 6a21e32..57f8e0d 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -105,3 +105,9 @@ _ = check dbClient->execute(sqlQuery); ## Examples The `aws.redshift` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/tree/master/examples). + +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) - Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table + +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic CRUD operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. diff --git a/ballerina/Package.md b/ballerina/Package.md index 91fb75a..c0e6032 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -106,6 +106,12 @@ _ = check dbClient->execute(sqlQuery); The `aws.redshift` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/tree/master/examples). +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) - Connects to AWS Redshift using the Redshift connector and performs an INSERT operation into a specified table + +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. + ## Report issues To report bugs, request new features, start new discussions, view project boards, etc., go to the [Ballerina Extended Library repository](https://github.com/ballerina-platform/ballerina-library) diff --git a/examples/README.md b/examples/README.md index cf7daa7..ac0c745 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,7 +6,7 @@ The `ballerinax/aws.redshift` connector facilitates seamless integration with Am 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 -3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This guide explains how to create an HTTP RESTful API using Ballerina for performing basic CRUD operations on a database by connecting to AWS Redshift. +3. [Music store](https://github.com/ballerina-platform/module-ballerinax-aws.redshift/blob/main/examples/music-store) - This example illustrates the process of creating an HTTP RESTful API with Ballerina to perform basic CRUD operations on a database, specifically AWS Redshift, involving setup, configuration, and running examples. ## Prerequisites