Skip to main content

Query your own site's data

Write a query against the data your app already stores, with no connection secret to configure. This is the internal connection mode.

Prerequisites​

  • An app with at least one materialized data table.
  • A TaruviBase Console account. Any signed-in Console user can create, edit, or delete saved queries; see who can manage queries.

Procedure​

1. Confirm the table is visible​

Open Datatables in the app and note the logical name of the table you want to query — the name shown in the table list, not the underlying physical table name. Only a table that has finished provisioning can be queried.

2. Start a query in internal mode​

Select Analytics, then Create Query. In Create New Query, enter a Query Name and turn Internal Query on. Internal mode reads your site's own data, so there is no Database Connection to select.

3. Write the query using logical names​

Reference the table by its logical name:

SELECT status, count(*) AS orders FROM orders GROUP BY status

Analytics resolves the logical name to the underlying physical table when the query runs. If the physical name is already familiar to you, it works too — both forms are accepted.

Enter the statement under Query Text *, then select Create Query. If a table name is not recognized, the save is refused with the unrecognized names listed; see Troubleshoot Analytics if this happens for a table you believe exists.

The save is also refused if the statement is anything but one read, if it contains a write anywhere inside it, or if it names another schema. A name defined by the query's own WITH clause is not treated as a table.

4. Join across tables in the same app​

An internal query can join any tables that belong to the same app:

SELECT o.id, o.total, c.name
FROM orders o
JOIN customers c ON o.customer_id = c.id

A table belonging to a different app is reported as an unknown table when you try to reference it, not as a permission error.

Verify​

The query is working when it saves without a validation error and a run returns rows that match what you expect from the table's current data. See Run a query and read the results to run it with parameter values.

Troubleshoot​

If a table name is refused or a query fails against a table you know exists, see Troubleshoot Analytics.