Bench ICA Python Library

This tutorial demonstrates how to use the ICA Python library packaged with the JupyterLab image for Bench Workspaces.

See the JupyterLab documentation for details about the JupyterLab docker image provided by Illumina.

The tutorial will show how authentication to the ICA API works and how to search, upload, download and delete data from a project into a Bench Workspace. The python code snippets are written for compatibility with a Jupyter Notebook.

Python modules

Navigate to Bench > Workspaces and click Enable to enable workspaces. Select +New Workspace to create a new workspace. Fill in the required details and select JupyterLab for the Docker image. Click Save and Start to open the workspace. The following snippets of code can be pasted into the workspace you've created.

This snippet defines the required python modules for this tutorial:

# Wrapper modules
import icav2
from icav2.api import project_data_api
from icav2.model.problem import Problem
from icav2.model.project_data import ProjectData

# Helper modules
import random
import os
import requests
import string
import hashlib
import getpass

Authentication

This snippet shows how to authenticate using the following methods:

  • ICA Username & Password

  • ICA API Token

Data Operations

These snippets show how to manage data in a project. Operations shown are:

  • Create a Project Data API client instance

  • List all data in a project

  • Create a data element in a project

  • Upload a file to a data element in a project

  • Download a data element from a project

  • Search for matching data elements in a project

  • Delete matching data elements in a project

List Data

Create Data

Upload Data

Download Data

Search for Data

Delete Data

Base Operations

These snippets show how to get a connection to a base database and run an example query. Operations shown are:

  • Create a python jdbc connection

  • Create a table

  • Insert data into a table

  • Query the table

  • Delete the table

Snowflake Python API documentation can be found here

This snipppet defines the required python modules for this tutorial:

Get Base Access Credentials

Create a Table

Add Table Record

Query Table

Delete Table

Last updated

Was this helpful?