Modelling Multiple SQL Queries

A common use case involves modelling multiple tables from a database. This can be achieved in Graph.Build Studio by either creating multiple models (model files) or by building a single model containing multiple queries. By default, the modelling page starts with one query, “QueryName 1”, which appears at the top centre of the modelling screen.

Clicking the accordion button reveals a menu that displays all the queries currently used in the model or diagram.

Pressing the + New Query button creates a new query with a default name, which can be renamed as needed. Clicking the tick icon confirms the creation of the new query, and the radio button can then be used to switch between queries.

Switching to a new query updates the input tab, linking it to the new query. This section of the input tab can then be used to return new data for modelling. Only the input tab changes when a new query is selected; the modelling area remains the same, allowing models for different queries to be built next to each other in the same space.

NB: Data from different queries can be connected but we would recommend avoiding it if possible as it negatively affects performance. Nodes from different queries can be connected but a join condition must be used (a field that matches between both queries) . If a join condition is not used when linking nodes from different queries then every node from query A will be linked to query B forming a cartesian product. If linking data from different tables is necessary, a join SQL query is the preferred way to return the data within the same query.

Last updated