# Utility

{% hint style="info" %}
*Check out this walk-through on how to import a Utility scrip.*
{% endhint %}

<figure><img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FHjwf5IOIGTLblg9C7qYt%2FUtility%20script.gif?alt=media&#x26;token=cf80b34d-20c4-4aa5-b53b-82a74884f7d6" alt=""><figcaption></figcaption></figure>

## Importing a Utility Script <a href="#importing-a-utility-script" id="importing-a-utility-script"></a>

* Navigate to the ***Utility*** tab for a Project.
* Click the ***Add Script*** option.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FCQW16GFoBBqLBuRDCkSa%2Fimage.png?alt=media&#x26;token=4df7f4f5-4874-4dd0-8642-9b6bca2a9ec3" alt=""><figcaption></figcaption></figure>

* The ***Add utility script*** page opens.
* Provide the following information:
  * Utility Name
  * Utility Description
  * Utility Script
* Click the ***Save*** option.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FZw1Fu7mOA7bO2NzF914x%2Fimage.png?alt=media&#x26;token=e083fd4e-0275-4c4d-a0ee-202fb3a5e29e" alt=""><figcaption><p>The Add Utility Script form to provide the required details</p></figcaption></figure>

* A confirmation message appears.
* The newly created Utility Script gets added to the Utility list.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FTBE8ASZVZj2TK5a0p1qp%2Fimage.png?alt=media&#x26;token=b38a7302-b807-47a1-81dd-f5509876a536" alt=""><figcaption><p>The newly imported Utility script lists under the Utility list</p></figcaption></figure>

## Importing the Utility Script inside a Notebook <a href="#importing-the-utility-script-inside-a-notebook" id="importing-the-utility-script-inside-a-notebook"></a>

* Copy a utility script name using the Utility list.
* Navigate to the Notebook tab.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FicGKVQCd2v83XWhBbwAA%2Fimage.png?alt=media&#x26;token=daf20ad7-1884-48ff-b6c8-d759028e2064" alt=""><figcaption></figcaption></figure>

* Create a Notebook or open an existing Notebook and navigate to the Notebook page.
* Add a ***Code*** ***cell***.
* Write code to import data with specific class.
* Provide the Utility script as the resource to get data.
* Specify the variables to get the class and get the data in the next code cell.
* Provide print function to see the data.
* Run all the cells.
* You can get the output below.​

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FH3WWhhWBsafnMvAIEdp1%2Fimage.png?alt=media&#x26;token=2e085840-6a52-4a05-b3db-71fb2c7816d9" alt=""><figcaption></figcaption></figure>

## Updating the Utility Script

* Navigate to the ***Utility*** tab.
* Select an uploaded utility script from the list.
* Click the ***Edit*** icon.    &#x20;

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2F6HvE0aW6cHaUT4kGDkSX%2Fimage.png?alt=media&#x26;token=0335c040-c13b-4611-ab50-d1984ba2d83a" alt=""><figcaption></figcaption></figure>

* The ***Update Utility Script*** page opens.
* &#x20;The Utility script content gets displayed. The user can modify the content if needed.
* Click the ***Update*** option.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2F5wbkAn3oh6CfSRiLkb8T%2Fimage.png?alt=media&#x26;token=22a479b1-3a9c-447a-84a5-ef52b792a9e8" alt=""><figcaption></figcaption></figure>

* A success message appears.
* The selected Utility script gets updated.

<figure><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FlXeSmX8CFIuCZj30YXGt%2Fimage.png?alt=media&#x26;token=f5316ca0-d298-4b96-9126-e5ee001dffc5" alt=""><figcaption></figcaption></figure>

**Actions Provided on the Utility List Page**

<table><thead><tr><th width="99.33333333333331">Icon</th><th width="93">Name</th><th>Actions</th></tr></thead><tbody><tr><td><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2FkyC1yvDeXn2vtaIGhinM%2Fimage.png?alt=media&#x26;token=60331b47-d987-4da7-84c2-50035297e6e5" alt=""></td><td>Edit</td><td>Redirects the user to the Update Utility Script page.</td></tr><tr><td><img src="https://3380046084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2o93pDKCv7WARnWqh9pf%2Fuploads%2Fe7PrMcSNIpovHv3eG33x%2Fimage.png?alt=media&#x26;token=ae7686b3-901f-4829-950f-f648a096f20b" alt=""></td><td>Delete</td><td>Prompts to delete the selected Utility Script.</td></tr></tbody></table>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Refer the **Data Science Lab Quick Start Flow** page to get an overview of the **Data Science Lab** module in nutshell.* [***Click here***](https://docs.bdb.ai/data-science-lab-2/data-science-lab-quick-start-flow) *to get redirected to the quick start flow page.*
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bdb.ai/data-science-lab-2/project/tabs-for-a-data-science-lab-project/tabs-for-pyspark-environment/utility.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
