Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connection recipes #317

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Developers who are evaluating or working with Sigma's REST API.
<button>[Sigma Free Trial](https://www.sigmacomputing.com/free-trial/)</button>

## Environment Setup
Duration: 5

### Create Sigma Project Folder

Expand Down Expand Up @@ -180,6 +181,8 @@ For more information on the supported API instances, see [Identify your API requ
<!-- END OF SECTION-->

## Authentication - REQUIRED
Duration: 5

This section demonstrates the code that was provided on the `API Code Samples` > `Authentication: Get Access Token` page, [located here.](https://docs.sigmacomputing.com/api/v2/#auth)

### Description
Expand Down Expand Up @@ -212,6 +215,72 @@ We can now move on to use cases, leveraging the `getBearerToken` function:

<img src="assets/apics21.png" width="800"/>

<aside class="positive">
<strong>IMPORTANT:</strong><br> All the recipes fetch a bearer token for authentication for efficient API requests.
</aside>

![Footer](assets/sigma_footer.png)
<!-- END OF SECTION-->

## Connections - List All
Duration: 5

This section demonstrates the code that was provided on the `API Code Samples` > `Connections: List all` page, [located here.](https://help.sigmacomputing.com/recipes/connections-list-all)

<aside class="positive">
<strong>IMPORTANT:</strong><br> This script will call the get-access-token > getBearerToken function to get a new/refreshed token automatically so there is no need to do anything else, assuming you have completed the section of this QuickStart "Authentication - REQUIRED" and ensured your .env file is configured correctly.
</aside>

### Description
This script lists all connections in a specific Sigma instance, based on cloud provider where Sigma is deployed and the API keys used.

### Running the Script

Open the file `list_all_connections.js` in the connections folder:

Each code block is commented to explain what operations are being performed.

Open the `env` file and provide a `CONNECTIONID` to use for the API call.

From the `list_all_connections.js` file, press `F5` to run the script with VSCode's debugger.

The expected response is:

<img src="assets/apics69.png" width="800"/>

![Footer](assets/sigma_footer.png)
<!-- END OF SECTION-->

## Connections - Sync All Tables in Schema
Duration: 5

This section demonstrates the code that was provided on the `API Code Samples` > `Workbook: List All` page, [located here.](https://help.sigmacomputing.com/recipes/connections-sync-schema)

<aside class="positive">
<strong>IMPORTANT:</strong><br> This script will call the get-access-token > getBearerToken function to get a new/refreshed token automatically so there is no need to do anything else, assuming you have completed the section of this QuickStart "Authentication - REQUIRED" and ensured your .env file is configured correctly.
</aside>

### Description
This script automates the synchronization of tables within a schema that is specified in the `.env` file.

The script resolves the schema's `inodeId` based on the provided `SYNC_PATH` in the .env file, lists all tables within the schema, and constructs full paths for each table.

Finally, it syncs each table individually using the full path, ensuring that the process dynamically handles all tables within the specified schema.

### Running the Script

Open the file `sync_schema.js` in the connections folder:

Each code block is commented to explain what operations are being performed.

Open the `env` file and provide either a `CONNECTIONID` and `SYNC_PATH` to use for the API call.

From the `sync_schema.js` file, press `F5` to run the script with VSCode's debugger.

The expected response is:

<img src="assets/apics70.png" width="800"/>

![Footer](assets/sigma_footer.png)
<!-- END OF SECTION-->

Expand Down Expand Up @@ -387,7 +456,7 @@ Open the file `get-member-details.js` in the members folder:

Each code block is commented to explain what operations are being performed.

Open the `env` file and provide either a `MEMBERID` or `EMAIL` to use for the API call. 1
Open the `env` file and provide either a `MEMBERID` or `EMAIL` to use for the API call.

From the `create-new.js` file, press `F5` to run the script with VSCode's debugger.

Expand Down Expand Up @@ -1219,7 +1288,6 @@ The expected response is:
![Footer](assets/sigma_footer.png)
<!-- END OF SECTION-->


## Workbook: Shared with Me
Duration: 20

Expand Down Expand Up @@ -1249,17 +1317,6 @@ The expected response is:
![Footer](assets/sigma_footer.png)
<!-- END OF SECTION-->












## Workbook: Update Owner
Duration: 20

Expand Down
Loading