---
title: "How to Edit, Run, and Share a GSQL Query"
component: "savanna"
version: "main"
module: "graph-development"
html_url: "/savanna/main/graph-development/gsql-editor/how2-edit-gsql-query.html"
---

[View as HTML](/savanna/main/graph-development/gsql-editor/how2-edit-gsql-query.html) · [Documentation index](/llms.txt)

# How to Edit, Run, and Share a GSQL Query

The GSQL Editor provides a feature-rich environment for writing, modifying, and executing GSQL queries. With the GSQL Editor, you can leverage the syntax highlighting, auto-complete, and error checking features to write efficient and accurate GSQL queries.

By executing queries in the GSQL Editor you can then visualize the results, making it easier to iterate and refine your analysis.

> [!NOTE]
> GSQL is a powerful graph query language that enables you to express complex graph traversal and analysis operations. For more information about GSQL please visit [GSQL Query Language](https://www.tigergraph.com/docs/gsql-ref/4.3/querying/).

## Edit GSQL Query

To start writing your first GSQL query:

1. Click on the **GSQL Query** from the **+** menu.  
![Screenshot 2024 04 18 at 10.12.15 AM](../_images/Screenshot%202024-04-18%20at%2010.12.15 AM.png)  
The opened files will be listed on the top tabs on the code edit folder  
![query editor](../_images/query-editor.png)

## Run GSQL Query

To run a GSQL Query, start by:

1. Select an active workspace to run the GSQL Query.  
![gsql editor 1](../_images/gsql-editor-1.png)
2. To run a query, there are two options available: **Run** and **Run All**.  
![gsql editor 2](../_images/gsql-editor-2.png)  
   * **Run All**: The **Run All** option executes the entire GSQL script or query that is currently open in the GSQL Editor. When you click the **Run All** button, it triggers all the GSQL statements in the script from top to bottom.  
         * **Shortcut**: You can also use the shortcut to **RUN All**: **Command + Shift + Enter/ Control + Shift + Enter**.  
         > [!NOTE]  
         > This is useful when you want to run the entire GSQL script or when you have multiple queries in the script that need to be run together.  
   * **Run**: The **Run** option allows you to run only a specific portion of the GSQL query. To use this option, you need to select the desired portion of the GSQL code within the GSQL Query Editor. Once you've made the selection, clicking the **Run** button will run only the selected portion of the code.  
         * **Shortcut**: You can also use the shortcut to **Run**: **Command + Enter/ Control + Enter**  
         > [!NOTE]  
         > * This is helpful when you want to run a specific query or a subset of queries within a larger script.  
         > * If no GSQL code is selected, the **Run** button will execute the entire GSQL script.

## Share GSQL Files

You can share GSQL files with your colleagues, enabling seamless collaboration on query development and analysis.

> [!NOTE]
> Collaboration is essential for efficient graph analysis.

This promotes knowledge sharing, accelerates development, and ensures consistency in query execution across the team.

You can select the **Share** button from the file menu.

![Screenshot 2024 04 18 at 10.14.24 AM](../_images/Screenshot%202024-04-18%20at%2010.14.24 AM.png) 

> [!NOTE]
> You can only share a GSQL file if you are the file owner.

![Screenshot 2024 04 18 at 10.14.54 AM](../_images/Screenshot%202024-04-18%20at%2010.14.54 AM.png) 

In TigerGraph Savanna, GSQL files have **Viewer** and **Editor** permissions that can be assigned to individual users or shared with the entire organization.

![Screenshot 2024 04 18 at 10.15.25 AM](../_images/Screenshot%202024-04-18%20at%2010.15.25 AM.png) 

* **Viewer Permission**: The **Viewer** permission allows users to view the content of a GSQL file. Users with **Viewer** permission can open the file in the GSQL Editor, read the GSQL code, and review the query logic, and run the GSQL file. However, they cannot make any changes or modifications to the file.  
> [!NOTE]  
> **Viewer** permission is suitable for users who need to review and understand the GSQL code but do not require editing capabilities.
* **Editor Permission**: The **Editor** permission grants users the ability to view and edit the content of a GSQL file. Users with **Editor** permission can open the file in the GSQL Editor, make changes to the GSQL code, and save those modifications. They have full control over the file and can update query logic, add new queries, or remove existing ones.  
> [!NOTE]  
> **Editor** permission is typically given to users who need to actively modify and maintain the GSQL code.

When assigning permissions to GSQL files, you can specify individual users within your organization or share the file with the entire organization. This allows you to control access and collaborate effectively. By assigning Viewer or Editor permissions to specific users, you can ensure that only authorized individuals can view or edit the GSQL files.

Sharing with the entire organization can be useful when you want to provide broad access to GSQL files for collaboration and knowledge sharing within your organization.

## Next Steps

Next, learn to [Explore graph](../explore-graph/index.md).

Or return to the [Overview](../../overview/index.md) page for a different topic.
