Skip to main content
In Wherobots Cloud, a View allows you to persist and share common query results and transformations for Wherobots Spatial Catalog data. A View, also known as a non-materialized view, does not store data; it is a saved query that runs against specified tables. Views are created and managed through SQL commands executed within a Wherobots Notebook. You can see details of your view in either a Wherobots Notebook or the Data Hub.

Benefits

By using Views, you can:
  • Standardize common queries across your organization.
  • Share these standard queries with others.
  • Allow for finer-grained control over query results.
  • Prevent accidental writes to tables.

Before you start

Before using this feature, ensure that you have:
  • An Account within a Professional, Innovation, or Enterprise Edition Organization. For more information, see Create a Wherobots Account.
    • Both Admin and User roles have access to Views in Wherobots Cloud.
  • A writable schema in a Wherobots-managed catalog. The first example also requires an existing table with country and region columns; replace the example’s org_catalog.joins.polygons table name with yours. The geospatial example creates its own source tables.

Create a view

Best practices for naming viewsWhen naming your views, consider the following best practices:
  • Use a consistent naming convention that reflects the purpose of the view.
  • Include relevant metadata, such as the source data or transformation type, in the view name.
  • Avoid using special characters or spaces in view names to ensure compatibility with SQL queries.
To create a new view from an existing table in a Wherobots Notebook:
  1. Log in to Wherobots Cloud.
  2. Start a notebook with a runtime of your choice.
  3. Open the notebook and execute the following code to initiate the SedonaContext.
  4. Replace the catalog, schema, and source table names in the following code with yours, then run it to create a view. Choose a suffix that is unique within your schema.
    To see the new view in Wherobots Cloud, navigate to the Data Hub. Click on the view to verify its details, schema, and SQL definition.

Update a view

To update an existing view’s definition, execute a CREATE OR REPLACE VIEW statement with an updated SQL query in your Wherobots Notebook. This example keeps only groups with two or more polygons.

Rename a view

To rename an existing view, use the ALTER VIEW command in your Wherobots Notebook.

Delete a view

To delete a view, use the DROP VIEW command:

List views

To list all views in a specific catalog and schema within your Wherobots organization, run the SHOW VIEWS command:

Example: Create a view with geospatial data

This example demonstrates how to create a view that combines geospatial data from two different datasets: building footprints and elevation data.
  1. In a Wherobots Notebook, initiate the SedonaContext if you haven’t already:
  2. Create the example schema, then load the sample datasets and write them to your catalog. If your organization uses a different writable managed catalog, replace org_catalog.joins throughout this example.
  3. Create a view that joins the two tables and calculates the average elevation for each building.
    Now, you can query or visualize your new view.

Usage considerations

  • Currently, views from Unity Catalog are not accessible and will not appear in the Data Hub interface.
  • Currently, creating views that reference tables stored in Unity Catalog is an unsupported operation.
  • Within the Wherobots Managed Catalog, you have the flexibility to create views that reside in one existing catalog/schema while referencing data from another existing catalog/schema.