Skip to main content

Overview

A Datagraph Entity is a named SQL query over the Datagraph model, with declared parameters and inferred output columns. Open DataHub → Datagraph → EntitiesManage datagraph entities for your account. The listing shows each Entity with its Name, Status (Draft or Live), and Last update, plus two actions: Edit and Query. Create entity opens the editor on a new Draft.

Before You Begin

  • The Datagraph Schema must be published, because output columns are inferred against the Live model. See Datagraph Schema.
  • Every Datasource referenced by the SQL needs a Live version.
  • Datasources protected by row-level filters cannot be queried from an Entity.

Editor Layout

Both side panels can be collapsed, and the toolbar shows the keyboard shortcut for saving, formatting, and toggling each panel.

Writing the SQL

Datasource tables are referenced by their Datasource identifier, quoted:
The statement must reference at least one Datasource table, otherwise the query is rejected.

Worked Examples

The patterns below come from a property listings model built on five Datasources: users, listings, price-per-square-metre by area, pre-computed recommendations, and editorial content. The same patterns transfer to other models: last items purchased by a customer, remaining stock in a preferred store, best sellers of a category, or complementary products of an order.
Filters that combine several user preferences — budget range plus minimum number of rooms, for example — can legitimately return zero rows. Preview each Entity with a real identifier before publishing, and relax the least critical condition when the result set is empty.

Parameters

Parameters are declared in the Input panel and bound to SQL placeholders. Click Add to create one. Accepted parameter types:
A NULL parameter compared with = or <> never matches. The editor flags it and asks you to use IS NULL or IS NOT NULL in the SQL query instead.

Output Columns

The Output panel lists the Column and Type of every value the Entity returns, under Return types. The list is computed from the SQL against the Live Datagraph model and recalculated on every save — it cannot be edited by hand. An empty list means the SQL has not been resolved yet, or that it references an unknown column.

Previewing Results

  1. Save the Entity — a preview cannot run on unsaved changes only. The editor shows Save the entity before running a preview.
  2. Click Run query.
  3. In the Query parameters dialog, fill each parameter. Fill sample values looks up realistic values in the data for you.
  4. Confirm with Run query.
The Preview panel returns up to 10 rows with the row count and a Trace ID for support requests. The Entity queries page — reachable with the Query action or Open query page — runs a saved Entity on its own, outside the editor. Results are paginated at 10 rows per page.

Publishing

Click Publish to promote the Draft to Live. The previous Live version becomes Inactive, and a new Draft copy is created so editing can continue. Only Live Entities are selectable in Workflows.

Using an Entity in a Workflow

Add the Query an entity Data Node — Run a datagraph entity query and expose its results to the workflow. Open entity in Datahub jumps from the Node to the Entity editor. Only tech admins can configure the Node. The Node itself is documented in Query an Entity.
Parameter values coming from Workflow variables are converted to the declared parameter type. A variable that cannot be converted — free text into a number parameter, for example — makes the Node fail at execution time rather than at configuration time.

What’s Next?

Schema

Add the columns and relations your SQL needs.

Explorer

Check that a join actually overlaps before you rely on it.

Datasource Data Node

Compare with querying a single Datasource in a Workflow.

Datagraph Schema API

Manage the model programmatically.