
Big Query Dataset:
After the configuration is complete, you will be able to see the BigQuery dataset and tables below. These are used to query the objects and gain complete insights at later stages.
Example Prompts:
By default, generating insights on a dataset gives a few default prompts. We can click and see the output in the Gemini prompt window on the right side. At the same time, we can use our custom prompt. For example,
Scenario: As an SRE, I want to know which objects have not been accessed recently so that, from a FinOps perspective, I can partner with Dev Leads to optimize resources and save on cloud costs.
my custom prompt: “give me bucket name, object name, when it was created and last accessed”
Along with the query output, it will also provide the corresponding BigQuery SQL query.
SET @@dataset_project_id = '';
SET @@dataset_id =
'project_2025_05_27_11_22_22_16f37305_42e9_4791_ba88_b98084dba99d';/* Following is the static CTE definitions for selecting the latest snapshot */ WITH
distinct_snapshots AS (
SELECT DISTINCT snapshotTime
FROM
`.project_2025_05_27_11_22_22_16f37305_42e9_4791_ba88_b98084dba99d.object_attributes_view`
WHERE
EXTRACT(DATE FROM snapshotTime)
>= DATE_SUB(CURRENT_DATE(), INTERVAL 3 DAY)
AND EXTRACT(DATE FROM snapshotTime)
<= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
INTERSECT DISTINCT
SELECT DISTINCT snapshotTime
FROM
`.project_2025_05_27_11_22_22_16f37305_42e9_4791_ba88_b98084dba99d.bucket_attributes_view`
WHERE
EXTRACT(DATE FROM snapshotTime)
>= DATE_SUB(CURRENT_DATE(), INTERVAL 3 DAY)
AND EXTRACT(DATE FROM snapshotTime)
<= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
),
object_attributes_latest AS (
SELECT *
FROM
`.project_2025_05_27_11_22_22_16f37305_42e9_4791_ba88_b98084dba99d.object_attributes_view`
WHERE snapshotTime = (SELECT MAX(snapshotTime) FROM distinct_snapshots)
),
bucket_attributes_latest AS (
SELECT *
FROM
`.project_2025_05_27_11_22_22_16f37305_42e9_4791_ba88_b98084dba99d.bucket_attributes_view`
WHERE snapshotTime = (SELECT MAX(snapshotTime) FROM distinct_snapshots)
) /* Following is the AI Generated Query answering the input NL question with latest snapshot */
SELECT oa.bucket, oa.name, oa.timeCreated, oa.updated
FROM object_attributes_latest AS oa
LIMIT 100
Navigate to BigQuery and let’s execute it for the output.
References:
Source Credit: https://medium.com/google-cloud/google-cloud-storage-storage-intelligence-insights-with-gemini-116cebf67b92?source=rss—-e52cf94d98af—4