Cloud Functions

Note

This is a Preview feature.

SingleStore Cloud Functions is a serverless, cloud-based service that allows users to run code without managing compute resources. It enables the execution of code such as SQL queries, Python scripts, and API calls in response to trigger actions. As a fully managed service, it eliminates the need to provision or manage servers. It allows users to run complex queries and perform ETL (Extract, Transform and Load) tasks without the need to manage dedicated compute resources.

You can create and manage cloud functions using the Cloud Portal.

Publish Cloud Functions using the Cloud Portal

Create a Cloud Function

Cloud Functions can be created for shared notebooks only. You can create a cloud function:

  1. Using Cloud Functions in the left navigation

    Select Cloud Functions in the left navigation and then select Shared Notebook in order to publish a notebook as a cloud function.
  2. Using Shared Notebooks

    1. Navigate to Data Studio > Shared.

    2. Select a shared notebook.

    3. Select Publish (on the top right).

      Select Publish button in the upper right of the notebook.

New Cloud Function

After selecting Publish, a new dialog box appears.

Select Cloud Function in Publish Settings dialog.

Publish Settings

Publish as

Select Cloud Function.

Name

Enter a name for the cloud function.

Description

Enter the cloud function description.

Notebook

Select a shared notebook to publish as a cloud function. The shared notebook is pre-selected when the cloud function is published through Notebooks.

Deployment

Select the SingleStore deployment (workspace) your notebook will connect to.

Selecting a workspace allows you to connect to your SingleStore databases referenced in the Notebook natively. You can also publish a cloud function without a deployment attached to it.

Select Next.

View the summary of the cloud function settings

Select Publish to publish your notebook as a cloud function.

Manage an Existing Cloud Function

To view an existing cloud function, select Cloud Functions in the left navigation. You can view, update, and delete a cloud function.

View a Cloud Function

To view a cloud function, select the cloud function name under the Name column.

View the cloud function in the Cloud Functions and select the cloud function name under the Name column.

You can view the following details for each cloud function:

View the cloud function details after selecting the cloud function name under the Name column in Cloud Functions.

You can view the details of a cloud function on the right navigation pane. You can copy the authorization token, refresh, and delete the cloud function from this page.

Update a Cloud Function

To update an existing cloud function, select the ellipsis in the Actions column of the cloud function, and select Update.

Update the cloud function after selecting Update in the Actions column. Shows the dialog to update the cloud function settings.

You can also update the cloud function from a shared notebook.

Select Update Cloud Function in the notebook in order to update the cloud function.

Select Update Cloud Function.

Shows the dialog to select the Update Cloud Function button after selecting the Update Cloud Function button in the notebook or Update option in the Actions Column in Cloud Functions page.

Delete a Cloud Function

To delete an existing cloud function, select the ellipsis in the Actions column of the cloud function, and select Delete.

Status of Cloud Functions

Status

Description

Initializing

The notebook is creating or updating the cloud function.

Active

The notebook is successfully published as a cloud function.

Failed

The cloud function is not configured correctly. View the notebook snapshot to debug the failure.

Error

An error unrelated to the notebook code prevented the cloud function from initializing. Refer to Troubleshoot Cloud Functions.

Troubleshoot Cloud Functions

automatically saves a snapshot of the notebook for each execution that fails. Navigate to Cloud Functions in the left navigation, select your cloud function, and download the snapshot associated with the failed cloud function to diagnose the error. The following table lists some common errors and their resolutions:

Error

Solution

Workspace Deleted

Update the cloud function and select a deployment.

Workspace Suspended

Resume the workspace, or create a new cloud function with a different deployment.

Database Detached

Reattach the database with the right permissions or create a new cloud function with a different database.

Notebook Deleted/Not Present

Create a new cloud function with a different notebook.

Internal Errors/Misc

Reach out to SingleStore Support or use the chat feature in the Cloud Portal.

Last modified: December 5, 2024

Was this article helpful?