Use the BigQuery Graph visual modeler
To request support or provide feedback for this feature, send an email to bq-graph-preview-support@google.com.
This document describes how to use the visual graph modeler in
BigQuery Studio to define nodes and edges from your
BigQuery tables, and how to edit and query graph data. You can also
create a graph by using the
CREATE PROPERTY GRAPH statement.
Required roles
To get the permissions that
you need to create and query graphs,
ask your administrator to grant you the
BigQuery Data Editor (roles/bigquery.dataEditor)
IAM role on the dataset in which you create the node tables, edge tables, and graph.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Create a graph
To create a graph using the visual modeler, follow these steps:
In the Google Cloud console, go to the BigQuery page.
To open the gallery, in the editor tab bar, click the arrow next to SQL query, and then click Graph.
In the Graph name field, enter a name for the graph.
In the Graph destination in dataset field, do one of the following:
- Click Create new dataset to create a new dataset.
- Select an existing dataset.
Select the tables that you want to use as your data sources.
Click Create. BigQuery creates the graph resource and navigates you to the visual modeler.
View a graph
To view an existing graph, follow these steps:
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to view.
Edit a graph
After you create a graph, you can use the visual modeler to add, edit, or remove nodes and edges. The following sections describe how to edit an existing graph.
Manage nodes
This section describes how to manage graph nodes.
Add a node
To add a node, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph action bar, click New node.
In the Add node panel, click Add table.
In the Select table pane, select the dataset table that you want to add, and then click Add.
Click Edit primary key.
Select the fields that you want to use as the primary keys, and then click Add.
Optional: Click Add label.
- In the Name field, enter a name for your label.
- In the Description field, enter a description of your label.
- In the Synonyms field, enter up to eight synonyms.
- Click Add property.
In the Select fields pane, select all the properties that you want to add to the label.
Optional: You can add a custom field with a measure. For more information, see Graph measures.
Click Add.
Click Done.
Click Done.
Edit a node
To edit a node, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph, select the node that you want to edit.
In the Node window, click Edit.
In the Edit node panel, click Edit primary key.
Select the fields that you want to use as the primary keys, and then click Add.
Optional: Click Add label.
- In the Name field, enter a name for your label.
- In the Description field, enter a description of your label.
- In the Synonyms field, enter up to eight synonyms.
- Click Add property.
- In the Select fields pane, select all the properties that you want to add to the label.
- Click Add.
- Optional: Click Add measure to add a custom field with a measure, as described in Graph measures.
- Click Done.
Click Done.
Remove a node
To remove a node, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph, select the node to remove.
In the Node window, click Remove.
Click Delete.
Manage edges
This section describes how to manage graph edges.
Add an edge
To add an edge, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph action bar, click New edge.
In the Add edge panel, click Add table.
In the Select table pane, select the table that you want to use as a data source, and then click Add.
In the Source node list, select the node that you want to use as the source.
Click Add referenced columns in the node.
- Select the fields that you want to reference.
- Click Add.
In the Target node list, select the node that you want to use as the target.
Click Add referenced columns in the node.
- Select the fields that you want to reference.
- Click Add.
Click Add referenced columns in the edge.
- Select the fields that you want to reference. The number of columns and data types of these edge columns must match the referenced columns selected for the source and target nodes.
- Click Add.
Optional: Click Add label.
- In the Name field, enter a name for your label.
- In the Description field, enter a description of your label.
- In the Synonyms field, enter up to eight synonyms.
- Click Add property.
- In the Select fields pane, select all the properties that you want to add to the label.
- Click Add.
- Optional: Click Add measure to add a custom field with a measure, as described in Graph measures.
- Click Done.
Click Done.
Edit an edge
To edit an edge, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph, select the edge that you want to edit.
In the Node window, click Edit.
In the Edit edge panel, in the Source node list, select the node that you want to use as the source.
Click Add referenced columns in the node.
- Select the fields that you want to reference.
- Click Add.
In the Target node list, select the node that you want to use as the target.
Click Add referenced columns in the node.
- Select the fields that you want to reference.
- Click Add.
Click Add referenced columns in the edge.
- Select the fields that you want to reference. The number of columns and data types of these edge columns must match the referenced columns selected for the source and target nodes.
- Click Add.
Optional: Click Add label.
- In the Name field, enter a name for your label.
- In the Description field, enter a description of your label.
- In the Synonyms field, enter up to eight synonyms.
- Click Add property.
- In the Select fields pane, select all the properties that you want to add to the label.
- Click Add.
- Optional: Click Add measure to add a custom field with a measure, as described in Graph measures.
- Click Done.
Click Done.
Remove an edge
To remove an edge, follow these steps. Changes that you make aren't applied until you publish your changes.
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
In the graph, select the edge to remove.
In the Node window, click Remove.
Confirm the deletion.
Publish graph changes
To save your modifications, publish them to the graph resource. Follow these steps:
In the Google Cloud console, go to the BigQuery page.
In the navigation pane, click Explorer:
In the Explorer pane, expand your project and click Datasets.
Click the dataset that contains your graph.
Click the Graphs tab.
Select the graph that you want to edit.
After you finish editing, click Publish.
Review the
CREATE PROPERTY GRAPHstatement in the Publish graph pane, and then click Publish.
What's next
- Learn more about BigQuery Graph.
- Learn how to create and query a graph.
- Learn how to visualize graphs.