# Utility

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

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FJ2aq0GbtWdb7CcRz4rdz%2FImport%20Utility%20File%20PySpark.mp4?alt=media&token=444f4733-5a54-4598-9fd2-09118d26cb78>" %}

## 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://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FSjH5AqXidoZHELWpmLsi%2Fimage.png?alt=media&#x26;token=16116a96-0280-4cd5-b4c0-d5186bd0970d" alt=""><figcaption></figcaption></figure>

* The ***Add utility script*** page opens.
* Select the Import Utility option (This option is selected by default).
* Provide the following information:
  * Utility Name
  * Utility Description
  * Utility Script
* Click the ***Save*** option.

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FDhJ6Tng6GVXFJzOCbdJc%2Fimage.png?alt=media&#x26;token=acff14c9-9e01-4713-b20b-0ed720958c6e" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2F1KQH0oFe2CbrBIvdjYbz%2Fimage.png?alt=media&#x26;token=2c652e73-cbe6-476c-9a54-48c788f5d9ca" alt=""><figcaption><p><em><strong>The newly created Utility script gets listed under the Utility List.</strong></em></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>

{% hint style="success" %}
*Check out the given video given below on how to import a utility script inside a Notebook.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2F5P4i7OJ1POdxxAJOIACE%2FRunning%20Utility%20Script%20in%20Notebook.mp4?alt=media&token=8c2dd77c-f01d-4dc0-a4bd-996ca86e7e61>" %}
***Importing a Utility Script inside Platform***
{% endembed %}

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

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FbH63KYXLJi76Q18KNJoq%2Fimage.png?alt=media&#x26;token=f8d4f2c1-cba8-428f-8c26-465e15a8a84c" alt=""><figcaption><p><em><strong>Copying the Utility script name</strong></em></p></figcaption></figure>

* Upload a Notebook or create a new 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://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FzC7oQlCnPQFl6g5wAEwB%2Fimage.png?alt=media&#x26;token=fc7f5f8b-f63d-493a-933a-7cde293a7681" alt=""><figcaption><p><em><strong>Using the Utility Script inside a Notebook</strong></em></p></figcaption></figure>

## Updating the Utility Script

{% hint style="success" %}
*Check out the given walk-through on how to update a utility script.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FS3u5PBLQjMLn5fmqBfJ6%2FUpdating%20a%20Utility%20Script_PySpark.mp4?alt=media&token=41006ca7-345c-4130-b373-987fd607958a>" %}
***Updating Utility Script***
{% endembed %}

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

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2Fi08YatCVoK3JEFKDtKsy%2Fimage.png?alt=media&#x26;token=26abac36-6d7e-4f39-a9b5-e4b90fba0d0c" alt=""><figcaption></figcaption></figure>

* The ***Update Utility Script*** page opens displaying the utility script content.
* Click the ***Validate*** option.

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FmjyXMCOFkAZuUvKR9Dyj%2Fimage.png?alt=media&#x26;token=b585ceea-41fe-444c-a711-721eb8da6d91" alt=""><figcaption></figcaption></figure>

* The Logs will be displayed in the Logs space.
* Click the ***Update*** option.

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2FGZBzzkLqlpQA1MtcBPhP%2Fimage.png?alt=media&#x26;token=c904eac6-7812-4f3d-9d69-7e6a9b81697f" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2587201349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBLGYLEkBUnc8nVEBAuEI%2Fuploads%2Fj8tKqvZJ0FSzpvVlvntc%2Fimage.png?alt=media&#x26;token=57e9c917-2d4c-477c-84d7-173c16861d51" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* The name of the selected utility script cannot be changed by using the update option.
* *Refer the* [***Data Science Lab Quick Start Flow*** ](https://docs.bdb.ai/data-science-lab-3/data-science-lab-quick-start-flow)*page to get an overview of the **Data Science Lab** module in nutshell.*&#x20;
  {% endhint %}
