יצירת מוצרי נתונים

המסמך הזה מיועד לבעלים של מוצרי נתונים שרוצים ליצור ולהגדיר מוצרי נתונים ב-Knowledge Catalog (לשעבר Dataplex Universal Catalog). כשמגדירים את המשאבים האלה, חשוב לוודא שהמזהים שלהם תואמים להנחיות למתן שמות למשאבים ב-Knowledge Catalog.

למידע נוסף על הארכיטקטורה ומושגי המפתח של מוצרי נתונים, קראו את המאמר מידע על מוצרי נתונים.

לפני שמתחילים

לפני שיוצרים מוצרי נתונים, צריך לבצע את הפעולות הבאות.

הפעלה של Gemini

הגדרת Gemini בנכס הנתונים היא שלב אופציונלי, אבל מומלץ מאוד לבצע אותו לפני שיוצרים את מוצר הנתונים הראשון.

כברירת מחדל, כדי ליצור מוצר נתונים צריך להזין באופן ידני תיאורים עסקיים, הגדרות טכניות ומסמכי תיעוד להצטרפות לנכסים. כשמפעילים את השילוב עם Gemini, ‏Knowledge Catalog משתמש בעזרה מבוססת-AI כדי לנתח באופן אוטומטי את הסכימות ואת תוצאות סריקת הנתונים, וליצור את הדברים הבאים:

  • תיעוד עסקי: יוצר תבניות תיעוד ותיאורים ברורים של מוצר הנתונים ונכסי הנתונים הנפרדים שלו.
  • תובנות ושאילתות לדוגמה: יצירת שאילתות לדוגמה שמוכנות לשימוש על סמך פריסת הסכימה של הנכס, כדי שצרכני הנתונים יוכלו להתחיל מיד לשלוח שאילתות לגבי המוצר אחרי האישור.

אם אתם לא רוצים להפעיל את Gemini, אתם יכולים לדלג על הקטע הזה. עם זאת, צריך לספק באופן ידני את כל המטא-נתונים של הנכסים ואת תבניות השאילתות במהלך היצירה.

איך מפעילים את Gemini ב-BigQuery

הפעלת ממשקי ה-API

מפעילים את Dataplex ואת BigQuery API, אם הם עדיין לא מופעלים.

התפקידים שנדרשים כדי להפעיל ממשקי API

כדי להפעיל ממשקי API, צריך את ההרשאה serviceusage.services.enable. אם יצרתם את הפרויקט, סביר להניח שכבר יש לכם את ההרשאה הזו דרך התפקיד "בעלים" (roles/owner). אחרת, תוכלו לקבל את ההרשאה הזו דרך התפקיד "אדמין בממשק 'שימוש בשירות'" (roles/serviceusage.serviceUsageAdmin). איך מקצים תפקידים

הפעלת ממשקי ה-API

יצירת נכסי נתונים

מוודאים שנכסי הנתונים (לדוגמה, מערכי נתונים, טבלאות ותצוגות ב-BigQuery) נוצרו ומאוכלסים.

מידע נוסף על יצירת נכסי נתונים זמין במאמרים הבאים:

הגדרת זהויות

מאתרים או יוצרים את קבוצות Google או את חשבונות השירות שרוצים להגדיר במוצר הנתונים.

אופציונלי: הגדרת Looker (Google Cloud core) למוצרי נתונים

אם אתם מתכננים לכלול נכסי Looker (Google Cloud core) במוצר הנתונים, בצעו את השלבים הנוספים הבאים:

  1. מוודאים שהרשומה בקטלוג של המשאב של Looker (Google Cloud core) כבר קיימת ב-Knowledge Catalog באותו אזור של מוצר הנתונים. מידע נוסף מופיע במאמר ניהול משאבי Looker (Google Cloud core) באמצעות Knowledge Catalog.
  2. מגדירים את Google OAuth ומפעילים קבוצות משוכפלות במכונה של Looker (Google Cloud core) כדי ליצור קבוצת Looker לקריאה בלבד לקבוצה שלכם ב-Google.
  3. מקצים רמות גישה לתיקיות ותפקידים ב-Looker לקבוצה המשוכפלת ב-Looker.

התפקידים הנדרשים

בקטע הזה מפורטים תפקידי ה-IAM המינימליים שנדרשים לחלקים העיקריים הבאים:

  • בעלי מוצרי נתונים: משתמשים שיוצרים, מגדירים ומנהלים מוצרי נתונים והנכסים שמשויכים אליהם

  • צרכני מוצרי נתונים: משתמשים שמחפשים מוצרי נתונים שפורסמו, צופים בהם ומבקשים גישה אליהם

התפקידים הנדרשים לבעלי מוצרי נתונים

כדי לקבל את ההרשאות שדרושות ליצירה ולניהול של מוצרי נתונים, בקשו מהאדמין להקצות לכם את התפקידים הבאים ב-IAM בפרויקט:

  • הרשאות מלאות ליצור, לעדכן, למחוק, לנהל הרשאות ולאשר או לדחות בקשות גישה למוצרי נתונים: אדמין של מוצרי נתונים ב-Dataplex (roles/dataplex.dataProductsAdmin)
  • עדכון וניהול של הרשאות, ואישור או דחייה של בקשות גישה למוצרי נתונים: עריכת מוצרי נתונים ב-Dataplex (roles/dataplex.dataProductsEditor)
  • להוסיף היבטים של מטא-נתונים (כמו schema,‏ overview,‏ contacts ו-queries): הבעלים של Dataplex Entry ו-EntryLink ‏ (roles/dataplex.entryOwner)
  • חיפוש והוספה של נכסים: צפייה ב-Dataplex Catalog (roles/dataplex.catalogViewer)
  • עריכת סוגי היבטים של המערכת (כמו overview,‏ contact,‏ contract ו-queries): עריכת קטלוג Dataplex (roles/dataplex.catalogEditor)
  • יצירה או אחזור של סריקות נתונים של תובנות לצורך תיעוד אוטומטי ויצירת תובנות: אדמין של Dataplex DataScan (roles/dataplex.dataScanAdmin)
  • גישה למטא-נתונים של Looker (Google Cloud core) ב-Knowledge Catalog: Looker Schema Viewer (roles/looker.schemaViewer) – בפרויקט שמארח את המכונה של Looker (Google Cloud core)
  • מקצים את התפקיד roles/looker.instanceUser לקבוצת Google של קבוצת הגישה: אדמין IAM של פרויקט (roles/resourcemanager.projectIamAdmin) – בפרויקט שמארח את המכונה של Looker (Google Cloud core)

להסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

התפקידים המוגדרים מראש האלה כוללים את ההרשאות שנדרשות כדי ליצור ולנהל מוצרי נתונים. כדי לראות בדיוק אילו הרשאות נדרשות, אפשר להרחיב את הקטע ההרשאות הנדרשות:

ההרשאות הנדרשות

כדי ליצור ולנהל מוצרי נתונים, צריך את ההרשאות הבאות:

  • יצירת מוצר נתונים: dataplex.dataProducts.create
  • הצגת רשימה של מוצרי נתונים בפרויקט: dataplex.dataProducts.list
  • קבלת או הצגת מוצר נתונים: dataplex.dataProducts.get
  • עריכת מוצר נתונים קיים: dataplex.dataProducts.update
  • מחיקת מוצר הנתונים: dataplex.dataProducts.delete
  • אישור בקשת גישה למוצר נתונים: dataplex.dataProducts.approve
  • מחפשים מוצר נתונים באמצעות Knowledge Catalog:
    • dataplex.dataProducts.get
    • dataplex.projects.search
  • יצירת בקשת גישה למוצר נתונים: dataplex.dataProducts.get
  • יוצרים נכס נתונים: dataplex.dataAssets.create
  • הצגת רשימה של נכסי נתונים במוצר נתונים: dataplex.dataAssets.list
  • קבלת נכס נתונים: dataplex.dataAssets.get
  • עריכת נכס נתונים קיים: dataplex.dataAssets.update
  • מחיקת נכס נתונים: dataplex.dataAssets.delete
  • יצירת סריקת נתונים: dataplex.datascans.create
  • הצגת רשימה של כל סריקות הנתונים: dataplex.datascans.list
  • סריקת נתונים: dataplex.datascans.get
  • מפעילים סריקת נתונים: dataplex.datascans.run
  • עורכים את סוג ההיבט של המערכת overview: dataplex.entryGroups.useOverviewAspect
  • עורכים את סוג ההיבט של המערכת refresh cadence: dataplex.entryGroups.useRefreshCadenceAspect
  • עורכים את סוג ההיבט של המערכת queries: dataplex.entryGroups.useQueriesAspect

יכול להיות שתקבלו את ההרשאות האלה באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש אחרים.

התפקידים הנדרשים לצרכנים של מוצרי נתונים

כדי שצרכני מוצרי הנתונים יוכלו לחפש מוצרי נתונים, לצפות בהם ולבקש גישה אליהם, אתם צריכים לוודא שמוצר הנתונים שלכם גלוי. כדי לעשות את זה, מקצים לצרכני מוצר הנתונים את תפקידי ה-IAM הבאים במוצר הנתונים:

  • חיפוש מוצרי נתונים ובקשת גישה אליהם: צרכן של מוצר נתונים ב-Dataplex‏ (dataplex.dataProductsConsumer) וצפייה בקטלוג של Dataplex‏ (roles/dataplex.catalogViewer)
  • גישה לקריאה בלבד כדי להציג הגדרות ומטא-נתונים של מוצרי נתונים: Dataplex Data Product Viewer (dataplex.dataProductsViewer)

יצירה והגדרה של מוצר נתונים

כדי ליצור מוצר נתונים, צריך לבצע את המשימות הכלליות הבאות:

  1. יצירת מוצר נתונים

    בשלב הראשוני הזה, שהוא חובה, צריך להגדיר פרטים בסיסיים כמו שם ייחודי למוצר הנתונים, תיאור, האזור שבו נוצר מוצר הנתונים ופרטים ליצירת קשר.

  2. אופציונלי: הוספת נכסים

    בשלב הזה בוחרים את הנכסים שרוצים לכלול במוצר הנתונים. אילוץ מרכזי הוא שהנכסים חייבים להיות באותו אזור שבו נמצא מוצר הנתונים עצמו. אפשר להוסיף עד 10 נכסים בכל פעם, ועד 50 נכסים לכל מוצר נתונים.

    רשימת הנכסים הנתמכים

  3. אופציונלי: הגדרת קבוצות גישה והרשאות לנכסים

    בשלב האופציונלי הזה, אתם יכולים לפשט את בקרת הגישה על ידי יצירת קבוצות גישה. קבוצות הגישה האלה פועלות ככינויים ידידותיים למשתמש (לדוגמה, Analyst או Reader) לקבוצות Google ולחשבונות השירות הבסיסיים. כדי להקצות הרשאות, בוחרים תפקיד ספציפי ב-IAM וממפים אותו לקבוצת גישה לנכס ספציפי.

  4. אופציונלי: הוספת פרטים על החוזה ועל ההיבט

    בשלב הזה, אתם משפרים את יכולת הגילוי של הנתונים ואת הפיקוח עליהם באמצעות צירוף של מסגרות מטא-נתונים. אתם יכולים להוסיף חוזה כדי להעביר באופן רשמי את קצב רענון הנתונים, ולציין פרמטרים כמו תדירות הרענון, התזמון וספי השונות. אתם יכולים גם לצרף היבטים בהתאמה אישית כדי לספק מטא-נתונים עסקיים או טכניים נוספים למוצר הנתונים.

  5. אופציונלי: הוספת פרטים נוספים

    בשלב האחרון, מוסיפים מסמכי תיעוד בפורמט של טקסט עשיר, כמו מדריכים להכשרת עובדים חדשים, הגדרות עסקיות ושאילתות לדוגמה, כדי לעזור לצרכנים להשתמש במוצר הנתונים מיד אחרי האישור.

כדי ליצור ולהגדיר מוצר נתונים, מבצעים את השלבים שמפורטים בקטעים הבאים:

יצירת מוצר נתונים

המסוף

  1. במסוף Google Cloud , נכנסים לדף Data products ב-Knowledge Catalog.

    מעבר אל "מוצרי נתונים"

  2. לוחצים על יצירה.

  3. בחלונית Create data products, מזינים את הפרטים הבאים:

    • שם מוצר הנתונים: מזינים שם ייחודי למוצר הנתונים.
    • מזהה מוצר הנתונים: מזהה ייחודי שנוצר אוטומטית. אפשר לערוך את השדה הזה.
    • מזהה הפרויקט: המזהה הייחודי של הפרויקט שבו נוצר מוצר הנתונים. מחפשים את הפרויקט ובוחרים אותו.
    • ‫Region: בוחרים את האזור או את מספר האזורים שבהם נוצר מוצר הנתונים.
    • סמל מוצר הנתונים: מחפשים ובוחרים סמל לזיהוי חזותי של מוצר הנתונים. הפעולה הזאת אופציונלית.
    • תיאור: מזינים תיאור קצר של מוצר הנתונים.
    • אנשי קשר: הפרטים של איש הקשר שאחראי על תהליכי הניהול והאישור:

      • כתובת האימייל של בעלי מוצר הנתונים: מזינים את כתובת האימייל של בעלי מוצר הנתונים.
      • כתובת האימייל של הגורמים שמאשרים את מוצר הנתונים: מזינים את כתובת האימייל של הגורמים שמאשרים את בקשות הגישה או השינויים.
    • תוויות: הוספת תוויות של מפתח/ערך כדי לארגן את המשאבים. זה אופציונלי.

  4. לוחצים על Create data product.

Terraform

כדי ליצור מוצר נתונים, משתמשים במשאבים של google_dataplex_data_product ו-IAM.

resource "google_dataplex_data_product" "default" {
  project         = "PROJECT_ID"
  location        = "LOCATION"
  data_product_id = "DATA_PRODUCT_ID"
  display_name    = "DISPLAY_NAME"
  description     = "DESCRIPTION"
  owner_emails    = ["EMAIL_IDs"]

  # Optional: Configures designated approvers for access requests
  access_approval_config {
    approver_emails = ["APPROVER_EMAIL_IDs"]
  }

  # Optional: Base64-encoded icon (Max 3.0MiB)
  icon = "ICON_BASE64_STRING"
}

resource "google_dataplex_data_product_iam_member" "consumer_binding" {
  project         = "PROJECT_ID"
  location        = "LOCATION"
  data_product_id = "DATA_PRODUCT_ID"
  role            = "roles/dataplex.dataProductsConsumer"
  member          = "MEMBER"
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
  • ‫LOCATION: האזור שבו רוצים ליצור את מוצר הנתונים.
  • ‫DATA_PRODUCT_ID: מזהה ייחודי של מוצר הנתונים.
  • ‫DISPLAY_NAME: שם ידידותי למשתמש של מוצר הנתונים.
  • ‫DESCRIPTION: תיאור קצר של מוצר הנתונים.
  • ‫EMAIL_IDs: כתובות אימייל מופרדות בפסיקים של בעלי מוצר הנתונים, לדוגמה ["user1@example.com", "user2@example.com"].
  • APPROVER_EMAIL_IDs: כתובות אימייל מופרדות בפסיקים של הגורמים המאשרים שאחראים על אישור בקשות גישה או שינויים במוצר הנתונים הזה.
  • ‫ICON_BASE64_STRING: נתוני התמונה הגולמיים בקידוד base64 שמייצגים את מוצר הנתונים. הגודל המקסימלי הוא 3.0 MiB. אל תכללו את הקידומת של סכמת כתובת ה-URL של הנתונים.
  • ‫MEMBER: המשתמש, חשבון השירות או הקבוצה שמקבלים את תפקיד הצרכן (לדוגמה, group:all-analysts@example.com).

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של C# במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dataplex.V1;
using Google.LongRunning;

public sealed partial class GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for CreateDataProduct</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateDataProductRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        CreateDataProductRequest request = new CreateDataProductRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            DataProductId = "",
            DataProduct = new DataProduct(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataProduct, OperationMetadata> response = dataProductServiceClient.CreateDataProduct(request);

        // Poll until the returned long-running operation is complete
        Operation<DataProduct, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataProduct result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<DataProduct, OperationMetadata> retrievedResponse = dataProductServiceClient.PollOnceCreateDataProduct(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataProduct retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Go במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewDataProductClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateDataProductRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateDataProductRequest.
	}
	op, err := c.CreateDataProduct(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Java במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

import com.google.cloud.dataplex.v1.CreateDataProductRequest;
import com.google.cloud.dataplex.v1.DataProduct;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateDataProduct {

  public static void main(String[] args) throws Exception {
    syncCreateDataProduct();
  }

  public static void syncCreateDataProduct() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      CreateDataProductRequest request =
          CreateDataProductRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setDataProductId("dataProductId1437828576")
              .setDataProduct(DataProduct.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataProduct response = dataProductServiceClient.createDataProductAsync(request).get();
    }
  }
}

Node.js

Node.js

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Node.js במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The parent resource where this data product will be created.
 *  Format: projects/{project_id_or_number}/locations/{location_id}
 */
// const parent = 'abc123'
/**
 *  Optional. The ID of the data product to create.
 *  The ID must conform to RFC-1034 and contain only lower-case letters (a-z),
 *  numbers (0-9), or hyphens, with the first character a letter, the last a
 *  letter or a number, and a 63 character maximum. Characters outside of
 *  ASCII are not permitted.
 *  Valid format regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`
 *  If not provided, a system generated ID will be used.
 */
// const dataProductId = 'abc123'
/**
 *  Required. The data product to create.
 */
// const dataProduct = {}
/**
 *  Optional. Validates the request without actually creating the data product.
 *  Default: false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {DataProductServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new DataProductServiceClient();

async function callCreateDataProduct() {
  // Construct request
  const request = {
    parent,
    dataProduct,
  };

  // Run request
  const [operation] = await dataplexClient.createDataProduct(request);
  const [response] = await operation.promise();
  console.log(response);
}

callCreateDataProduct();

Python

Python

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Python במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_data_product():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

    # Initialize request argument(s)
    data_product = dataplex_v1.DataProduct()
    data_product.display_name = "display_name_value"
    data_product.owner_emails = ["owner_emails_value1", "owner_emails_value2"]

    request = dataplex_v1.CreateDataProductRequest(
        parent="parent_value",
        data_product=data_product,
    )

    # Make the request
    operation = client.create_data_product(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

REST

כדי ליצור מוצר נתונים, משתמשים ב-method‏ dataProducts.create.

לדוגמה, שולחים את בקשת ה-POST הבאה:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"display_name": "DISPLAY_NAME", "owner_emails": ["EMAIL_IDs"], "access_approval_config": { "approver_emails": ["APPROVER_EMAIL_IDs"]} }' \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataProducts?data_product_id=DATA_PRODUCT_ID

מחליפים את מה שכתוב בשדות הבאים:

  • ‫DISPLAY_NAME: שם ידידותי למשתמש של מוצר הנתונים
  • EMAIL_IDs: כתובות אימייל מופרדות בפסיקים של בעלי מוצר הנתונים
  • ‫APPROVER_EMAIL_IDs: כתובות אימייל מופרדות בפסיקים של הגורמים המאשרים שאחראים לאשר בקשות גישה או שינויים.
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • ‫LOCATION: האזור שבו רוצים ליצור את מוצר הנתונים
  • ‫DATA_PRODUCT_ID: מזהה ייחודי של מוצר הנתונים

אופציונלי: הוספת נכסים

אתם יכולים להוסיף למוצר הנתונים נכסי נתונים שונים, כמו טבלאות ב-BigQuery, תצוגות, מערכי נתונים ומודלים. רשימת הנכסים הנתמכים

המסוף

  1. בחלונית הוספת נכסים, לוחצים על +הוספה.

  2. מחפשים ובוחרים את הנכסים שרוצים להוסיף למוצר הנתונים. הנכסים שבוחרים צריכים להיות באותו אזור כמו מוצר הנתונים.

    אם יש לכם את ההרשאות הנדרשות, אתם יכולים ללחוץ על הנכס כדי לראות את המטא-נתונים שלו.

  3. כדי לצמצם את תוצאות החיפוש, משתמשים במסננים.

  4. אחרי שבוחרים את הנכסים, לוחצים על הוספה.

  5. לוחצים על Continue.

Terraform

כדי להוסיף נכס נתונים למוצר הנתונים, משתמשים במשאב google_dataplex_data_product_data_asset.

resource "google_dataplex_data_product_data_asset" "example_asset" {
project         = "PROJECT_ID"
location        = "LOCATION"
data_product_id = "DATA_PRODUCT_ID"
data_asset_id   = "DATA_ASSET_ID"
resource        = "RESOURCE_NAME"
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • DATA_ASSET_ID: מזהה ייחודי של נכס הנתונים הזה בתוך מוצר הנתונים
  • ‫RESOURCE_NAME: שם המשאב המלא של נכס הנתונים (לדוגמה, //bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID)

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של C# במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;

public sealed partial class GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for CreateDataAsset</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void CreateDataAssetRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        CreateDataAssetRequest request = new CreateDataAssetRequest
        {
            ParentAsDataProductName = DataProductName.FromProjectLocationDataProduct("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]"),
            DataAssetId = "",
            DataAsset = new DataAsset(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataAsset, OperationMetadata> response = dataProductServiceClient.CreateDataAsset(request);

        // Poll until the returned long-running operation is complete
        Operation<DataAsset, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataAsset result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<DataAsset, OperationMetadata> retrievedResponse = dataProductServiceClient.PollOnceCreateDataAsset(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataAsset retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Go במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewDataProductClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateDataAssetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateDataAssetRequest.
	}
	op, err := c.CreateDataAsset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Java במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

import com.google.cloud.dataplex.v1.CreateDataAssetRequest;
import com.google.cloud.dataplex.v1.DataAsset;
import com.google.cloud.dataplex.v1.DataProductName;
import com.google.cloud.dataplex.v1.DataProductServiceClient;

public class SyncCreateDataAsset {

  public static void main(String[] args) throws Exception {
    syncCreateDataAsset();
  }

  public static void syncCreateDataAsset() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      CreateDataAssetRequest request =
          CreateDataAssetRequest.newBuilder()
              .setParent(DataProductName.of("[PROJECT]", "[LOCATION]", "[DATA_PRODUCT]").toString())
              .setDataAssetId("dataAssetId2108984609")
              .setDataAsset(DataAsset.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataAsset response = dataProductServiceClient.createDataAssetAsync(request).get();
    }
  }
}

Node.js

Node.js

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Node.js במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The parent resource where this data asset will be created.
 *  Format:
 *  projects/{project_id_or_number}/locations/{location_id}/dataProducts/{data_product_id}
 */
// const parent = 'abc123'
/**
 *  Optional. The ID of the data asset to create.
 *  The ID must conform to RFC-1034 and contain only lower-case letters (a-z),
 *  numbers (0-9), or hyphens, with the first character a letter, the last a
 *  letter or a number, and a 63 character maximum. Characters outside of
 *  ASCII are not permitted.
 *  Valid format regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`
 *  If not provided, a system generated ID will be used.
 */
// const dataAssetId = 'abc123'
/**
 *  Required. The data asset to create.
 */
// const dataAsset = {}
/**
 *  Optional. Validates the request without actually creating the data asset.
 *  Defaults to false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {DataProductServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new DataProductServiceClient();

async function callCreateDataAsset() {
  // Construct request
  const request = {
    parent,
    dataAsset,
  };

  // Run request
  const [operation] = await dataplexClient.createDataAsset(request);
  const [response] = await operation.promise();
  console.log(response);
}

callCreateDataAsset();

Python

Python

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Python במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_create_data_asset():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

    # Initialize request argument(s)
    data_asset = dataplex_v1.DataAsset()
    data_asset.resource = "resource_value"

    request = dataplex_v1.CreateDataAssetRequest(
        parent="parent_value",
        data_asset=data_asset,
    )

    # Make the request
    operation = client.create_data_asset(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

REST

כדי להוסיף נכס נתונים למוצר הנתונים, משתמשים ב-method‏ dataAssets.create.

לדוגמה, שולחים את בקשת ה-POST הבאה:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"resource": "RESOURCE_NAME"}' \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataProducts/DATA_PRODUCT_ID/dataAssets?data_asset_id=DATA_ASSET_ID

מחליפים את מה שכתוב בשדות הבאים:

  • ‫RESOURCE_NAME: שם המשאב המלא של נכס הנתונים (לדוגמה, //bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID)
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • DATA_ASSET_ID: מזהה ייחודי של נכס הנתונים הזה בתוך מוצר הנתונים

אופציונלי: הגדרת קבוצות גישה והרשאות לנכסים

בחלונית הגדרה של קבוצות גישה והרשאות לנכסים, אתם יכולים ליצור קבוצות גישה ולהקצות הרשאות לנכסים.

הגדרת קבוצות גישה

המסוף

  1. לוחצים על הוספת קבוצת גישה.

  2. בשדה שם קבוצת הגישה, מזינים שם לקבוצת הגישה. לדוגמה, Analyst.

  3. בשדה Access group description, מזינים תיאור לקבוצת הגישה.

  4. בשדה Access group identifier, מזינים את כתובת האימייל של קבוצת Google שרוצים להקצות לקבוצת הגישה הזו.

    צרכני מוצרי נתונים שמבקשים גישה לעצמם מתווספים כחברים לקבוצה הממופה ב-Google Groups.

    מידע נוסף על יצירת קבוצות Google זמין במאמר יצירה וניהול של קבוצות Google במסוף Google Cloud .

  5. בשדה Access group service account, מזינים את כתובת האימייל של חשבון השירות שרוצים להקצות לקבוצת הגישה הזו.

    צרכני מוצרי נתונים שמבקשים גישה לחשבונות השירות שלהם מקבלים את התפקיד Service Account Token Creator ‏ (roles/iam.serviceAccountTokenCreator) ב-IAM, כדי להתחזות לחשבון השירות של מפיק הנתונים שממופה לקבוצת הגישה.

    מידע נוסף על יצירת חשבונות שירות זמין במאמר יצירת חשבונות שירות.

  6. אופציונלי: בשדה Default role, בוחרים תפקיד IAM שמוגדר כברירת מחדל (לדוגמה, BigQuery Data Viewer) לקבוצת הגישה הזו. התפקיד הזה מוקצה באופן אוטומטי לכל הנכסים הנתמכים הקיימים והחדשים שנוספו במוצר הנתונים, אלא אם משנים אותו ברמת הנכס.

  7. לוחצים על סיום.

  8. כדי להוסיף עוד קבוצת גישה, לוחצים על הוספת קבוצת גישה וחוזרים על השלבים.

    אפשר להוסיף עד שלוש קבוצות גישה לכל מוצר נתונים.

  9. לוחצים על Save.

Terraform

כדי להגדיר קבוצות גישה למוצר הנתונים, משתמשים בבלוק המקונן access_groups בתוך המשאב google_dataplex_data_product.

לדוגמה, משתמשים בהגדרות הבאות:

resource "google_dataplex_data_product" "example_data_product" {
  project         = "PROJECT_ID"
  location        = "LOCATION"
  data_product_id = "DATA_PRODUCT_ID"
  display_name    = "DISPLAY_NAME"
  owner_emails    = ["EMAIL_IDs"]

  access_groups {
    id           = "analyst" # Internal identifier for configuration
    group_id     = "analyst" # Unique identifier of the access group, should be same as the 'id'
    display_name = "Business Analyst"
    description  = "Access group for regional analysts"
    principal {
      google_group = "analyst-team@example.com"
    }
  }

# Service account principal
  access_groups {
    id           = "scientist"
    group_id     = "scientist"
    display_name = "Data Scientist"
    principal {
      service_account = "SERVICE_ACCOUNT_EMAIL_ADDRESS"
    }
  }
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים
  • ‫DATA_PRODUCT_ID: מזהה ייחודי של מוצר הנתונים
  • ‫DISPLAY_NAME: שם ידידותי למשתמש של מוצר הנתונים
  • ‫EMAIL_IDs: כתובות אימייל מופרדות בפסיקים של בעלי מוצר הנתונים, לדוגמה: ["user1@example.com", "user2@example.com"]
  • ‫SERVICE_ACCOUNT_EMAIL_ADDRESS: כתובת האימייל של חשבון השירות

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של C# במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for UpdateDataProduct</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void UpdateDataProductRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        UpdateDataProductRequest request = new UpdateDataProductRequest
        {
            DataProduct = new DataProduct(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataProduct, OperationMetadata> response = dataProductServiceClient.UpdateDataProduct(request);

        // Poll until the returned long-running operation is complete
        Operation<DataProduct, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataProduct result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<DataProduct, OperationMetadata> retrievedResponse = dataProductServiceClient.PollOnceUpdateDataProduct(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataProduct retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Go במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewDataProductClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.UpdateDataProductRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateDataProductRequest.
	}
	op, err := c.UpdateDataProduct(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Java במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

import com.google.cloud.dataplex.v1.DataProduct;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataProductRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataProduct {

  public static void main(String[] args) throws Exception {
    syncUpdateDataProduct();
  }

  public static void syncUpdateDataProduct() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataProductRequest request =
          UpdateDataProductRequest.newBuilder()
              .setDataProduct(DataProduct.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataProduct response = dataProductServiceClient.updateDataProductAsync(request).get();
    }
  }
}

Node.js

Node.js

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Node.js במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The data product to update.
 *  The data product's `name` field is used to identify the data product to
 *  update.
 */
// const dataProduct = {}
/**
 *  Optional. The list of fields to update.
 *  If this is empty or not set, then all the fields will be updated.
 */
// const updateMask = {}
/**
 *  Optional. Validates the request without actually updating the data product.
 *  Default: false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {DataProductServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new DataProductServiceClient();

async function callUpdateDataProduct() {
  // Construct request
  const request = {
    dataProduct,
  };

  // Run request
  const [operation] = await dataplexClient.updateDataProduct(request);
  const [response] = await operation.promise();
  console.log(response);
}

callUpdateDataProduct();

Python

Python

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Python במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_update_data_product():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

    # Initialize request argument(s)
    data_product = dataplex_v1.DataProduct()
    data_product.display_name = "display_name_value"
    data_product.owner_emails = ["owner_emails_value1", "owner_emails_value2"]

    request = dataplex_v1.UpdateDataProductRequest(
        data_product=data_product,
    )

    # Make the request
    operation = client.update_data_product(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

REST

כדי להגדיר קבוצת גישה למוצר הנתונים, משתמשים ב-method‏ dataProducts.patch.

לדוגמה, שולחים את בקשת ה-PATCH הבאה:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"access_groups": ACCESS_GROUPS_MAP}' \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataProducts/DATA_PRODUCT_ID?update_mask="access_groups"

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ACCESS_GROUPS_MAP: אובייקט JSON שמייצג מפה שבה כל מפתח הוא מזהה של קבוצת גישה, והערך הוא אובייקט AccessGroup. לדוגמה:

    {
    "analyst": {
      "id": "analyst",
      "display_name": "Analyst access group",
      "description": "Access group for analysts",
      "principal":
        {
          "google_group": "analyst-team@example.com",
          "service_account": "analyst-svc@gserviceaccount.com"
        },
      "default_iam_role_config":
        {
          "role": "roles/bigquery.dataViewer"
        }
    }
    }
    
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud

  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים

  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים

הגדרת הרשאות גישה לנכסים

אחרי שמגדירים קבוצות גישה, אפשר להגדיר הרשאות לנכסים במוצר הנתונים.

אם הגדרתם תפקיד IAM כברירת מחדל לקבוצת גישה, הנכסים הנתמכים יורשים את התפקיד הזה באופן אוטומטי (מסומן בתווית Default בעמודה Permissions). כדי לשנות את תפקיד ברירת המחדל לנכסים ספציפיים, אתם יכולים להקצות תפקיד אחר.

המסוף

  1. בקטע Asset permissions, בוחרים את הנכס שרוצים להגדיר לו הרשאות. אפשר לבחור ולהגדיר הרשאות לעד 10 נכסים בכל פעם.

  2. לוחצים על הגדרת הרשאות.

  3. בשדה בחירת קבוצת גישה, בוחרים קבוצת גישה.

  4. בשדה Assign IAM role, בוחרים את תפקיד ה-IAM שרוצים להקצות לקבוצת הגישה.

    לדוגמה, אם הנכס הוא טבלה ב-BigQuery בשם Sales, ובחרתם בקבוצת הגישה Analyst והקציתם לה את התפקיד BigQuery Metadata Viewer, לצרכני מוצר הנתונים ששייכים לקבוצת הגישה Analyst יש הרשאה מסוג BigQuery Metadata Viewer בטבלה Sales.

    אפשר להוסיף כמה תפקידים לנכס.

  5. לוחצים על הגדרה. בעמודה Permissions בטבלת הנכסים מוצגות ההרשאות שהוקצו ומצב ההגדרה שלהן לכל קבוצת גישה:

    • Applied: תפקיד ה-IAM (שעבר בירושה מתפקיד ברירת המחדל של קבוצת הגישה או שהוגדר במיוחד לנכס) פעיל במשאב הבסיסי.
    • נכשל: לא הצלחנו להחיל את תפקיד ה-IAM על המשאב הבסיסי. הסיבה המפורטת לכישלון מופיעה ב-Cloud Logging.
    • לא נתמך: אי אפשר להחיל הרשאות על סוג המשאב של הנכס הזה.
  6. כדי להגדיר הרשאות לנכסים אחרים, חוזרים על השלבים.

  7. לוחצים על Continue.

Terraform

מקצים תפקידי IAM לקבוצות הגישה לנכסים ספציפיים באמצעות הבלוק access_group_configs במשאב google_dataplex_data_product_data_asset.

לדוגמה, משתמשים בהגדרות הבאות:

resource "google_dataplex_data_product_data_asset" "example_data_asset" {
project         = "PROJECT_ID"
location        = "LOCATION"
data_product_id = "DATA_PRODUCT_ID"
data_asset_id   = "DATA_ASSET_ID"
resource        = "RESOURCE_NAME"

access_group_configs {
  access_group = "analyst" # Must match the 'id' defined in google_dataplex_data_product
  iam_roles    = ["roles/bigquery.dataViewer"]
}
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud
  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • DATA_ASSET_ID: מזהה ייחודי של נכס הנתונים הזה בתוך מוצר הנתונים
  • ‫RESOURCE_NAME: שם המשאב המלא של נכס הנתונים (לדוגמה, //bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID)

C#‎

C#

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של C# במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog C# API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

using Google.Cloud.Dataplex.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedDataProductServiceClientSnippets
{
    /// <summary>Snippet for UpdateDataAsset</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public void UpdateDataAssetRequestObject()
    {
        // Create client
        DataProductServiceClient dataProductServiceClient = DataProductServiceClient.Create();
        // Initialize request argument(s)
        UpdateDataAssetRequest request = new UpdateDataAssetRequest
        {
            DataAsset = new DataAsset(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataAsset, OperationMetadata> response = dataProductServiceClient.UpdateDataAsset(request);

        // Poll until the returned long-running operation is complete
        Operation<DataAsset, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataAsset result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<DataAsset, OperationMetadata> retrievedResponse = dataProductServiceClient.PollOnceUpdateDataAsset(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataAsset retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Go במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Go API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.


//go:build examples

package main

import (
	"context"

	dataplex "cloud.google.com/go/dataplex/apiv1"
	dataplexpb "cloud.google.com/go/dataplex/apiv1/dataplexpb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := dataplex.NewDataProductClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.UpdateDataAssetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateDataAssetRequest.
	}
	op, err := c.UpdateDataAsset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Java

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Java במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Java API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

import com.google.cloud.dataplex.v1.DataAsset;
import com.google.cloud.dataplex.v1.DataProductServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataAssetRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataAsset {

  public static void main(String[] args) throws Exception {
    syncUpdateDataAsset();
  }

  public static void syncUpdateDataAsset() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (DataProductServiceClient dataProductServiceClient = DataProductServiceClient.create()) {
      UpdateDataAssetRequest request =
          UpdateDataAssetRequest.newBuilder()
              .setDataAsset(DataAsset.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataAsset response = dataProductServiceClient.updateDataAssetAsync(request).get();
    }
  }
}

Node.js

Node.js

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Node.js במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Node.js API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The data asset to update.
 *  The data asset's `name` field is used to identify the data asset to update.
 */
// const dataAsset = {}
/**
 *  Optional. The list of fields to update.
 *  If this is empty or not set, then all the fields will be updated.
 */
// const updateMask = {}
/**
 *  Optional. Validates the request without actually updating the data asset.
 *  Defaults to false.
 */
// const validateOnly = true

// Imports the Dataplex library
const {DataProductServiceClient} = require('@google-cloud/dataplex').v1;

// Instantiates a client
const dataplexClient = new DataProductServiceClient();

async function callUpdateDataAsset() {
  // Construct request
  const request = {
    dataAsset,
  };

  // Run request
  const [operation] = await dataplexClient.updateDataAsset(request);
  const [response] = await operation.promise();
  console.log(response);
}

callUpdateDataAsset();

Python

Python

לפני שמנסים את הדוגמה הזו, צריך לפעול לפי הוראות ההגדרה של Python במדריך למתחילים של Knowledge Catalog באמצעות ספריות לקוח. למידע נוסף, קראו את מאמרי העזרה של Knowledge Catalog Python API.

כדי לבצע אימות ב-Knowledge Catalog, צריך להגדיר את Application Default Credentials. למידע נוסף, ראו הגדרת אימות לסביבת פיתוח מקומית.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dataplex_v1


def sample_update_data_asset():
    # Create a client
    client = dataplex_v1.DataProductServiceClient()

    # Initialize request argument(s)
    data_asset = dataplex_v1.DataAsset()
    data_asset.resource = "resource_value"

    request = dataplex_v1.UpdateDataAssetRequest(
        data_asset=data_asset,
    )

    # Make the request
    operation = client.update_data_asset(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

REST

כדי להגדיר הרשאות לנכסים במוצר הנתונים, משתמשים ב-method‏ dataAssets.patch.

לדוגמה, שולחים את בקשת ה-PATCH הבאה:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"access_group_configs": ACCESS_GROUP_CONFIGS_MAP}' \
https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataProducts/DATA_PRODUCT_ID/dataAssets/DATA_ASSET_ID?update_mask="access_group_configs"

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ACCESS_GROUP_CONFIGS_MAP: אובייקט JSON שמייצג מפה שבה כל מפתח הוא מזהה של קבוצת גישה והערך הוא אובייקט AccessGroupConfig. לדוגמה:

    {
    "analyst": {
      iam_roles: ["roles/bigquery.dataViewer"]
      }
    }
    
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud

  • ‫LOCATION: האזור שבו נמצא מוצר הנתונים

  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים

  • ‫DATA_ASSET_ID: מזהה הנכס שרוצים להגדיר לו הרשאות

אופציונלי: הוספת פרטים על החוזה וההיבטים

אתם יכולים להוסיף חוזים והיבטים למוצר נתונים.

הוספת חוזה

כדי לבסס אמון בין יוצרי הנתונים לבין הצרכנים, אתם יכולים לצרף חוזה למוצר הנתונים. כשמציינים פרמטרים כמו זמן רענון וספי נתונים, מספקים לצרכנים את ההקשר הדרוש כדי להבין מתי הנתונים מתעדכנים ואם הם עומדים בדרישות העסקיות הספציפיות שלהם.

המסוף

  1. בחלונית הוספת פרטי חוזה והיבט, לוחצים על הוספת חוזה.

  2. בשדה Select contract, בוחרים באפשרות Refresh cadence.

  3. בשדה Frequency, בוחרים את התדירות המוסכמת לעדכון או לשליחת הנתונים, כדי להבטיח זרימה צפויה של נתונים מיצרן הנתונים לצרכן הנתונים. לדוגמה, Weekly.

  4. בשדה Refresh time, מזינים את הזמן המקסימלי הקביל בין עדכון הנתונים במקור לבין הזמן שבו הם זמינים לצרכן. לדוגמה, 23:00 PST.

  5. בשדה Threshold (in minutes), מזינים את מגבלת הזמן בדקות לעיכוב קביל בהעברת הנתונים. לדוגמה, מזינים 30 כדי להגדיר סף של 30 דקות.

  6. אופציונלי: בשדה Cron schedule, מזינים ביטוי cron שמגדיר את לוח הזמנים ליצירת הנתונים ולשליחה שלהם בפורמט: MINUTE HOUR DAY_OF_MONTH MONTH DAY_OF_WEEK

    אלה הערכים שאפשר להזין:

    • MINUTE: 0-59
    • HOUR: 0-23
    • DAY_OF_MONTH: 1-31
    • MONTH: ‏ 1-31 או JAN-DEC
    • DAY_OF_WEEK: ‏ 0-6 או SUN-SAT

    לדוגמה, 0 8 * * 1-5 פועל בשעה 8:00 בימי חול (שני עד שישי).

  7. לוחצים על Save.

REST

החוזים מיוצגים כהיבטים במוצר הנתונים. כדי להוסיף חוזה Refresh Cadence למוצר נתונים, משתמשים ב-method‏ entries.patch.

לדוגמה, שולחים את בקשת ה-PATCH הבאה:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d \
'{
  "aspects": {
    "dataplex-types.global.refresh-cadence": {
      "aspectType": "projects/dataplex-types/locations/global/aspectTypes/refresh-cadence",
      "data": {
        "frequency": "REFRESH_FREQUENCY"
      }
    }
  }
}' \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/DATA_PRODUCT_LOCATION/dataProducts/DATA_PRODUCT_ID?updateMask=aspects"

מחליפים את מה שכתוב בשדות הבאים:

  • REFRESH_FREQUENCY: לוח הזמנים המוסכם לעדכון או לשליחת הנתונים, כדי להבטיח זרימה צפויה של נתונים מיצרן הנתונים לצרכן הנתונים. לדוגמה: Weekly
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud שבו מתבצעת הקריאה ל-API
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_LOCATION: המיקום של המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים

Terraform

החוזים מיוצגים כהיבטים במוצר הנתונים. כדי לנהל חוזה, צריך לנהל את הרשומה הבסיסית ב-Knowledge Catalog. מכיוון ש-Terraform לא מגלה באופן אוטומטי היבטים קיימים, קודם צריך לייבא את google_dataplex_entry.

כדי לייבא את הרשומה, משתמשים בפקודה הבאה:

terraform import google_dataplex_entry.data_product_metadata "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"

הגדרות Terraform:

resource "google_dataplex_entry" "data_product_metadata" {
project        = "DATA_PRODUCT_PROJECT_NUMBER"
location       = "LOCATION"
entry_group_id = "@dataplex"
entry_id       = "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"
entry_type     = "projects/655216118709/locations/global/entryTypes/data-product"

aspects {
  aspect_key = "655216118709.global.refresh-cadence"
  aspect {
    data = jsonencode({
      frequency = "REFRESH_FREQUENCY"
    })
  }
}
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • ‫REFRESH_FREQUENCY: לוח הזמנים המוסכם לעדכון או לשליחת הנתונים, כדי להבטיח זרימה צפויה של נתונים מיצרן הנתונים לצרכן הנתונים. לדוגמה: Weekly

מידע כללי על תהליך הייבוא מופיע במסמכי התיעוד של Terraform בנושא ייבוא.

הוספת היבטים

אתם יכולים להשתמש בהיבטים כדי להעשיר את מוצר הנתונים במטא-נתונים מובְנים שניתן לעשות בהם שימוש חוזר. התבניות האלה מספקות דרך סטנדרטית שבה יוצרי הנתונים יכולים להעביר את האיכות וההתאמה של מוצר נתונים, לשפר את הפיקוח ולעזור לצרכנים לקבוע אם המוצר עונה על הצרכים העסקיים שלהם.

כדי להוסיף היבטים למוצר הנתונים:

המסוף

  1. בחלונית Add contract and aspect details, לוחצים על ‎+ Add aspect.

  2. בשדה Select aspect type, מחפשים ובוחרים סוג היבט מהרשימה. לדוגמה, Geo context.

  3. לוחצים על Save.

REST

כדי להוסיף היבטים למוצר נתונים, משתמשים ב-method‏ entries.patch.

לדוגמה, שולחים את בקשת ה-PATCH הבאה:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d \
'{
  "aspects": {
    "ASPECT_PROJECT_ID.ASPECT_LOCATION.ASPECT_NAME": {
      "aspectType": "projects/ASPECT_PROJECT_ID/locations/ASPECT_LOCATION/aspectTypes/ASPECT_NAME",
      "data": {}
    }
  }
}' \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/DATA_PRODUCT_LOCATION/dataProducts/DATA_PRODUCT_ID?updateMask=aspects"

מחליפים את מה שכתוב בשדות הבאים:

  • ‫ASPECT_PROJECT_ID: מזהה הפרויקט ב- Google Cloudשבו נוצר ההיבט
  • ‫ASPECT_LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שבו נוצר ההיבט (לדוגמה, us-central1)
  • ‫ASPECT_NAME: שם ההיבט שרוצים לצרף למוצר הנתונים
  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud שבו מתבצעת הקריאה ל-API
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_LOCATION: המיקום של המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים

Terraform

כדי לנהל היבטים, צריך לנהל את הרשומה הבסיסית ב-Knowledge Catalog. ‫Terraform לא מזהה באופן אוטומטי היבטים קיימים, לכן קודם צריך לייבא את google_dataplex_entry.

כדי לייבא את הרשומה, משתמשים בפקודה הבאה:

terraform import google_dataplex_entry.data_product_metadata "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"

הגדרות Terraform:

resource "google_dataplex_entry" "data_product_metadata" {
project        = "DATA_PRODUCT_PROJECT_NUMBER"
location       = "LOCATION"
entry_group_id = "@dataplex"
entry_id       = "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"
entry_type     = "projects/655216118709/locations/global/entryTypes/data-product"

aspects {
  aspect_key = "ASPECT_PROJECT_NUMBER.ASPECT_LOCATION.ASPECT_NAME"
  aspect {
    data = {}
  }
}
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • ‫ASPECT_PROJECT_NUMBER: Google Cloud מספר הפרויקט שבו נוצר ההיבט
  • ‫ASPECT_LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שבו נוצר ההיבט (לדוגמה, us-central1)
  • ‫ASPECT_NAME: שם ההיבט שרוצים לצרף למוצר הנתונים

מידע כללי על תהליך הייבוא מופיע במסמכי התיעוד של Terraform בנושא ייבוא.

אופציונלי: הוספת פרטים נוספים

אתם יכולים להוסיף מסמכים ושאילתות לדוגמה למוצר הנתונים כדי לספק הקשר חיוני, תיאורים של לוגיקה עסקית ומדריכים למשתמשים. ב-Knowledge Catalog, התיעוד מנוהל באמצעות ההיבט overview של המערכת.

אתם יכולים ליצור את התיעוד הזה באופן ידני או להשתמש בתובנות מנתונים של Knowledge Catalog כדי ליצור אותו באופן אוטומטי.

הוספה ידנית של מסמכים ושאילתות לדוגמה

המסוף

כדי להוסיף מסמכים למוצר הנתונים:

  1. בחלונית Add additional details, לוחצים על Edit ליד Documentation.

  2. מקלידים את התוכן בכלי לעריכת טקסט עשיר.

  3. לוחצים על Save.

כדי להוסיף שאילתות לדוגמה למוצר הנתונים:

  1. בחלונית Add additional details, לוחצים על Add queries בקטע Query recommendation.

  2. מקלידים את השאילתות לדוגמה.

  3. לוחצים על Save.

מוצר הנתונים החדש שנוצר מופיע בדף Data products ב-Knowledge Catalog.

REST

התיעוד מיוצג כהיבטים במוצר הנתונים. כדי להוסיף מסמכים, משתמשים ב-method‏ entries.patch.

לדוגמה, שולחים את בקשת ה-PATCH הבאה:

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d \
'{
  "aspects": {
    "dataplex-types.global.overview": {
      "aspectType": "projects/dataplex-types/locations/global/aspectTypes/overview",
      "data": {
        "content": "DOCUMENTATION"
      }
    }
  }
}' \
"https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/DATA_PRODUCT_LOCATION/dataProducts/DATA_PRODUCT_ID?updateMask=aspects"

מחליפים את מה שכתוב בשדות הבאים:

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud שבו מתבצעת הקריאה ל-API
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_LOCATION: המיקום של המשאב של מוצר הנתונים
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • DOCUMENTATION: התוכן שרוצים לצרף למוצר הנתונים

Terraform

התיעוד מיוצג כהיבטים במוצר הנתונים. כדי לנהל את התיעוד, צריך לנהל את הרשומה הבסיסית ב-Knowledge Catalog. מכיוון ש-Terraform לא מגלה באופן אוטומטי היבטים קיימים, קודם צריך לייבא את google_dataplex_entry.

כדי לייבא את הרשומה, משתמשים בפקודה הבאה:

terraform import google_dataplex_entry.data_product_metadata "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/entryGroups/@dataplex/entries/projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"

הגדרות Terraform:

resource "google_dataplex_entry" "data_product_metadata" {
project        = "DATA_PRODUCT_PROJECT_NUMBER"
location       = "LOCATION"
entry_group_id = "@dataplex"
entry_id       = "projects/DATA_PRODUCT_PROJECT_NUMBER/locations/LOCATION/dataProducts/DATA_PRODUCT_ID"
entry_type     = "projects/655216118709/locations/global/entryTypes/data-product"

aspects {
  aspect_key = "655216118709.global.overview"
  aspect {
    data = jsonencode({
      content = "DOCUMENTATION"
    })
  }
}
}

מחליפים את מה שכתוב בשדות הבאים:

  • ‫DATA_PRODUCT_PROJECT_NUMBER: מספר הפרויקט שבו נמצא המשאב של מוצר הנתונים
  • ‫LOCATION: האזור של נקודת הקצה של שירות Knowledge Catalog שאליו שולחים את הקריאה (לדוגמה, us-central1)
  • ‫DATA_PRODUCT_ID: המזהה של מוצר הנתונים
  • DOCUMENTATION: התוכן שרוצים לצרף למוצר הנתונים

מידע כללי על תהליך הייבוא מופיע במסמכי התיעוד של Terraform בנושא ייבוא.

יצירת תיעוד אוטומטי ושאילתות לדוגמה באמצעות תובנות מנתונים

לפני שיוצרים תיעוד ושאילתות לדוגמה באמצעות Gemini, צריך לבצע את הפעולות הבאות:

  1. מפעילים את Gemini for Google Cloud API בפרויקט שבו יוצרים את מוצר הנתונים.

  2. להקצות תפקידי משתמשים ספציפיים לתובנות: בקשו מהאדמין להקצות לזהות שלכם את התפקידים וההרשאות הבאים בפרויקט של מוצר הנתונים:

    • יצירה וניהול של תובנות מנתונים: Dataplex DataScan Editor‏ (roles/dataplex.dataScanEditor) או Dataplex DataScan Administrator‏ (roles/dataplex.dataScanAdmin) בפרויקט שבו נמצא מוצר הנתונים
    • צפייה בתובנות שנוצרו על ידי AI: Dataplex DataScan DataViewer (roles/dataplex.dataScanDataViewer) בפרויקט שבו נמצא מוצר הנתונים
  3. מגדירים את ההרשאות של סוכן השירות בפרויקטים שונים. אם נכסי הנתונים הבסיסיים נמצאים בפרויקט ב- Google Cloud שונה מהפרויקט של מוצר הנתונים, צריך לתת לסוכן השירות של Knowledge Catalog‏ (P4SA) גישה לנכסים האלה:

    1. כדי ליצור או לאחזר את המזהה של סוכן השירות לפרויקט של מוצר הנתונים, מריצים את הפקודה הבאה ב-Google Cloud CLI:

      gcloud beta services identity create --service=dataplex.googleapis.com --project=DATA_PRODUCT_PROJECT_ID
      

      מחליפים את DATA_PRODUCT_PROJECT_ID במזהה הפרויקט ב-Google Cloud שבו נמצא מוצר הנתונים.

    2. בכל פרויקט חיצוני שבו נמצאים הנכסים, מקצים לסוכן השירות של פרויקט מוצר הנתונים את התפקידים הבאים:

      • עריכת נתונים ב-BigQuery‏ (roles/bigquery.dataEditor) בטבלאות ובמערכי הנתונים הבסיסיים

      • אדמין של BigQuery Studio‏ (roles/bigquery.studioAdmin) בפרויקט של הנכס

כדי ליצור תיעוד ושאילתות לדוגמה למוצר הנתונים באמצעות תובנות מנתונים:

  1. בחלונית Add additional details, בסרגל Generate insights with Gemini, לוחצים על Generate.

    ממתינים כמה דקות עד שתהליך יצירת התובנות יסתיים.

  2. כדי לבדוק את התוכן שנוצר, לוחצים על הצגה.

  3. הערכת התוכן שנוצר:

    • אם התוכן מדויק, לוחצים על שמירה. הפעולה הזו מאכלסת את כלי לעריכת טקסט עשיר בתבנית מאמרי עזרה מוגדרת מראש ומוסיפה שאילתות לדוגמה לקטע Insights.

    • אם התוכן לא עומד בציפיות, לוחצים על מחיקה.

  4. לוחצים על שמירה כדי לסיים.

המאמרים הבאים