SELECT against site-scoped analytics, bot, or Stripe revenue tables, or describe the result you want and let Ask AI generate a query for you.
Can I generate SQL from a question?
Yes. Above the editor, the Ask AI box turns a plain-English question into a query. Type what you want — for example, “top 10 pages by pageviews last week” — and click Generate. tinyanalytics writes the SQL into the editor for you to review, run, or edit before running. Generated SQL is validated by the same read-only guard as hand-written SQL before it runs — the AI can’t widen your scope, reach another site’s data, or write anything. It’s a faster way to reach the same guarded query, not a way around the rules. AI generation is metered per calendar month by plan:
Running the SQL the AI produces — or any SQL you write yourself — is never metered. Only the generation step counts against the limit.
How do I write a query?
Your data lives in three virtual tables you query by name:
All three are automatically filtered to the site you’re viewing — you never write a
site_id filter, and a query cannot reach another site’s data. scoped_stripe_revenue is available even when Stripe is not connected; it simply returns no rows.
How do I query Stripe revenue?
scoped_stripe_revenue contains these columns:
The table is append-only, so a webhook replay can produce more than one raw row for the same
stripe_event_id. Deduplicate each event with argMax before aggregating:
What can I run, and what’s blocked?
The query builder is read-only by design, so exploring your data can never change or damage it:- Allowed — a single
SELECT(orWITH … SELECT) reading the three scoped tables and your own CTEs. - Blocked — writes, schema changes, multiple statements, and any attempt to read outside your scoped tables.
- Capped — a query runs for at most 10 seconds and returns at most 1,000 rows, so a heavy query is trimmed rather than left to run away.
How do I turn a query into a dashboard card?
Save the query as a card and pick a visualization. Any query you’ve written is the same SQL a custom dashboard card runs, so once a query gives you what you want, it becomes a live chart that follows your dashboard’s date range.Frequently asked questions
Do I need to filter by site ID in my query?
Do I need to filter by site ID in my query?
No.
scoped_events, scoped_events_bot, and scoped_stripe_revenue are automatically filtered to the site you’re viewing, so you never write a site_id filter. A query also cannot reach another site’s data.Why did my query only return 1,000 rows?
Why did my query only return 1,000 rows?
That’s the cap. A query in the tinyanalytics SQL query builder returns at most 1,000 rows and runs for at most 10 seconds, so a heavy query is trimmed rather than left to run away. Aggregate in SQL — with
GROUP BY and a tighter WHERE — to fit the result inside the cap.Can I run INSERT, UPDATE, or DELETE in the SQL query builder?
Can I run INSERT, UPDATE, or DELETE in the SQL query builder?
No. The query builder is read-only by design. Writes, schema changes, multiple statements, and any attempt to read outside your scoped tables are all blocked, so exploring your data can never change or damage it.
How many AI queries can I generate?
How many AI queries can I generate?
AI generation is metered per calendar month by plan: 20 on Free, 500 on Growth, and unlimited on Business. Only the generation step counts — running the resulting SQL, or any SQL you write yourself, is never metered. Add your own Anthropic API key in Settings → Account to bypass the limit entirely.
Is AI-generated SQL still read-only and scoped to my site?
Is AI-generated SQL still read-only and scoped to my site?
Yes. Anything the AI produces runs through the same guard as hand-written SQL before it executes: a single
SELECT reading only the scoped tables, capped at 1,000 rows and 10 seconds. The AI cannot widen your scope, reach another site’s data, or write anything.Why does my Stripe SQL total look too high?
Why does my Stripe SQL total look too high?
scoped_stripe_revenue is a raw, append-only table, so a Stripe webhook replay can create several rows with the same stripe_event_id. Group by that ID and use argMax(amount, timestamp) before summing. Also keep currencies separate unless you convert them.Related
Custom dashboards
Turn a query into a saved, shareable chart.
Metric definitions
The events and properties available to query.
Export data
Take a report out as CSV or PDF.
Events explorer
Browse events without writing SQL.