Manage data exchanges

As an Analytics Hub administrator, you can perform the following tasks:

  • Create, update, view, share, and delete data exchanges.
  • Create, update, delete, and share listings.
  • Manage Analytics Hub administrators, listing administrators, publishers, subscribers, and viewers.

By default, a data exchange is private and only users or groups that have access to that exchange can view or subscribe to the data. However, if you want the listings to be discovered and subscribed to by Google Cloud users (allAuthenticatedUsers), then you can request to make your data exchange public.

Before you begin

To get started with Analytics Hub, you need to enable the Analytics Hub API inside your Google Cloud project.

Required permissions

To enable the Analytics Hub API, you need the following Identity and Access Management (IAM) permissions:

  • serviceUsage.services.get
  • serviceUsage.services.list
  • serviceUsage.services.enable

The following predefined IAM role includes the permissions that you need to enable the Analytics Hub API:

  • roles/serviceusage.serviceUsageAdmin

For more information about IAM roles in BigQuery, see Predefined roles and permissions.

Enable the Analytics Hub API

To enable the Analytics Hub API, do the following:

Console

Go to the Analytics Hub API for your Google Cloud project and enable it.

Enable the Analytics Hub API

gcloud

Run the gcloud services enable command:

gcloud services enable analyticshub.googleapis.com

Required permissions

To manage data exchanges, you must have the Analytics Hub Admin role (roles/analyticshub.admin). For more information, see Analytics Hub Admin role. To learn how to grant this role to other users, see Create Analytics Hub administrators.

Create a data exchange

To create a data exchange, follow these steps:

Console

  1. Go to the Analytics Hub page.

    Go to Analytics Hub

  2. Click Create exchange.

  3. In the Create exchange dialog, select a Project and a Region for your data exchange. You cannot update the project and region after you create the data exchange.

  4. For Display name, enter a name for your data exchange.

  5. Optional: Enter values in the following fields:

    • Primary contact: enter the URL or the email address of the primary contact for the data exchange.
    • Description: enter a description for the data exchange.
  6. To turn on public discoverability, click the Public discoverability toggle. Once an exchange is publicly discoverable, all listings in the exchange are displayed and searchable in the catalog. If you enable public discoverability, you must configure the exchange permissions. Due to permission inheritance, all listings by default will be set with the same public discoverability type of the exchange. Therefore, public exchanges cannot have private listings, but private exchanges can have public listings (for example, you can set the public discoverability type at the individual listing level). The project that you are creating the data exchange in must have an associated organization and billing account.

  7. Click Create Exchange.

  8. Optional: In the Exchange permissions section, do the following steps:

    1. Enter email addresses in the following fields to grant the Analytics Hub user roles:

    2. To save permissions, click Set permissions.

  9. If you didn't set permissions for your data exchange, click Skip.

API

Use the projects.locations.dataExchanges.create method.

POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/location/LOCATION/dataExchanges?dataExchangeId=DATAEXCHANGE_ID

Replace the following:

  • PROJECT_ID: the ID of the project in which you want to create the data exchange.
  • LOCATION: the location for your data exchange. For more information about locations that support Analytics Hub, see Supported regions.
  • DATAEXCHANGE_ID: the ID for your data exchange.

In the body of the request, provide the data exchange details. If the request is successful, then the response body contains details of the data exchange.

For more information about the tasks that you can perform on data exchanges using APIs, see projects.locations.dataExchanges methods.

Update a data exchange

To update a data exchange, follow these steps:

Console

  1. Go to the Analytics Hub page.

    Go to Analytics Hub

  2. From the list of data exchanges, click a data exchange that you want to update.

  3. Click Edit exchange.

  4. In the Edit exchange dialog, update the following fields:

    • Display name
    • Primary contact
    • Description
    • Public discoverability
      • If you enable public discoverability, grant the Analytics Hub Viewer role (roles/analyticshub.viewer) to allUsers or allAuthenticatedUsers.
      • If you disable public discoverability, remove the Analytics Hub Viewer role (roles/analyticshub.viewer) from allUsers or allAuthenticatedUsers. Public exchanges can't have private listings, but private exchanges can have public listings.
  5. Click Save.

API

Use the projects.locations.dataExchanges.patch method.

PATCH https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/location/LOCATION/dataExchanges/DATAEXCHANGE_ID?updateMask=UPDATEMASK

Replace UPDATEMASK with the list of fields that you want to update. For updating multiple values, use a comma-separated list—for example, to update the display name and primary contact for a data exchange, enter displayName,primaryContact.

In the body of the request, specify the updated values for the following fields:

  • Display name
  • Description
  • Documentation
  • Icon
  • Primary contact
  • Public discoverability

For more information about the tasks that you can perform on data exchanges using APIs, see projects.locations.dataExchanges methods.

View data exchanges

To view all data exchanges in your organization you have access to, follow these steps:

Console

  1. Go to the Analytics Hub page.

    Go to Analytics Hub

  2. View the list of data exchanges within your Google Cloud organization.

API

Use the organizations.locations.dataExchanges.list method.

GET https://analyticshub.googleapis.com/v1/organizations/ORGANIZATION_ID/location/LOCATION/dataExchanges

Replace the following:

  • ORGANIZATION_ID: the organization ID. For more information, see Getting your organization ID.
  • LOCATION: the location for which you want to list the existing data exchanges.

Share a data exchange

If the Analytics Hub publisher belongs to a different organization than the organization that contains the data exchange, the publisher cannot view your data exchange in Analytics Hub. You must share a link to the data exchange with the publisher.

  1. Go to the Analytics Hub page.

    Go to Analytics Hub

  2. From the list of data exchanges, click More options.

  3. Click Copy share link.

Give users access to a data exchange

To give users access to a data exchange, you must set the IAM policy for that data exchange. For information about predefined IAM user roles, see Analytics Hub user roles. To do so, follow these steps:

Console

  1. In the Google Cloud console, go to the Analytics Hub page.

    Go to Analytics Hub

  2. Click the data exchange name for which you want to set permissions.

  3. Click Set permissions.

  4. To add principals, click Add principal.

  5. In the New principals field, add the emails to which you want to grant access.

  6. For Select a role, hold the pointer over Analytics Hub, and then select one of the following Identity and Access Management (IAM) roles:

    • Analytics Hub Admin
    • Analytics Hub Publisher
    • Analytics Hub Listing Admin
    • Analytics Hub Subscriber
    • Analytics Hub Viewer
  7. Click Save.

API

  1. Read the existing policy with the listing getIamPolicy method by using the projects.locations.dataExchanges.getIamPolicy method:

    POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID:getIamPolicy
    

    Replace the following:

    • PROJECT_ID: the project ID—for example, my-project-1.
    • LOCATION: the location for your data exchange.
    • DATAEXCHANGE_ID: the data exchange ID.

    Analytics Hub returns the current policy.

  2. To add or remove members and their associated Identity and Access Management (IAM) roles, edit the policy with a text editor. Use the following format to add members:

    • user:test-user@gmail.com
    • group:admins@example.com
    • serviceAccount:test123@example.domain.com
    • domain:example.domain.com

    For example, to grant the roles/analyticshub.subscriber role to group:subscribers@example.com, add the following binding to the policy:

    {
     "members": [
       "group:subscribers@example.com"
     ],
     "role":"roles/analyticshub.subscriber"
    }
    
  3. Write the updated policy by using the projects.locations.dataExchanges.setIamPolicy method. In the body of the request, provide the updated IAM policy from the previous step.

    POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID:setIamPolicy
    

    In the body of the request, provide the listing details. If the request is successful, then the response body contains details of the listing.

Create Analytics Hub administrators

To manage data exchanges, you must create Analytics Hub administrators. To create exchange administrators, you need to grant users the Analytics Hub Admin role (roles/analyticshub.admin) at the project or the data exchange level.

If you want administrators to manage all data exchanges in a project, then grant the Analytics Hub Admin role for that project. If you want administrators to manage a specific data exchange, then grant the Analytics Hub Admin role for that data exchange.

Make a data exchange public

By default, a data exchange is private and only users or groups that have access to that exchange can view or subscribe to its listings. However, you can choose to make a data exchange public. Listings in public data exchanges can be discovered and subscribed to by Google Cloud users (allAuthenticatedUsers).

To make a data exchange public, follow these steps:

  1. To let allAuthenticatedUsers view listings, you must grant them the Analytics Hub Viewer role at the data exchange level.

  2. To let allAuthenticatedUsers subscribe to listings, you must grant them the Analytics Hub Subscriber role at the data exchange level.

  3. Turn public discoverability on when you create or update a data exchange. Specify the appropriate permissions when you make a data exchange public.

Delete a data exchange

When a data exchange is deleted, all the listings within it are also deleted. However, the shared datasets and linked datasets are not deleted. Also, when a project is deleted, the data exchanges within it are not deleted. You need to delete these data exchanges before deleting the project. If you delete a data exchange, you cannot undo it.

To delete a data exchange, follow these steps:

Console

  1. Go to the Analytics Hub page.

    Go to Analytics Hub

  2. From the list of data exchanges, click the data exchange that you want to delete.

  3. Click Delete exchange.

  4. In the Delete exchange? dialog, confirm deletion by typing delete.

  5. Click Delete.

API

Use the projects.locations.dataExchanges.delete method.

DELETE https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID

For more information about the tasks that you can perform on data exchanges using APIs, see projects.locations.dataExchanges methods.

What's next