Get top N rows by column value
Table-in, table-out — composes downstream of SELECTs.
THEN TOP {{ column }}THEN TOP({{ column }})THEN TOP({{ column }}, {{ n }})THEN TOP({{ column }}, {{ n }}, {{ order }})| name | type | description |
|---|---|---|
| column | VARCHAR | — |
| n(optional) | VARCHAR | — |
| order(optional) | VARCHAR | — |
| _table | TABLE | — |
Returns the highest-valued rows first by default
SELECT
*
FROM
(
VALUES
('A', 10),
('B', 25),
('C', 7)
) AS t (name, amount) THEN TOP ('amount', 2) THEN PYTHON (
'result = pd.DataFrame({"top_amount":[int(df.iloc[0]["amount"])]})'
)Apply theme styling to a chart specification
Analyze query results with LLM based on a prompt
Remove duplicate rows
Add LLM-computed columns to query results
Filter query results using LLM-based semantic matching
Group by column and aggregate another
Get top N rows by column value
Table-in, table-out — composes downstream of SELECTs.
THEN TOP {{ column }}THEN TOP({{ column }})THEN TOP({{ column }}, {{ n }})THEN TOP({{ column }}, {{ n }}, {{ order }})| name | type | description |
|---|---|---|
| column | VARCHAR | — |
| n(optional) | VARCHAR | — |
| order(optional) | VARCHAR | — |
| _table | TABLE | — |
Returns the highest-valued rows first by default
SELECT
*
FROM
(
VALUES
('A', 10),
('B', 25),
('C', 7)
) AS t (name, amount) THEN TOP ('amount', 2) THEN PYTHON (
'result = pd.DataFrame({"top_amount":[int(df.iloc[0]["amount"])]})'
)Apply theme styling to a chart specification
Analyze query results with LLM based on a prompt
Remove duplicate rows
Add LLM-computed columns to query results
Filter query results using LLM-based semantic matching
Group by column and aggregate another