> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Editor

export const maia = "Maia";

export const designer = "Designer";

Editing files in {designer} uses Code Editor. You can [edit a variety of file types](#edit-files), and when you edit .sql or .py files you can then link these to your [SQL Script](/docs/components/sql-script) and [Python Pushdown](/docs/components/python-script) components in your orchestration pipelines to run those scripts.

Code Editor is powered by the [Monaco Editor](https://microsoft.github.io/monaco-editor/), which also powers Visual Studio Code and other editors across the web.

Code Editor supports basic syntax colorization and works with the [command palette](#command-palette) in {designer}.

***

## Video example

<iframe width="560" height="315" src="https://www.youtube.com/embed/e5-mN9KK0Mg?si=jH7P1cCZHXc83Mat&enablejsapi=1" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen />

***

## Create files to edit

The following file types can be created within {designer} and then edited in Code Editor:

* .sql
* .py

To create .sql or .py files:

1. In the **Files** panel, click the **+** icon.
2. Choose what file to create:
   1. Python script (.py)
   2. SQL script (.sql)

This will situate the newly created file *outside* any folders.

To create a file inside a folder, click the three dots **...** alongside that folder and then click **Add** → **Python script** (or other type of file).

Creating a new Python script or SQL script will open that new script in Code Editor.

***

## Edit files

If the repository you have connected to a {maia} project contains any of the following files, you can edit them in Code Editor:

* .sql
* .py
* .yaml ([including the shared-pipelines.yaml file](/docs/guides/shared-pipelines#editing-the-configuration-file))
* .csv
* .md
* .txt
* .sc
* .js
* .css
* .xml
* .html

.sql files can be used in the [SQL Script](/docs/components/sql-script) component and .py files can be used in the [Python Pushdown](/docs/components/python-script) component in your orchestration pipelines.

<Note>
  We are working to add support for editing .json files.
</Note>

<Note>
  All the file types in this list can be imported to and exported from {designer}.
</Note>

***

## Rename, move, and delete files

You can rename, move, and delete any files in your project.

***

## Using variables in the code editor

### Snowflake

<Warning>
  When naming variables, avoid using [Snowflake reserved keywords](https://docs.snowflake.com/en/sql-reference/reserved-keywords).
</Warning>

| Applies to                                                                                                    | Note                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Code written inside the [SQL Script](/docs/components/sql-script) component.                                  | Supports both existing variable code `${variable}` and [Snowflake variable](https://docs.snowflake.com/en/sql-reference/session-variables) syntax. |
| Code written inside the [SQL](/docs/components/sql) transformation component.                                 | Supports the existing variable code `${variable}`.                                                                                                 |
| Code written inside SQL script files.                                                                         | Only [Snowflake variable](https://docs.snowflake.com/en/sql-reference/session-variables) syntax is supported.                                      |
| Code written inside the [Python Pushdown](/docs/components/python-pushdown) component or Python script files. | Only [Python variable syntax](/docs/guides/variables#python-scripts) is supported.                                                                 |

### Databricks

<Warning>
  When naming variables, avoid using [Databricks reserved keywords](https://docs.databricks.com/en/sql/language-manual/sql-ref-reserved-words.html).
</Warning>

| Applies to                                                                    | Note                                                                                                                                                            |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Code written inside the [SQL Script](/docs/components/sql-script) component.  | Supports both existing variable code `${variable}` and [Databricks variable](https://docs.databricks.com/en/sql/language-manual/sql-ref-variables.html) syntax. |
| Code written inside the [SQL](/docs/components/sql) transformation component. | Supports the existing variable code `${variable}`.                                                                                                              |
| Code written inside SQL script files.                                         | Only [Databricks variable](https://docs.databricks.com/en/sql/language-manual/sql-ref-variables.html) syntax is supported.                                      |
| Code written inside Python script files.                                      | Only [Python variable syntax](/docs/guides/variables#python-scripts) is supported.                                                                              |

<Warning>
  The Python Pushdown component is not yet available for Databricks projects. You can use Code Editor to edit your .py files, but you cannot run these Python scripts from a Databricks project in {designer} yet.
</Warning>

### Amazon Redshift

<Warning>
  When naming variables, avoid using [Amazon Redshift reserved keywords](https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html).
</Warning>

| Applies to                                                                    | Note                                                                               |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Code written inside the [SQL Script](/docs/components/sql-script) component.  | Supports the existing variable code `${variable}`.                                 |
| Code written inside the [SQL](/docs/components/sql) transformation component. | Supports the existing variable code `${variable}`.                                 |
| Code written inside SQL script files.                                         | Variables not supported. Coming soon.                                              |
| Code written inside Python script files.                                      | Only [Python variable syntax](/docs/guides/variables#python-scripts) is supported. |

<Warning>
  The Python Pushdown component is not yet available for Amazon Redshift projects. You can use Code Editor to edit your .py files, but you cannot run these Python scripts from an Amazon Redshift project in {designer} yet.

  However, you can use the [Python Script](/docs/components/python-script) component to run Python scripts from within that component's inline editor.
</Warning>

***

## Command palette

### Designer

Using the {designer} command palette, press `cmd` + `k` (Mac) or `CTRL` + `k` (Windows) to activate the command palette in {designer}. Type the name of the file you wish to open and then press Enter. Alternatively, activate the command palette by clicking the magnifying glass (search) in the top-left.

### Monaco Editor

Using the Monaco Editor command palette, press `fn` + `F1` (Mac) or `F1` (Windows) to access all command palette actions available in Monaco Editor-powered editors.
