steampipe plugin install gcp

Table: gcp_dataplex_asset - Query GCP Dataplex Assets using SQL

Google Cloud Dataplex is an intelligent data fabric that helps you manage, monitor, and govern your data across various cloud and on-premises environments. The gcp_dataplex_asset table in Steampipe allows you to query information about Dataplex assets, including their resource specifications, discovery status, security status, and associated lakes and zones.

Table Usage Guide

The gcp_dataplex_asset table is useful for cloud administrators, data engineers, and security professionals to gather detailed insights into their Dataplex assets. You can query various aspects of the assets, such as their resource specifications, discovery and security statuses, and their associations with specific lakes and zones. This table is particularly helpful for monitoring asset states, managing data access, and ensuring that your data is properly organized and governed.

Important Notes

  • You must specify the zone_name in the where clause (where zone_name='projects/{projectName}/locations/us-central1/lakes/{lakeId}/zones/{zoneId}') to list the assets.

Examples

Basic asset information

Retrieve basic information about Dataplex assets, including their name, display name, and creation time.

select
name,
display_name,
create_time,
state,
location,
project
from
gcp_dataplex_asset
where
zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';
select
name,
display_name,
create_time,
state,
location,
project
from
gcp_dataplex_asset
where
zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';

List assets by state and resource type

Identify assets that are in a specific state (e.g., READY) and of a specific resource type (e.g., BIGQUERY_DATASET).

select
name,
display_name,
state,
resource_spec ->> 'type' as resource_type
from
gcp_dataplex_asset
where
state = 'ACTIVE'
and resource_spec ->> 'type' = 'BIGQUERY_DATASET'
and zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';
select
name,
display_name,
state,
json_extract(resource_spec, '$.type') as resource_type
from
gcp_dataplex_asset
where
state = 'ACTIVE'
and json_extract(resource_spec, '$.type') = 'BIGQUERY_DATASET'
and zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';

List assets with discovery details

Retrieve assets that have discovery features enabled, showing details about the last discovery run and its duration.

select
name,
display_name,
discovery_status ->> 'state' as discovery_state,
discovery_status ->> 'lastRunTime' as last_run_time,
discovery_status ->> 'lastRunDuration' as last_run_duration
from
gcp_dataplex_asset
where
discovery_status is not null
and zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';
select
name,
display_name,
json_extract(discovery_status, '$.state') as discovery_state,
json_extract(discovery_status, '$.lastRunTime') as last_run_time,
json_extract(discovery_status, '$.lastRunDuration') as last_run_duration
from
gcp_dataplex_asset
where
discovery_status is not null
and zone_name = 'projects/parker-aaa/locations/us-central1/lakes/dasdadsa/zones/tese9392';

List assets and join with zones and lakes

Retrieve a list of assets along with their associated zones and lakes by joining with the gcp_dataplex_zone and gcp_dataplex_lake tables.

select
a.name as asset_name,
a.display_name as asset_display_name,
z.name as zone_name,
l.name as lake_name
from
gcp_dataplex_asset a
join gcp_dataplex_zone z on a.zone_name = z.name
join gcp_dataplex_lake l on z.lake_name = l.name;
select
a.name as asset_name,
a.display_name as asset_display_name,
z.name as zone_name,
l.name as lake_name
from
gcp_dataplex_asset a
join gcp_dataplex_zone z on a.zone_name = z.name
join gcp_dataplex_lake l on z.lake_name = l.name;

Schema for gcp_dataplex_asset

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
create_timetimestamp with time zoneThe time when the asset was created.
descriptiontextDescription of the asset.
discovery_specjsonbSpecification of the discovery feature applied to data referenced by this asset. When this spec is left unset, the asset will use the spec set on the parent zone.
discovery_statusjsonbStatus of the discovery feature applied to data referenced by this asset.
display_nametext=User friendly display name.
lake_nametextThe relative resource name of the lake.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
nametext=The relative resource name of the asset.
projecttext=, !=, ~~, ~~*, !~~, !~~*The GCP Project in which the resource is located.
resource_specjsonbSpecification of the resource that is referenced by this asset.
resource_statusjsonbStatus of the resource referenced by this asset.
security_statusjsonbStatus of the security policy applied to resource referenced by this asset.
self_linktextServer-defined URL for the resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statetext=Current state of the asset.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.
uidtextSystem generated globally unique ID for the asset.
update_timetimestamp with time zoneThe time when the asset was last updated.
zone_nametext=The relative resource name of the zone.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp

You can pass the configuration to the command with the --config argument:

steampipe_export_gcp --config '<your_config>' gcp_dataplex_asset