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:

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. To open the gallery, in the editor tab bar, click the arrownext to SQL query, and then click Graph.

  3. In the Graph namefield, enter a name for the graph.

  4. In the Graph destination in datasetfield, do one of the following:

  5. Select the tables that you want to use as your data sources.

  6. 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:

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. 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 .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph action bar, click New node.

  8. In the Add nodepanel, click Add table.

  9. In the Select tablepane, select the dataset table that you want to add, and then click Add.

  10. Click Edit primary key.

  11. Select the fields that you want to use as the primary keys, and then click Add.

  12. Optional: Click Add label.

    1. In the Namefield, enter a name for your label.
    2. In the Descriptionfield, enter a description of your label.
    3. In the Synonymsfield, enter up to eight synonyms.
    4. Click Add property.
    5. In the Select fieldspane, 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 .

    6. Click Add.

    7. Click Done.

  13. Click Done.

Edit a node

To edit a node, follow these steps. Changes that you make aren't applied until you publish your changes .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph, select the node that you want to edit.

  8. In the Node window, click Edit.

  9. In the Edit nodepanel, click Edit primary key.

  10. Select the fields that you want to use as the primary keys, and then click Add.

  11. Optional: Click Add label.

    1. In the Namefield, enter a name for your label.
    2. In the Descriptionfield, enter a description of your label.
    3. In the Synonymsfield, enter up to eight synonyms.
    4. Click Add property.
    5. In the Select fieldspane, select all the properties that you want to add to the label.
    6. Click Add.
    7. Optional: Click Add measureto add a custom field with a measure, as described in Graph measures .
    8. Click Done.
  12. Click Done.

Remove a node

To remove a node, follow these steps. Changes that you make aren't applied until you publish your changes .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph, select the node to remove.

  8. In the Node window, click Remove.

  9. 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 .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph action bar, click New edge.

  8. In the Add edgepanel, click Add table.

  9. In the Select tablepane, select the table that you want to use as a data source, and then click Add.

  10. In the Source nodelist, select the node that you want to use as the source.

  11. Click Add referenced columns in the node.

    1. Select the fields that you want to reference.
    2. Click Add.
  12. In the Target nodelist, select the node that you want to use as the target.

  13. Click Add referenced columns in the node.

    1. Select the fields that you want to reference.
    2. Click Add.
  14. Click Add referenced columns in the edge.

    1. 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.
    2. Click Add.
  15. Optional: Click Add label.

    1. In the Namefield, enter a name for your label.
    2. In the Descriptionfield, enter a description of your label.
    3. In the Synonymsfield, enter up to eight synonyms.
    4. Click Add property.
    5. In the Select fieldspane, select all the properties that you want to add to the label.
    6. Click Add.
    7. Optional: Click Add measureto add a custom field with a measure, as described in Graph measures .
    8. Click Done.
  16. Click Done.

Edit an edge

To edit an edge, follow these steps. Changes that you make aren't applied until you publish your changes .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph, select the edge that you want to edit.

  8. In the Node window, click Edit.

  9. In the Edit edgepanel, in the Source nodelist, select the node that you want to use as the source.

  10. Click Add referenced columns in the node.

    1. Select the fields that you want to reference.
    2. Click Add.
  11. In the Target nodelist, select the node that you want to use as the target.

  12. Click Add referenced columns in the node.

    1. Select the fields that you want to reference.
    2. Click Add.
  13. Click Add referenced columns in the edge.

    1. 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.
    2. Click Add.
  14. Optional: Click Add label.

    1. In the Namefield, enter a name for your label.
    2. In the Descriptionfield, enter a description of your label.
    3. In the Synonymsfield, enter up to eight synonyms.
    4. Click Add property.
    5. In the Select fieldspane, select all the properties that you want to add to the label.
    6. Click Add.
    7. Optional: Click Add measureto add a custom field with a measure, as described in Graph measures .
    8. Click Done.
  15. Click Done.

Remove an edge

To remove an edge, follow these steps. Changes that you make aren't applied until you publish your changes .

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. In the graph, select the edge to remove.

  8. In the Node window, click Remove.

  9. Confirm the deletion.

Publish graph changes

To save your modifications, publish them to the graph resource. Follow these steps:

  1. In the Google Cloud console, go to the BigQuerypage.

    Go to BigQuery

  2. In the navigation pane, click Explorer:

  3. In the Explorerpane, expand your project and click Datasets.

  4. Click the dataset that contains your graph.

  5. Click the Graphstab.

  6. Select the graph that you want to edit.

  7. After you finish editing, click Publish.

  8. Review the CREATE PROPERTY GRAPH statement in the Publish graphpane, and then click Publish.

What's next

Design a Mobile Site
View Site in Mobile | Classic
Share by: