# Build a Python Notebook Manually

If you opt for the **'Build Manually'** method, follow these steps:

### **Access the Python Notebook Editor**

When the **"Build Manually"** option is selected, you will be directed to the main Python notebook editor. A default Python code block is automatically created, where you can begin writing and executing Python code to generate outputs.

### **Inserting Code and Text Blocks**

As you navigate through the notebook, you can easily add more content using the following options located in the each code block:

* **+ Python**: Inserts a new Python code block.
* **+ Text**: Adds a text block to include notes or explanations.
* **+ SQL**: Allows you to insert SQL code blocks to query data directly within the notebook.

All changes are saved automatically to ensure no progress is lost during your work.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FCrRxuO7URQmaWwJRF0ef%2Fimage.png?alt=media&#x26;token=5e5ac5aa-45e8-4582-b4a7-54f4680d3bb9" alt=""><figcaption></figcaption></figure>

### **Adding Data Sources**

On the left side of the notebook interface, the **Data Sources** panel is available to import databases or files. You can:

* **+ Add Database**: Connect to an external database.
* **+ Add File**: Upload files from your system. These are the accepted extensions: .csv, .xlsx, .json, .parquet

Upon clicking either option, a data source panel will open, following the same process used in [**Step 1**](https://docs.autonmis.com/create-your-first-connection/step-1-navigate-to-the-connect-tab) of **Creating Your First Connection**.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FjGPUQy5g56gHjGHieb6j%2Fimage.png?alt=media&#x26;token=33744d21-8d62-4b5c-8278-9626cef03e7b" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2Fd0UzgGMd8vuxNO9caDsV%2Fimage.png?alt=media&#x26;token=7d8acf07-03c8-47b4-b7e3-be682e4cfd9a" alt="" width="375"><figcaption></figcaption></figure>

### **Selecting Data for Import**

From the data source panel, you can select a database or file from your previously connected sources. If connecting to a database, select the appropriate table from the dropdown menu.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FtJDJhTtm7kcHeb1YE5SA%2Fimage.png?alt=media&#x26;token=75e9ea55-77dc-4566-b0f3-ef76574d7f44" alt="" width="375"><figcaption></figcaption></figure>

### **Importing Data to the Notebook**

Once your database or file is selected, click the **"Import to Notebook"** button. This will automatically create a new Python code block on the right side of the editor, populated with the relevant code to load and work with your selected data.

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FmoUUegyaqZrXZT7P0xfZ%2Fimage.png?alt=media&#x26;token=fe91cc2e-fda3-4f3a-ae03-09884c85f1bf" alt="" width="375"><figcaption></figcaption></figure>

### **Working with Code Blocks**

* Each code block provides options to:
  1. **Run the query**
  2. **Modify variable names**
  3. **Use AI Copilot** for suggestions (pencil icon)
  4. **Hide the Code, move up/down, or delete the step**

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FIKVpbVDb8EtcHIDdxXZ5%2Fimage.png?alt=media&#x26;token=5c9e9c15-5fcf-473e-ba10-47e8c1472d69" alt=""><figcaption></figcaption></figure>

### **Additional Features**

* At the top of the notebook, you'll find CTAs:
  1. **Publish or Share** using the vertical ellipsis menu
  2. **Run all code blocks**
  3. **Save** the notebook (all changes are saved automatically)
  4. **Notebook** tab (default view)
  5. **Storybook** tab: Displays the notebook's analysis in narrative form

<figure><img src="https://1640066561-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3UjpVP9YQLo2slTy7qQ1%2Fuploads%2FS8iIFudGeWNmoWEVuSan%2Fimage.png?alt=media&#x26;token=9c0e43b0-01af-4ab1-a192-575fe8a871ab" alt=""><figcaption></figcaption></figure>
