Use the Peliqan SQL query editor to write SELECT queries on any data source, including JOIN queries that join data from different sources, UNION etc.
On save, the SQL query will automatically be beautified. The query will be executed two times, the first time with a “LIMIT 1” added to discover the schema (columns) of the result, the second time to fetch a page of data (default 3000 rows). The Grid view in Peliqan will automatically apply paging when you scroll.
You can insert table names from the right pane. You can hover over a table in the SQL editor to see the structure (columns, example value etc.) of the referenced table.
Examples:
SELECT * FROM databasename.schema.tablename;
SELECT * FROM schema.tablename;
SELECT * FROM tablename;
When you write a SELECT query and save it, it becomes a “table” in Peliqan. The query is ephemeral, which means it will be executed each time the table is opened. You can reference another SQL query inside a new SQL query.
Example where an SQL query references another SQL query with name my_query_name:
SELECT * FROM my_query_name WHERE id>10;
Peliqan will convert this into a CTE (common table expression). For example let’s say that the SQL query with name my_query_name was SELECT id, LOWER(name) FROM my_table
. The above final query that will be executed will be:
WITH my_query_name AS (
SELECT id, LOWER(name) FROM my_table
)
SELECT * FROM my_query_name WHERE id>10;