SQL

SQL Editor

Query and change lakehouse tables with SQL from the portal.

The SQL Editor runs SQL against the lakehouse from your browser. Use it to explore tables, check a pipeline’s output, or create and fill a table, all with your own data grants.

Prerequisite

The Use SQL editor app permission (can_use_sql_editor). Without it, the page shows Not authorized. See the permissions reference.

Open the editor

In the portal sidebar, open Business Intelligence ▸ SQL Editor. It lives in the portal at https://<your-databaas-domain>/sql, so there is no second sign-in.

Run a query

Name tables in full, as iceberg.<namespace>.<table>. Namespaces are schemas in SQL, and iceberg is the catalog:

First rows of a table
SELECT *
FROM iceberg.<namespace>.<table>
LIMIT 10

Press Run, or ⌘+Enter (Ctrl+Enter on Windows and Linux). Each run sends one statement:

  • With text selected, the button reads Run selection and runs only the selection.
  • Otherwise it runs the statement at the cursor, so one tab can hold several statements separated by ;.

While a query runs, Stop cancels it.

To get a table name without typing it, open the data catalog rail (⌘E / Ctrl+E), right-click a table or view and choose Insert into SQL editor. As you type, the editor also suggests namespaces, tables and columns you can see.

Read the results

The results pane shows the row count, how long the query took, and the column types under each column name. Long results are split into pages with Prev and Next. A statement that returns nothing shows Statement executed.

Row limit

The Limit menu caps how many rows come back: 10, 100 or 1,000 (the default). When more rows match, the results show Limited to the first … rows and the rest are not read.

What you can do with your grants

Every statement runs on Trino as you, with the same data grants as the Data Catalog and notebooks. The editor runs any statement your grants allow, not only SELECT:

  • Select on a table lets you query it.
  • Modify on a table lets you write to it, for example with INSERT.
  • Create on a namespace lets you create tables in it.

A statement you have no grant for fails with a permission error. See data permissions and how access works.

Create a table from a query
CREATE TABLE iceberg.<namespace>.<new_table> AS
SELECT *
FROM iceberg.<namespace>.<table>
WHERE <condition>

Tables you create are not yours

A table created through the SQL Editor is owned by the platform’s query service, not by you. You get no grant on it, so you can’t query or drop it afterwards until someone grants you access. See limits.

Tabs and saved queries

  • New query tab (the + button) opens another tab. Double-click a tab, or press F2, to rename it.
  • Save keeps the current tab’s query. Saved lists your saved queries; pick one to open it in a tab, or use the delete icon next to it to remove it.

Open tabs and saved queries are kept only in this browser. They are not stored in Databaas, so another browser or device doesn’t see them, and clearing your browser’s site data removes them. Copy a query you need to share or keep somewhere else, such as a notebook or your Git repository.

If a query fails or stops

  • Queries stop after 60 seconds. A longer statement fails with “Query did not finish within 60s and was cancelled”. Narrow it with a WHERE clause, or move heavy work into a pipeline.
  • Your session has expired. Reload the page to sign in again, then rerun the query.
  • Query failed shows the error Trino returned, such as a syntax error, an unknown table or a missing grant.

Where to go next