סריקה לאיתור בעיות באיכות הנתונים

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

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

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

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

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

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

    להפעלת ה-API

  2. אופציונלי: אם רוצים ש-Knowledge Catalog ייצור המלצות לכללים של איכות הנתונים על סמך התוצאות של סריקת פרופיל הנתונים, יוצרים ומריצים את סריקת פרופיל הנתונים.

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

בקטע הזה מוסבר אילו תפקידים והרשאות ב-IAM נדרשים כדי להשתמש בסריקות של איכות הנתונים ב-Knowledge Catalog.

תפקידים והרשאות של משתמשים

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

  • מריצים סריקה של איכות הנתונים בטבלה ב-BigQuery:
    • BigQuery Job User ‏ (roles/bigquery.jobUser) בפרויקט, כדי להריץ משימות סריקה
    • BigQuery Data Viewer (roles/bigquery.dataViewer) בטבלה של BigQuery שרוצים לסרוק
  • פרסום תוצאות הסריקה של איכות הנתונים ב-Knowledge Catalog:
  • ביצוע משימות ספציפיות במשאבי DataScan:

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

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

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

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

  • הרצת סריקה של איכות הנתונים בטבלה ב-BigQuery:
    • ‫bigquery.jobs.create בפרויקט כדי להריץ משימות סריקה
    • bigquery.tables.get בטבלה ב-BigQuery שרוצים לסרוק
    • bigquery.tables.getData בטבלה ב-BigQuery שרוצים לסרוק
  • פרסום תוצאות הסריקה של איכות הנתונים ב-Knowledge Catalog:
    • bigquery.tables.update בטבלה שנסרקה
    • dataplex.entryGroups.useDataQualityScorecardAspect בקבוצת הרשומות @bigquery באותו מיקום של הטבלה
  • יצירת DataScan: dataplex.datascans.create בפרויקט
  • מחיקת DataScan: dataplex.datascans.delete בפרויקט
  • צפייה במטא-נתונים של DataScan: ‫dataplex.datascans.get בפרויקט
  • צפייה בפרטים של DataScan, כולל כללים ותוצאות: dataplex.datascans.getData בפרויקט
  • ‫DataScan בפרויקט: dataplex.datascans.list
  • הרצת DataScan: dataplex.datascans.run בפרויקט
  • עדכון של DataScan: dataplex.datascans.update בפרויקט
  • קבלת או הגדרת מדיניות IAM ב-DataScan:
    • dataplex.datascans.getIamPolicy בפרויקט
    • dataplex.datascans.setIamPolicy בפרויקט

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

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

תפקידים והרשאות של חשבון שירות ב-Knowledge Catalog

אם לא יצרתם סריקות של איכות נתונים או של סריקת פרופיל נתונים, או אם אין לכם מאגר נתונים של Knowledge Catalog בפרויקט הזה, אתם יכולים ליצור מזהה שירות באמצעות הפקודה הבאה: gcloud beta services identity create --service=dataplex.googleapis.com. הפקודה הזו מחזירה מזהה שירות של Knowledge Catalog, אם הוא קיים.

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

  • קריאת נתונים מטבלאות ב-BigQuery: BigQuery Data Viewer (roles/bigquery.dataViewer) בטבלאות שצריך לסרוק ובכל טבלה אחרת שמוזכרת בכללים
  • קריאת נתוני טבלאות של Google Cloud Lakehouse ב-Iceberg REST Catalog, ב-SAP Business Data Cloud Delta Lake וב-Apache Hive: BigLake Viewer (roles/biglake.viewer) בטבלאות הרלוונטיות לסריקה ובכל טבלה אחרת שמצוינת בכללים
  • ייצוא תוצאות הסריקה לטבלה ב-BigQuery: עריכת נתונים ב-BigQuery (roles/bigquery.dataEditor) במערך הנתונים ובטבלה של התוצאות
  • סריקת נתונים ב-BigQuery שמאורגנים ב-Knowledge Catalog Lake:
  • סריקת טבלה חיצונית של BigQuery מ-Cloud Storage: צפייה באובייקטים באחסון (roles/storage.objectViewer) בקטגוריה של Cloud Storage

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

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

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

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

  • קריאת נתונים מטבלה ב-BigQuery:
    • bigquery.tables.get בטבלאות ב-BigQuery
    • bigquery.tables.getData בטבלאות ב-BigQuery
  • ייצוא של תוצאות הסריקה לטבלה ב-BigQuery:
    • bigquery.datasets.get במערך הנתונים ובטבלה של התוצאות
    • bigquery.tables.create במערך הנתונים ובטבלה של התוצאות
    • bigquery.tables.get במערך הנתונים ובטבלה של התוצאות
    • bigquery.tables.getData במערך הנתונים ובטבלה של התוצאות
    • bigquery.tables.update במערך הנתונים ובטבלה של התוצאות
    • bigquery.tables.updateData במערך הנתונים ובטבלה של התוצאות
  • סריקת נתונים ב-BigQuery שמאורגנים ב-Knowledge Catalog Lake:
    • ‫dataplex.lakes.list במשאבי Dataplex
    • ‫dataplex.lakes.get במשאבי Dataplex
    • ‫dataplex.zones.list במשאבי Dataplex
    • ‫dataplex.zones.get במשאבי Dataplex
    • dataplex.entities.list במשאבי Dataplex
    • ‫dataplex.entities.get במשאבי Dataplex
    • dataplex.operations.get במשאבי Dataplex
  • סריקת טבלה חיצונית של BigQuery מ-Cloud Storage:
    • ‫storage.buckets.get בקטגוריה של Cloud Storage
    • ‫storage.objects.get בקטגוריה של Cloud Storage

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

אם אתם צריכים לגשת לעמודות שמוגנות על ידי מדיניות גישה ברמת העמודה ב-BigQuery, הקצו לחשבון השירות של Knowledge Catalog הרשאות לעמודות האלה.

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

יצירת סריקה של איכות הנתונים

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על יצירת סריקת איכות נתונים.

  3. בחלון Define scan, ממלאים את השדות הבאים:

    1. אופציונלי: מזינים שם לתצוגה.

    2. מזינים מזהה. מוסכמות למתן שמות למשאבים

    3. אופציונלי: מזינים תיאור.

    4. בשדה Table, לוחצים על Browse. בוחרים את הטבלה שרוצים לסרוק ולוחצים על Select. יש תמיכה רק בטבלאות של BigQuery,‏ Iceberg REST Catalog,‏ SAP BDC Delta ו-Hive ב- Google CloudLakehouse.

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

      כדי לעיין בטבלאות שמאורגנות ב-Knowledge Catalog, לוחצים על Browse within Knowledge Catalog Lakes.

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

      • אם בוחרים באפשרות מצטבר: בשדה עמודת חותמת זמן, בוחרים עמודה מסוג DATE או TIMESTAMP מהטבלה ב-BigQuery שגדלה ככל שנוספות רשומות חדשות, ושאפשר להשתמש בה כדי לזהות רשומות חדשות. זו יכולה להיות עמודה שמחלקת את הטבלה למחיצות.
    6. אופציונלי: כדי לסנן את הנתונים, מסמנים את התיבה סינון שורות. מציינים מסנן שורות שמורכב מביטוי SQL תקין, שאפשר להשתמש בו כחלק מסעיף WHERE בתחביר של GoogleSQL. לדוגמה, col1 >= 0. המסנן יכול להיות שילוב של כמה תנאים בעמודות. לדוגמה, col1 >= 0 AND col2 < 10.

    7. כדי לדגום את הנתונים, בוחרים אחוז דגימה ברשימה Sampling size. בוחרים ערך באחוזים בטווח שבין 0.0% ל-100.0% עם עד 3 ספרות אחרי הנקודה העשרונית. בקבוצות נתונים גדולות יותר, כדאי לבחור אחוז דגימה נמוך יותר. לדוגמה, בטבלה של 1 PB, אם תזינו ערך בין 0.1% ל-1.0%, סריקת איכות הנתונים תדגום בין 1 ל-10 TB של נתונים. בסריקות של נתונים מצטברים, סריקת איכות הנתונים מחילה דגימה על הנתונים המצטברים האחרונים.

    8. אופציונלי: כדי לפרסם את תוצאות הסריקה של איכות הנתונים כמטא-נתונים של Knowledge Catalog, מסמנים את התיבה Publish results to Knowledge Catalog.

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

    9. בקטע Credential type, קראו את המאמר הגדרת זהות ההפעלה.

    10. כדי ליצור סריקה של איכות הנתונים באמצעות כללים, בוחרים באפשרות Rule type > Create with entry based rule.

    11. בקטע תזמון, בוחרים אחת מהאפשרויות הבאות:

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

      • לפי דרישה: הפעלת סריקת איכות הנתונים לפי דרישה.

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

        • הגדרת מחיקה אוטומטית של תוצאות אחרי סריקה: משך הזמן בין ביצוע הסריקה לבין המחיקה שלה. סריקה של איכות הנתונים שלא צוין בה זמן מחיקה אוטומטית נמחקת באופן אוטומטי 24 שעות אחרי ההפעלה שלה. הזמן למחיקה אוטומטית יכול להיות בין 0 שניות (מחיקה מיידית) ל-365 ימים.
    12. לוחצים על Continue.

  4. בחלון Data quality rules, מגדירים את הכללים לסריקה הזו של איכות הנתונים.

    1. לוחצים על הוספת כללים ובוחרים מבין האפשרויות הבאות.

      • המלצות שמבוססות על פרופיל: יצירת כללים מההמלצות שמבוססות על סריקה קיימת של פרופיל נתונים.

        1. בחירת עמודות: בוחרים את העמודות שרוצים לקבל עבורן המלצות לכללים.

        2. ‫Choose scan project: אם סריקת פרופיל הנתונים נמצאת בפרויקט אחר מהפרויקט שבו אתם יוצרים את סריקת איכות הנתונים, בוחרים את הפרויקט שממנו רוצים לשלוף את סריקות הפרופיל.

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

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

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

        1. בחירת עמודות: בוחרים את העמודות שרוצים לבחור להן כללים.

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

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

      • כלל לבדיקת שורות ב-SQL: יוצרים כלל SQL בהתאמה אישית ומחילים אותו על כל שורה.

        1. בקטע מאפיין, בוחרים מאפיין אחד.

        2. בקטע Passing threshold, בוחרים את אחוז הרשומות שצריכות לעבור את הבדיקה.

        3. בשם העמודה, בוחרים עמודה.

        4. בשדה Provide a SQL expression, מזינים ביטוי SQL שמחזיר ערך בוליאני של true (עבר) או false (נכשל). למידע נוסף, קראו על סוגי כללי SQL נתמכים בהתאמה אישית ועיינו בדוגמאות שבמאמר הגדרת כללים לאיכות הנתונים.

        5. לוחצים על הוספה.

      • כלל בדיקה של צבירת SQL: יצירת כלל מותאם אישית לתנאי טבלה ב-SQL.

        1. בקטע מאפיין, בוחרים מאפיין אחד.

        2. בשם העמודה, בוחרים עמודה.

        3. בשדה Provide a SQL expression, מזינים ביטוי SQL שמחזיר ערך בוליאני של true (עבר) או false (נכשל). למידע נוסף, קראו על סוגי כללי SQL נתמכים בהתאמה אישית ועיינו בדוגמאות שבמאמר הגדרת כללים לאיכות הנתונים.

        4. לוחצים על הוספה.

      • כלל טענת נכוֹנוּת (assertion) ב-SQL: יוצרים כלל טענת נכוֹנוּת מותאם אישית ב-SQL כדי לבדוק אם יש מצב לא תקין של הנתונים.

        1. בקטע מאפיין, בוחרים מאפיין אחד.

        2. אופציונלי: בשדה שם העמודה, בוחרים עמודה.

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

        4. לוחצים על הוספה.

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

      • שם הכלל: מזינים שם לכלל בהתאמה אישית, באורך של עד 63 תווים. שם הכלל יכול לכלול אותיות (a-z,‏ A-Z), ספרות (0-9) ומקפים (-). הוא חייב להתחיל באות ולהסתיים בספרה או באות.
      • תיאור: מזינים תיאור של הכלל באורך של עד 1,024 תווים.
    3. חוזרים על השלבים הקודמים כדי להוסיף עוד כללים לסריקה של איכות הנתונים. כשמסיימים, לוחצים על המשך.

  5. אופציונלי: ייצוא של תוצאות הסריקה לטבלה רגילה ב-BigQuery. בקטע Export scan results to BigQuery table, מבצעים את הפעולות הבאות:

    1. בשדה Select BigQuery dataset, לוחצים על Browse. בוחרים מערך נתונים ב-BigQuery שבו יישמרו תוצאות הסריקה של איכות הנתונים.

    2. בשדה BigQuery table, מציינים את הטבלה ב-BigQuery שבה רוצים לשמור את תוצאות הסריקה של איכות הנתונים. אם אתם משתמשים בטבלה קיימת, ודאו שהיא תואמת לסכימת טבלת הייצוא. אם הטבלה שציינתם לא קיימת, היא תיווצר על ידי Knowledge Catalog.

  6. אופציונלי: מוסיפים תוויות. תוויות הן צמדי מפתח/ערך שמאפשרים לקשר בין אובייקטים או ביניהם לבין משאבים אחרים של Google Cloud .

  7. אופציונלי: מגדירים דוחות של התראות באימייל כדי לעדכן אנשים לגבי הסטטוס והתוצאות של משימת סריקה של איכות הנתונים. בקטע Notification report, לוחצים על Add email ID ומזינים עד חמש כתובות אימייל. אחר כך בוחרים את התרחישים שרוצים לשלוח עליהם דוחות:

    • ציון איכות (<=): שליחת דוח כשהמשימה מסתיימת בהצלחה עם ציון איכות נתונים נמוך יותר מציון היעד שצוין. מזינים ציון איכות בין 0 ל-100.
    • כשלים במשימות: שליחת דוח כשהמשימה עצמה נכשלת, בלי קשר לתוצאות של איכות הנתונים.
    • השלמת המשימה (הצלחה או כישלון): שליחת דוח כשהמשימה מסתיימת, בלי קשר לתוצאות של איכות הנתונים.
  8. לוחצים על יצירה.

    אחרי שיוצרים את הסריקה, אפשר להריץ אותה בכל שלב בלחיצה על Run now.

gcloud

כדי ליצור סריקה של איכות הנתונים, משתמשים בפקודה gcloud dataplex datascans create data-quality.

אם נתוני המקור מאורגנים ב-Knowledge Catalog lake, צריך לכלול את הדגל --data-source-entity:

gcloud dataplex datascans create data-quality DATASCAN \
    --location=LOCATION \
    --data-quality-spec-file=DATA_QUALITY_SPEC_FILE \
    --data-source-entity=DATA_SOURCE_ENTITY

אם נתוני המקור לא מאורגנים ב-Knowledge Catalog lake, צריך לכלול את הדגל --data-source-resource:

gcloud dataplex datascans create data-quality DATASCAN \
    --location=LOCATION \
    --data-quality-spec-file=DATA_QUALITY_SPEC_FILE \
    --data-source-resource=DATA_SOURCE_RESOURCE

מחליפים את המשתנים הבאים:

  • ‫DATASCAN: השם של סריקת איכות הנתונים.
  • ‫LOCATION: האזור ב- Google Cloud שבו רוצים ליצור את סריקת איכות הנתונים.
  • ‫DATA_QUALITY_SPEC_FILE: הנתיב לקובץ ה-JSON או ה-YAML שמכיל את המפרט של סריקת איכות הנתונים. הקובץ יכול להיות קובץ מקומי או נתיב של Cloud Storage עם הקידומת gs://. משתמשים בקובץ הזה כדי לציין את הכללים של איכות הנתונים לסריקה. אתם יכולים גם לציין פרטים נוספים בקובץ הזה, כמו מסננים, אחוז דגימה ופעולות לאחר הסריקה, כמו ייצוא ל-BigQuery או שליחת דוחות של התראות באימייל. אפשר לעיין במסמכי התיעוד של ייצוג JSON ובדוגמה לייצוג YAML.
  • ‫DATA_SOURCE_ENTITY: הישות ב-Knowledge Catalog שמכילה את הנתונים לסריקת איכות הנתונים. לדוגמה, projects/test-project/locations/test-location/lakes/test-lake/zones/test-zone/entities/test-entity.
  • ‫DATA_SOURCE_RESOURCE: שם המשאב שמכיל את הנתונים לסריקת איכות הנתונים. לדוגמה, //bigquery.googleapis.com/projects/test-project/datasets/test-dataset/tables/test-table.

C#‎

C#

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

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

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for CreateDataScan</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 CreateDataScanRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        CreateDataScanRequest request = new CreateDataScanRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            DataScan = new DataScan(),
            DataScanId = "",
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataScan, OperationMetadata> response = dataScanServiceClient.CreateDataScan(request);

        // Poll until the returned long-running operation is complete
        Operation<DataScan, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataScan 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<DataScan, OperationMetadata> retrievedResponse = dataScanServiceClient.PollOnceCreateDataScan(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataScan retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.CreateDataScanRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#CreateDataScanRequest.
	}
	op, err := c.CreateDataScan(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

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

import com.google.cloud.dataplex.v1.CreateDataScanRequest;
import com.google.cloud.dataplex.v1.DataScan;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.LocationName;

public class SyncCreateDataScan {

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

  public static void syncCreateDataScan() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      CreateDataScanRequest request =
          CreateDataScanRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setDataScan(DataScan.newBuilder().build())
              .setDataScanId("dataScanId1260787906")
              .setValidateOnly(true)
              .build();
      DataScan response = dataScanServiceClient.createDataScanAsync(request).get();
    }
  }
}

Node.js

Node.js

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

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **



'use strict';

function main(parent, dataScan) {
  /**
   * 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 resource name of the parent location:
   *  `projects/{project}/locations/{location_id}`
   *  where `project` refers to a *project_id* or *project_number* and
   *  `location_id` refers to a Google Cloud region.
   */
  // const parent = 'abc123'
  /**
   *  Required. DataScan resource.
   */
  // const dataScan = {}
  /**
   *  Optional. DataScan identifier. If not provided, a unique ID will be
   *  generated with the prefix "data-scan-".
   *  * Must contain only lowercase letters, numbers and hyphens.
   *  * Must start with a letter.
   *  * Must end with a number or a letter.
   *  * Must be between 1-63 characters.
   *  * Must be unique within the customer project / location.
   */
  // const dataScanId = 'abc123'
  /**
   *  Optional. Only validate the request, but do not perform mutations.
   *  The default is `false`.
   */
  // const validateOnly = true

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

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

  async function callCreateDataScan() {
    // Construct request
    const request = {
      parent,
      dataScan,
    };

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

  callCreateDataScan();
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));

Python

Python

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

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import google.api_core.exceptions
from google.cloud import dataplex_v1


def create_data_quality_scan_global(
    project_id: str,
    dataset_id: str,
    table_id: str,
    location: str,
    column_id_1: str,
    column_id_2: str,
) -> None:
    """Creates a Dataplex Data Quality Scan using global API endpoint routing.

    Args:
        project_id (str): Google Cloud project ID where the scan is created.
        dataset_id (str): Target BigQuery dataset ID.
        table_id (str): Target BigQuery table ID to scan.
        location (str): Google Cloud region where serverless compute runs.
        column_id_1 (str): Name of the first column to evaluate.
        column_id_2 (str): Name of the second column to evaluate.
    """
    client = dataplex_v1.DataScanServiceClient()

    parent = client.common_location_path(project=project_id, location=location)

    # A bigquery table with at least 2 columns is assumed.
    bigquery_table = (
        f"//bigquery.googleapis.com/projects/{project_id}"
        f"/datasets/{dataset_id}/tables/{table_id}"
    )

    data_quality_spec = dataplex_v1.DataQualitySpec(
        rules=[
            dataplex_v1.DataQualityRule(
                name="global-null-assertion",
                dimension="COMPLETENESS",
                description="Fails if any row contains a null value",
                sql_assertion=dataplex_v1.DataQualityRule.SqlAssertion(
                    # Use ${data()} as the placeholder for the table Dataplex is scanning
                    sql_statement=(
                        "SELECT * FROM ${data()} "
                        f"WHERE {column_id_1} IS NULL OR {column_id_2} IS NULL"
                    )
                ),
            )
        ]
    )

    data_scan = dataplex_v1.DataScan(
        display_name="Global Data Quality Scan",
        data=dataplex_v1.DataSource(resource=bigquery_table),
        data_quality_spec=data_quality_spec,
    )

    request = dataplex_v1.CreateDataScanRequest(parent=parent, data_scan=data_scan)

    try:
        operation = client.create_data_scan(request=request)
        print(operation.result())
    except google.api_core.exceptions.AlreadyExists:
        print("A scan with this ID already exists.")
    except google.api_core.exceptions.InvalidArgument as e:
        print(f"Your scan configuration is invalid: {e}")
    except google.api_core.exceptions.GoogleAPIError as e:
        print(f"Unexpected exception: {e}")

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the create_data_scan call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#create_data_scan.
#
def create_data_scan
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::CreateDataScanRequest.new

  # Call the create_data_scan method.
  result = client.create_data_scan request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

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

הבקשה הבאה יוצרת סריקה חד-פעמית של איכות הנתונים:

POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataScans?data_scan_id=DATASCAN_ID

{
"data": {
  "resource": "//bigquery.googleapis.com/projects/PROJECT_ID/datasets/DATASET_ID/tables/TABLE_ID"
},
"type": "DATA_QUALITY",
"executionSpec": {
  "trigger": {
    "oneTime": {
      "ttl_after_scan_completion": "120s"
    }
  }
},
"dataQualitySpec": {
  "rules": [
    {
      "nonNullExpectation": {},
      "column": "COLUMN_NAME",
      "dimension": "DIMENSION",
      "threshold": 1
    }
  ],
  "filter": "FILTER_CONDITION"
}
}

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

  • ‫PROJECT_ID: מזהה הפרויקט.
  • ‫LOCATION: האזור שבו רוצים ליצור את סריקת איכות הנתונים.
  • ‫DATASCAN_ID: המזהה של סריקת איכות הנתונים.
  • ‫DATASET_ID: המזהה של מערך הנתונים ב-BigQuery.
  • ‫TABLE_ID: המזהה של הטבלה ב-BigQuery.
  • ‫COLUMN_NAME: שם העמודה של הכלל.
  • ‫DIMENSION: המאפיין של הכלל, לדוגמה VALIDITY.
  • ‫FILTER_CONDITION: מחרוזת סינון אופציונלית של AIP-160 להרצה סלקטיבית של כללים (לדוגמה, name = \"RULE_NAME\").

אם אתם רוצים ליצור כללים לסריקת איכות הנתונים באמצעות המלצות לכללים שמבוססות על התוצאות של סריקת פרופיל הנתונים, אתם יכולים לקבל את ההמלצות על ידי קריאה ל-method dataScans.jobs.generateDataQualityRules בסריקת פרופיל הנתונים.

הפעלת סריקה של איכות הנתונים

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על הסריקה של איכות הנתונים שרוצים להריץ.

  3. לוחצים על הפעלה מיידית.

gcloud

כדי להריץ סריקה של איכות הנתונים, משתמשים בפקודה gcloud dataplex datascans run:

gcloud dataplex datascans run DATASCAN \
--location=LOCATION \

מחליפים את המשתנים הבאים:

  • ‫LOCATION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.
  • ‫DATASCAN: השם של סריקת איכות הנתונים.

C#‎

C#

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

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for RunDataScan</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 RunDataScanRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        RunDataScanRequest request = new RunDataScanRequest
        {
            DataScanName = DataScanName.FromProjectLocationDataScan("[PROJECT]", "[LOCATION]", "[DATASCAN]"),
        };
        // Make the request
        RunDataScanResponse response = dataScanServiceClient.RunDataScan(request);
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

Java

Java

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

import com.google.cloud.dataplex.v1.DataScanName;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.RunDataScanRequest;
import com.google.cloud.dataplex.v1.RunDataScanResponse;

public class SyncRunDataScan {

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

  public static void syncRunDataScan() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      RunDataScanRequest request =
          RunDataScanRequest.newBuilder()
              .setName(DataScanName.of("[PROJECT]", "[LOCATION]", "[DATASCAN]").toString())
              .build();
      RunDataScanResponse response = dataScanServiceClient.runDataScan(request);
    }
  }
}

Python

Python

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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_run_data_scan():
    # Create a client
    client = dataplex_v1.DataScanServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.RunDataScanRequest(
        name="name_value",
    )

    # Make the request
    response = client.run_data_scan(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the run_data_scan call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#run_data_scan.
#
def run_data_scan
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::RunDataScanRequest.new

  # Call the run_data_scan method.
  result = client.run_data_scan request

  # The returned object is of type Google::Cloud::Dataplex::V1::RunDataScanResponse.
  p result
end

REST

כדי להריץ סריקה של איכות הנתונים, משתמשים ב-method‏ dataScans.run.

Airflow

כדי להריץ סריקה של איכות הנתונים באמצעות גרף אציקלי מכוון (DAG) ב-Managed Service for Apache Airflow (Cloud Composer), משתמשים ב-DataplexRunDataQualityScanOperator:

from datetime import datetime
from airflow import DAG
from airflow.providers.google.cloud.operators.dataplex import DataplexRunDataQualityScanOperator

with DAG(
  "dataplex_auto_dq_scan",
  start_date=datetime(2026, 1, 1),
  schedule_interval="@daily",
  catchup=False,
) as dag:

  run_dq_scan = DataplexRunDataQualityScanOperator(
      task_id="run_dataplex_dq_scan",
      project_id="PROJECT_ID",
      region="REGION",
      data_scan_id="DATASCAN_ID",
  )

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

  • ‫PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
  • ‫REGION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.
  • ‫DATASCAN_ID: המזהה של סריקת איכות הנתונים.

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

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על השם של סריקת איכות הנתונים.

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

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

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

gcloud

כדי לראות את התוצאות של משימת סריקה של איכות הנתונים, משתמשים בפקודה gcloud dataplex datascans jobs describe:

gcloud dataplex datascans jobs describe JOB \
--location=LOCATION \
--datascan=DATASCAN \
--view=FULL

מחליפים את המשתנים הבאים:

  • ‫JOB: מזהה המשימה של סריקת איכות הנתונים.
  • ‫LOCATION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.
  • ‫DATASCAN: השם של סריקת איכות הנתונים שאליה שייכת המשימה.
  • ‫--view=FULL: כדי לראות את התוצאה של משימת הסריקה, מציינים את FULL.

C#‎

C#

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

using Google.Cloud.Dataplex.V1;

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for GetDataScan</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 GetDataScanRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        GetDataScanRequest request = new GetDataScanRequest
        {
            DataScanName = DataScanName.FromProjectLocationDataScan("[PROJECT]", "[LOCATION]", "[DATASCAN]"),
            View = GetDataScanRequest.Types.DataScanView.Unspecified,
        };
        // Make the request
        DataScan response = dataScanServiceClient.GetDataScan(request);
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

Java

Java

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

import com.google.cloud.dataplex.v1.DataScan;
import com.google.cloud.dataplex.v1.DataScanName;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.GetDataScanRequest;

public class SyncGetDataScan {

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

  public static void syncGetDataScan() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      GetDataScanRequest request =
          GetDataScanRequest.newBuilder()
              .setName(DataScanName.of("[PROJECT]", "[LOCATION]", "[DATASCAN]").toString())
              .build();
      DataScan response = dataScanServiceClient.getDataScan(request);
    }
  }
}

Python

Python

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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_get_data_scan():
    # Create a client
    client = dataplex_v1.DataScanServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.GetDataScanRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_data_scan(request=request)

    # Handle the response
    print(response)

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the get_data_scan call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#get_data_scan.
#
def get_data_scan
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::GetDataScanRequest.new

  # Call the get_data_scan method.
  result = client.get_data_scan request

  # The returned object is of type Google::Cloud::Dataplex::V1::DataScan.
  p result
end

REST

כדי לראות את התוצאות של סריקת איכות הנתונים, משתמשים בשיטה dataScans.get.

הצגת התוצאות שפורסמו

אם התוצאות של סריקת איכות הנתונים מתפרסמות כמטא-נתונים של Knowledge Catalog, אתם יכולים לראות את תוצאות הסריקה האחרונות בדפים של BigQuery ו-Knowledge Catalog במסוףGoogle Cloud , בכרטיסייה Data quality של טבלת המקור.

  1. נכנסים לדף BigQuery במסוף Google Cloud .

    כניסה ל-BigQuery

  2. בחלונית השמאלית, לוחצים על Explorer:

    כפתור מודגש לחלונית Explorer.

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

  3. בחלונית Explorer, לוחצים על Datasets ואז על מערך הנתונים.

  4. לוחצים על Overview > Tables ובוחרים את הטבלה שרוצים לראות את תוצאות סריקת איכות הנתונים שלה.

  5. לוחצים על הכרטיסייה איכות הנתונים.

    התוצאות האחרונות שפורסמו מוצגות.

צפייה בתוצאות של סריקות קודמות

ב-Knowledge Catalog נשמרת היסטוריית סריקות איכות הנתונים של 300 המשימות האחרונות או של השנה האחרונה, המוקדם מביניהם.

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על השם של סריקת איכות הנתונים.

  3. לוחצים על הכרטיסייה Jobs history.

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

  4. כדי לראות מידע מפורט על משימה, לוחצים על אחת מהמשימות בעמודה Job ID.

gcloud

כדי לראות את המשימות ההיסטוריות של סריקת איכות הנתונים, משתמשים בפקודה gcloud dataplex datascans jobs list:

gcloud dataplex datascans jobs list \
--location=LOCATION \
--datascan=DATASCAN \

מחליפים את המשתנים הבאים:

  • ‫LOCATION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.
  • ‫DATASCAN: השם של סריקת איכות הנתונים שרוצים לראות את המשימות ההיסטוריות שלה.

C#‎

C#

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

using Google.Api.Gax;
using Google.Cloud.Dataplex.V1;
using System;

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for ListDataScanJobs</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 ListDataScanJobsRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        ListDataScanJobsRequest request = new ListDataScanJobsRequest
        {
            ParentAsDataScanName = DataScanName.FromProjectLocationDataScan("[PROJECT]", "[LOCATION]", "[DATASCAN]"),
            Filter = "",
        };
        // Make the request
        PagedEnumerable<ListDataScanJobsResponse, DataScanJob> response = dataScanServiceClient.ListDataScanJobs(request);

        // Iterate over all response items, lazily performing RPCs as required
        foreach (DataScanJob item in response)
        {
            // Do something with each item
            Console.WriteLine(item);
        }

        // Or iterate over pages (of server-defined size), performing one RPC per page
        foreach (ListDataScanJobsResponse page in response.AsRawResponses())
        {
            // Do something with each page of items
            Console.WriteLine("A page of results:");
            foreach (DataScanJob item in page)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
        }

        // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
        int pageSize = 10;
        Page<DataScanJob> singlePage = response.ReadPage(pageSize);
        // Do something with the page of items
        Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
        foreach (DataScanJob item in singlePage)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
        // Store the pageToken, for when the next page is required.
        string nextPageToken = singlePage.NextPageToken;
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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"
	"google.golang.org/api/iterator"
)

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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.ListDataScanJobsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#ListDataScanJobsRequest.
	}
	it := c.ListDataScanJobs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*dataplexpb.ListDataScanJobsResponse)
	}
}

Java

Java

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

import com.google.cloud.dataplex.v1.DataScanJob;
import com.google.cloud.dataplex.v1.DataScanName;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.ListDataScanJobsRequest;

public class SyncListDataScanJobs {

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

  public static void syncListDataScanJobs() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      ListDataScanJobsRequest request =
          ListDataScanJobsRequest.newBuilder()
              .setParent(DataScanName.of("[PROJECT]", "[LOCATION]", "[DATASCAN]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .build();
      for (DataScanJob element : dataScanServiceClient.listDataScanJobs(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}

Python

Python

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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_list_data_scan_jobs():
    # Create a client
    client = dataplex_v1.DataScanServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.ListDataScanJobsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_data_scan_jobs(request=request)

    # Handle the response
    for response in page_result:
        print(response)

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the list_data_scan_jobs call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#list_data_scan_jobs.
#
def list_data_scan_jobs
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::ListDataScanJobsRequest.new

  # Call the list_data_scan_jobs method.
  result = client.list_data_scan_jobs request

  # The returned object is of type Gapic::PagedEnumerable. You can iterate
  # over elements, and API calls will be issued to fetch pages as needed.
  result.each do |item|
    # Each element is of type ::Google::Cloud::Dataplex::V1::DataScanJob.
    p item
  end
end

REST

כדי לראות משימות קודמות של סריקות לאיכות הנתונים, משתמשים ב-method dataScans.jobs.list.

סטטוסים של משימות

אלה הסטטוסים האפשריים של משימות סריקת נתונים:

  • ‫PENDING: המשימה נוצרה אבל עדיין לא התחילה לפעול. במצב הזה, הסריקה מגדירה באופן פעיל תשתית או רוכשת משבצות. השלב הזה יכול להימשך בין 10 ל-20 שניות או יותר, בהתאם למורכבות הסכימה ולתחרות על המשאבים.

  • ‫RUNNING: המשימה פועלת.

  • ‫CANCELING: המשימה בתהליך ביטול.

  • ‫CANCELLED: המשימה בוטלה.

  • ‫SUCCEEDED: המשימה הושלמה בהצלחה. סטטוס ההשלמה עשוי להופיע באיחור של עד 60 שניות מההשלמה בפועל של השאילתה, בגלל שלבים של עיבוד לאחר השאילתה, כמו צבירה וסנכרון מטא-נתונים.

  • ‫FAILED: המשימה נכשלה בגלל שגיאה. סטטוס ההשלמה עשוי להופיע באיחור של עד 60 שניות מההשלמה בפועל של השאילתה, בגלל שלבים של עיבוד לאחר השאילתה, כמו צבירה וסנכרון מטא-נתונים.

  • ‫SUCCEEDED_WITH_ERRORS: המשימה הושלמה, אבל היו כמה שגיאות במהלך הביצוע.

שיטות מומלצות למעקב

כשאתם עוקבים אחרי משימות סריקת הנתונים, חשוב לזכור את השיטות המומלצות הבאות:

  • הימנעו מסקרים אגרסיביים: הימנעו מסקרים אגרסיביים (לדוגמה, קריאה ל-GetJob או לפונקציה מקבילה כל 1 עד 5 שניות). דגימה אגרסיבית מבזבזת את מכסת ה-API ולא מאיצה את מעברי המצבים.

  • שימוש בהשהיה מעריכית לפני ניסיון חוזר (exponential backoff): אם אי אפשר להימנע מדגימה חוזרת, צריך להשתמש בהשהיה מעריכית לפני ניסיון חוזר (exponential backoff) שמתחילה ב-10 עד 15 שניות.

  • שימוש בהפרדה אסינכרונית מבוססת-אירועים (מומלץ): במקום דגימת API סינכרונית, משתמשים בטריגרים של Eventarc שמאזינים ליומני הביקורת של Cloud (cloudaudit.googleapis.com). אפשר להשתמש בטריגרים האלה כדי להתחיל תהליכי עבודה במורד הזרם מיד אחרי אירועי השלמת המשימות של DataScan. הגישה הזו עוקפת את מגבלות הסקרים של ה-API, חוסכת במכסות ומפחיתה את זמן האחזור.

מתן גישה לתוצאות של סריקת איכות הנתונים

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

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על סריקת איכות הנתונים שרוצים לשתף את התוצאות שלה.

  3. לוחצים על הכרטיסייה Permissions.

  4. מבצעים את הפעולות הבאות:

    • כדי לתת גישה לחשבון משתמש, לוחצים על Grant access. מקצים את התפקיד Dataplex DataScan DataViewer לחשבון המשתמש המשויך.
    • כדי להסיר את הגישה מחשבון משתמש, בוחרים את החשבון שרוצים להסיר ממנו את התפקיד Dataplex DataScan DataViewer. לוחצים על הסרת הגישה ומאשרים את הפעולה.

פתרון בעיות שקשורות לאיכות הנתונים

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

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

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

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

  3. לוחצים על הכרטיסייה Jobs history.

  4. לוחצים על מזהה המשימה שבה זוהו כשלים באיכות הנתונים.

  5. בחלון תוצאות המשימה שנפתח, בקטע Rules, מאתרים את העמודה Query to get failed records. לוחצים על Copy query to clipboard בכלל שנכשל.

  6. מריצים את השאילתה ב-BigQuery כדי לראות את הרשומות שגרמו למשימה להיכשל.

gcloud

לא נתמך.

REST

  1. כדי לקבל את המשימה שזיהתה את הכשלים באיכות הנתונים, משתמשים ב-method‏ dataScans.get.

    באובייקט התגובה, השאילתה מופיעה בשדה failingRowsQuery.

  2. מריצים את השאילתה ב-BigQuery כדי לראות את הרשומות שגרמו למשימה להיכשל.

ב-Knowledge Catalog מופעלת גם שאילתת ניפוי הבאגים, בתנאי שהיא נכללה במהלך יצירת הכלל. תוצאות השאילתה לניפוי באגים נכללות בפלט של כל כלל. התכונה הזו נמצאת בגרסת טרום-השקה (Preview).

המסוף

לא נתמך.

gcloud

לא נתמך.

REST

כדי לקבל את המשימה שזיהתה את הכשלים באיכות הנתונים, משתמשים ב-method‏ dataScans.get. באובייקט התגובה, השדה debugQueriesResultSets מציג את התוצאות של שאילתות ניפוי הבאגים.

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

במאמר הזה מוסבר איך לנהל את הסריקות של איכות הנתונים בפרויקט באמצעות הדף Metadata curation > Data profiling & quality של BigQuery במסוףGoogle Cloud .

אתם יכולים גם ליצור ולנהל סריקות של איכות הנתונים כשאתם עובדים עם טבלה ספציפית. במסוף Google Cloud , בדף BigQuery של הטבלה, משתמשים בכרטיסייה איכות הנתונים. מבצעים את הפעולות הבאות:

  1. נכנסים לדף BigQuery במסוף Google Cloud .

    כניסה לדף BigQuery

    בחלונית Explorer (בחלונית הימנית), לוחצים על Datasets ואז על מערך הנתונים שלכם. לוחצים על Overview > Tables ובוחרים את הטבלה שרוצים לראות את תוצאות סריקת איכות הנתונים שלה.

  2. לוחצים על הכרטיסייה איכות הנתונים.

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

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

      כדי לנהל את סריקות איכות הנתונים של הטבלה, לוחצים על Data quality scan ובוחרים אחת מהאפשרויות הבאות:

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

      • הפעלה מיידית: הפעלת הסריקה.

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

        כדי לערוך את הכללים של איכות הנתונים, בכרטיסייה Data quality לוחצים על הכרטיסייה Rules. לוחצים על שינוי כללים. מעדכנים את הכללים ולוחצים על שמירה.

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

      • ‫View historical results: הצגת מידע מפורט על משימות קודמות של סריקת איכות הנתונים. מידע נוסף זמין בקטעים הצגת תוצאות של סריקות לאיכות הנתונים והצגת תוצאות של סריקות היסטוריות במסמך הזה.

      • ‫View all scans: הצגת רשימה של סריקות איכות הנתונים שחלות על הטבלה הזו.

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

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

      • thought ‫View existing scans: הצגת רשימה של סריקות איכות הנתונים שחלות על הטבלה הזו.

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

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

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לסנן את הרשימה לפי שם הטבלה וסוג הסריקה.

עדכון סריקה של איכות הנתונים

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

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על השם של סריקת איכות הנתונים.

  3. כדי לערוך את ההגדרות, כולל השם המוצג, המסננים ולוח הזמנים, לוחצים על Edit. עורכים את הערכים ולוחצים על שמירה.

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

gcloud

כדי לעדכן את התיאור של סריקת איכות נתונים, משתמשים בפקודה gcloud dataplex datascans update data-quality:

gcloud dataplex datascans update data-quality DATASCAN \
--location=LOCATION \
--description=DESCRIPTION

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

  • ‫DATASCAN: השם של סריקת איכות הנתונים שרוצים לעדכן.
  • ‫LOCATION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.
  • ‫DESCRIPTION: התיאור החדש של סריקת איכות הנתונים.

C#‎

C#

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

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

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for UpdateDataScan</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 UpdateDataScanRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        UpdateDataScanRequest request = new UpdateDataScanRequest
        {
            DataScan = new DataScan(),
            UpdateMask = new FieldMask(),
            ValidateOnly = false,
        };
        // Make the request
        Operation<DataScan, OperationMetadata> response = dataScanServiceClient.UpdateDataScan(request);

        // Poll until the returned long-running operation is complete
        Operation<DataScan, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        DataScan 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<DataScan, OperationMetadata> retrievedResponse = dataScanServiceClient.PollOnceUpdateDataScan(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            DataScan retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataplexpb.UpdateDataScanRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dataplex/apiv1/dataplexpb#UpdateDataScanRequest.
	}
	op, err := c.UpdateDataScan(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

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

import com.google.cloud.dataplex.v1.DataScan;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.UpdateDataScanRequest;
import com.google.protobuf.FieldMask;

public class SyncUpdateDataScan {

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

  public static void syncUpdateDataScan() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      UpdateDataScanRequest request =
          UpdateDataScanRequest.newBuilder()
              .setDataScan(DataScan.newBuilder().build())
              .setUpdateMask(FieldMask.newBuilder().build())
              .setValidateOnly(true)
              .build();
      DataScan response = dataScanServiceClient.updateDataScanAsync(request).get();
    }
  }
}

Python

Python

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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_scan():
    # Create a client
    client = dataplex_v1.DataScanServiceClient()

    # Initialize request argument(s)
    data_scan = dataplex_v1.DataScan()
    data_scan.data.entity = "entity_value"

    request = dataplex_v1.UpdateDataScanRequest(
        data_scan=data_scan,
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the update_data_scan call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#update_data_scan.
#
def update_data_scan
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::UpdateDataScanRequest.new

  # Call the update_data_scan method.
  result = client.update_data_scan request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

כדי לערוך סריקה של איכות הנתונים, משתמשים ב-method ‏dataScans.patch.

מחיקת סריקה של איכות הנתונים

המסוף

המסוף

  1. במסוף Google Cloud , בדף Metadata curation של BigQuery, נכנסים לכרטיסייה Data profiling & quality.

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

  2. לוחצים על הסריקה שרוצים למחוק.

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

gcloud

gcloud

כדי למחוק סריקה של איכות הנתונים, משתמשים בפקודה gcloud dataplex datascans delete:

gcloud dataplex datascans delete DATASCAN \
--location=LOCATION \
--async

מחליפים את המשתנים הבאים:

  • ‫DATASCAN: השם של סריקת איכות הנתונים שרוצים למחוק.
  • ‫LOCATION: האזור ב- Google Cloud שבו נוצרה סריקת איכות הנתונים.

C#‎

C#

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

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

public sealed partial class GeneratedDataScanServiceClientSnippets
{
    /// <summary>Snippet for DeleteDataScan</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 DeleteDataScanRequestObject()
    {
        // Create client
        DataScanServiceClient dataScanServiceClient = DataScanServiceClient.Create();
        // Initialize request argument(s)
        DeleteDataScanRequest request = new DeleteDataScanRequest
        {
            DataScanName = DataScanName.FromProjectLocationDataScan("[PROJECT]", "[LOCATION]", "[DATASCAN]"),
            Force = false,
        };
        // Make the request
        Operation<Empty, OperationMetadata> response = dataScanServiceClient.DeleteDataScan(request);

        // Poll until the returned long-running operation is complete
        Operation<Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
        // Retrieve the operation result
        Empty 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<Empty, OperationMetadata> retrievedResponse = dataScanServiceClient.PollOnceDeleteDataScan(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Empty retrievedResult = retrievedResponse.Result;
        }
    }
}

המשך

Go

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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.NewDataScanClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

Java

Java

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

import com.google.cloud.dataplex.v1.DataScanName;
import com.google.cloud.dataplex.v1.DataScanServiceClient;
import com.google.cloud.dataplex.v1.DeleteDataScanRequest;
import com.google.protobuf.Empty;

public class SyncDeleteDataScan {

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

  public static void syncDeleteDataScan() 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 (DataScanServiceClient dataScanServiceClient = DataScanServiceClient.create()) {
      DeleteDataScanRequest request =
          DeleteDataScanRequest.newBuilder()
              .setName(DataScanName.of("[PROJECT]", "[LOCATION]", "[DATASCAN]").toString())
              .setForce(true)
              .build();
      dataScanServiceClient.deleteDataScanAsync(request).get();
    }
  }
}

Python

Python

כדי לבצע אימות ב-BigQuery, צריך להגדיר את 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_delete_data_scan():
    # Create a client
    client = dataplex_v1.DataScanServiceClient()

    # Initialize request argument(s)
    request = dataplex_v1.DeleteDataScanRequest(
        name="name_value",
    )

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

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

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Ruby

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

require "google/cloud/dataplex/v1"

##
# Snippet for the delete_data_scan call in the DataScanService service
#
# 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/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Dataplex::V1::DataScanService::Client#delete_data_scan.
#
def delete_data_scan
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Dataplex::V1::DataScanService::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Dataplex::V1::DeleteDataScanRequest.new

  # Call the delete_data_scan method.
  result = client.delete_data_scan request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

REST

REST

כדי למחוק סריקה של איכות הנתונים, משתמשים בשיטה dataScans.delete.

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