> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query tables with WherobotsDB

> List, inspect, and create catalogs, schemas, and tables with Spatial SQL or the WherobotsDB Python API, and query historical Overture Maps snapshots.

Use WherobotsDB to query tables in your Organization's catalogs with Spatial SQL or the WherobotsDB Python API from a notebook. These examples use Wherobots-managed catalogs. For external catalogs, start with the [integration guide for your catalog service](https://docs.wherobots.com/get-started/initial-storage/data-federation-overview.md).

To inspect table metadata in the Cloud UI, see [Browse and manage catalogs](https://docs.wherobots.com/get-started/initial-storage/data-hub.md). For datasets provided in `wherobots_open_data` and `wherobots_pro_data`, see [Wherobots open data](https://docs.wherobots.com/tutorials/spatial-catalog/introduction.md).

## Catalog structure

Each catalog is composed of databases (namespaces), and each database
can contain tables, which are referenced by
`<catalog>.<database>.<table>`; for example:

```sql theme={"system"}
SELECT id,geometry FROM wherobots_open_data.overture_maps_foundation.places_place
```

## Working with catalogs in SQL

Each example has a **SQL** tab and a **Python** tab, which runs the same statement with `sedona.sql()`.

### List Schemas

Lists the available schemas (databases) within a specified catalog.

> [tab] SQL
>
> ```sql theme={"system"}
> SHOW SCHEMAS IN wherobots_open_data;
> ```
>
> ```
> +---------+
> |namespace|
> +---------+
> | overture|
> +---------+
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.sql("SHOW SCHEMAS IN wherobots_pro_data").show()
> ```
>
> ```
> +----------------+
> |       namespace|
> +----------------+
> |google_microsoft|
> |         landsat|
> ...
> +----------------+
> ```

### List Tables

Lists the available tables within a specified schema.

> [tab] SQL
>
> ```sql theme={"system"}
> SHOW TABLES IN wherobots_open_data.overture LIKE 'places_*';
> ```
>
> ```
> +---------+------------+-----------+
> |namespace|   tableName|isTemporary|
> +---------+------------+-----------+
> | overture|places_place|      false|
> +---------+------------+-----------+
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.sql("SHOW TABLES IN wherobots_pro_data.weather").show()
> ```
>
> ```
> +---------+--------------+-----------+
> |namespace|     tableName|isTemporary|
> +---------+--------------+-----------+
> |  weather|weather_events|      false|
> |  weather|    wild_fires|      false|
> +---------+--------------+-----------+
> ```

### Inspect Table Schema

Displays the column names and data types for a specific table.

> [tab] SQL
>
> ```sql theme={"system"}
> DESCRIBE TABLE wherobots_pro_data.weather.weather_events;
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.table("wherobots_pro_data.weather.weather_events").printSchema()
> ```
>
> ```
> root
> |-- EventId: string (nullable = true)
> |-- Type: string (nullable = true)
> ...
> |-- geometry: geometry (nullable = true)
> ```

### View Table Content

Retrieves and displays the rows from a table.

> [tab] SQL
>
> ```sql theme={"system"}
> SELECT * FROM wherobots_pro_data.weather.weather_events LIMIT 10;`
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.table("wherobots_pro_data.weather.weather_events").show()
> ```

### Managing Catalogs

The following management commands are available in SQL and Python.

#### List Catalogs

Lists the available catalogs in your environment.

> [tab] SQL
>
> ```sql theme={"system"}
> SHOW CATALOGS LIKE 'wherobots*';
> ```
>
> ```
> +-------------------+
> |            catalog|
> +-------------------+
> |          wherobots|
> |wherobots_open_data|
> | wherobots_pro_data|
> +-------------------+
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.sql("SHOW CATALOGS LIKE 'wherobots*'").show()
> ```

#### Create a Schema

Creates a new schema (database) within a catalog to organize your tables.

> [tab] SQL
>
> ```sql theme={"system"}
> CREATE DATABASE IF NOT EXISTS org_catalog.test_db;
> ```

> [tab] Python
>
> ```python theme={"system"}
> sedona.sql("CREATE DATABASE IF NOT EXISTS org_catalog.test_db")
> ```

#### Create a Table

Creates a new table from the results of a query.

> [tab] SQL
>
> ```sql theme={"system"}
> CREATE TABLE org_catalog.test_db.top_100_hot_buildings_daily AS
> SELECT
>   buildings.id,
>   first(buildings.names),
>   count(places.geometry),
>   '2023-07-24' as ts
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place places
> JOIN
>   wherobots_open_data.overture_maps_foundation.buildings_building buildings ON ST_CONTAINS(buildings.geometry, places.geometry)
> WHERE
>   exists(places.sources, s -> s.update_time >= '2023-07-24' AND s.update_time < '2023-07-25')
> GROUP BY 1
> ORDER BY 3 DESC
> LIMIT 100;
> ```

> [tab] Python
>
> ```python theme={"system"}
> create_table_sql = """
> CREATE TABLE org_catalog.test_db.top_100_hot_buildings_daily AS
> SELECT
>   buildings.id,
>   first(buildings.names),
>   count(places.geometry),
>   '2023-07-24' as ts
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place places
> JOIN
>   wherobots_open_data.overture_maps_foundation.buildings_building buildings ON ST_CONTAINS(buildings.geometry, places.geometry)
> WHERE
>   exists(places.sources, s -> s.update_time >= '2023-07-24' AND s.update_time < '2023-07-25')
> GROUP BY 1
> ORDER BY 3 DESC
> LIMIT 100
> """
> sedona.sql(create_table_sql)
> ```

## Accessing Historical Overture Maps Foundation data snapshots

The Overture Maps Foundation regularly releases updated datasets.
To ensure data consistency for your analysis and applications, Wherobots maintains historical snapshots of Overture Maps data.

By default, when you query an Overture Data table without specifying a version, you will always access the **latest stable release** of the data.

You can, however, query specific [historical snapshots](#querying-a-specific-data-snapshot) of Overture Maps data using the `VERSION AS OF` clause in
your SQL queries. This allows you to reproduce results or analyze changes over time.

### Maintained Overture Maps Foundation versions

We maintain all non-alpha and non-beta versions of Overture Maps Foundation datasets. New stable versions are released regularly.

Query the `.refs` column to get the most [up-to-date list of available versions](#discovering-available-versions) for a specific table.

### Discovering available versions

To view all available named tags (versions) for an Overture Maps table, query its `.refs` column.

The following query lists all available version tags and their metadata for the `places_place` table:

> [tab] SQL
>
> ```sql theme={"system"}
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place.refs
> WHERE
>   type = 'TAG'
> ORDER BY
>   name
> ```

> [tab] Python
>
> ```python theme={"system"}
> available_versions_sql = """
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place.refs
> WHERE
>   type = 'TAG'
> ORDER BY
>   name
> """
> sedona.sql(available_versions_sql).show()
> ```

### Querying a specific data snapshot

Overture's data release tags are in the following format: `YYYY-MM-DD.X`

* `YYYY`: Publication Year of the dataset.
* `MM`: Publication Month of the dataset.
* `DD`: Publication Date of the dataset.
* `X`: Dataset patch number.

Replace `YYYY-MM-DD.X` with the specific version tag you wish to query.

To access a particular version of an Overture Maps table, use `VERSION AS OF`:

> [tab] SQL
>
> ```sql theme={"system"}
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place
>   VERSION AS OF 'YYYY-MM-DD.X'
> ```

> [tab] Python
>
> ```python theme={"system"}
> versioned_sql = """
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place
>   VERSION AS OF 'YYYY-MM-DD.X'
> """
> sedona.sql(versioned_sql).show()
> ```

#### Historical snapshot example

For a list of Overture Maps releases and their version numbers, see the [Overture Maps Release Calendar](https://docs.overturemaps.org/release-calendar/).

For example, to access the `places_place` table as it was on May 21, 2025:

> [tab] SQL
>
> ```sql theme={"system"}
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place
> VERSION AS OF '2025-05-21.0'
> ```

> [tab] Python
>
> ```python theme={"system"}
> historical_sql = """
> SELECT
>   *
> FROM
>   wherobots_open_data.overture_maps_foundation.places_place
> VERSION AS OF '2025-05-21.0'
> """
> sedona.sql(historical_sql).show()
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.