Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes, reviews, and migrates Supabase logs queries against the ClickHouse logs table, including BigQuery unnest conversion.
41% 100%+59 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 9 of 22 without it.
Translate this legacy BigQuery query to Supabase Logs Explorer ClickHouse SQL: SELECT timestamp, m.request.method FROM `project.supabase_logs.edge_logs` CROSS JOIN UNNEST(metadata) AS m WHERE m.request.method = 'POST' LIMIT 50
Replaces UNNEST with direct bracket lookup log_attributes['request.method']
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
The old logs engine gave each service its own table and exposed structured fields
through repeated cross join unnest(...) over a nested metadata column. The
ClickHouse engine has one logs table and a flat log_attributes map. Conversion
is mechanical once you internalize the mapping.
Replace the table with logs plus a source filter. The old table name is
the source value: from postgres_logs as t becomes
from logs where source = 'postgres_logs'. Never select from a per-service
table name (postgres_logs, edge_logs, ...) on the ClickHouse engine.
source = 'postgres_logs'.Remove every unnest join. Delete cross join unnest(metadata) as m,
cross join unnest(m.parsed) as p, left join unnest(...) on true, and so on.
They have no equivalent — the data is already flat in the map.
Rewrite every unnest-alias column as a map lookup. A field taken off
unnest(metadata) becomes log_attributes['field']. A field off a nested
struct like unnest(m.parsed) becomes log_attributes['parsed.field']: keep
the struct name as a dotted prefix, drop the metadata root and every alias.
Wrap numeric fields in toInt32OrZero(...) before comparing or aggregating
them — map values are strings.
Swap BigQuery functions for ClickHouse ones (see the table below).
Preserve the original select list, filters, group by, order by, and limit intent throughout.
| Need | BigQuery | ClickHouse |
|---|---|---|
| Count rows | count(*) | count() |
| Regex match | regexp_contains(x, 'p') | match(x, 'p') |
| Substring match | x like '%p%' | x ilike '%p%' or like |
| Numeric coercion | cast(x as int64) | toInt32OrZero(x) |
Next to this one in the catalogue, plus more from the same author.