Auf dieser Seite wird beschrieben, wie Sie Glossare, Kategorien, Begriffe und Eintragslinks mithilfe der Dataplex API in Knowledge Catalog (früher Dataplex Universal Catalog) importieren. Mit diesem Verfahren können Sie Metadaten aus anderen Katalogisierungstools migrieren oder Ihre vorhandenen Glossare per Bulk-Update aktualisieren, indem Sie JSON-Dateien in Cloud Storage hochladen.
Hinweis
Bevor Sie mit dem Import beginnen, müssen Sie die folgenden Voraussetzungen erfüllen:
Cloud Storage-Bucket erstellen
Erstellen Sie einen Cloud Storage-Bucket, der als Stagingbereich für Importdateien dient.
Erforderliche Rollen
Bitten Sie Ihren Administrator, Ihnen die folgenden IAM-Rollen zuzuweisen, um die Berechtigungen zu erhalten, die Sie zum Importieren von Glossaren und Eintragslinks mit JSON-Dateien benötigen:
- Dataplex Metadata Editor (
roles/dataplex.metadataEditor) für das Projekt - Storage-Objekt-Betrachter (
roles/storage.objectViewer) für den Bucket mit Ihren Importdateien
Weitere Informationen zum Zuweisen von Rollen finden Sie unter Zugriff auf Projekte, Ordner und Organisationen verwalten.
Sie können die erforderlichen Berechtigungen auch über benutzerdefinierte Rollen oder andere vordefinierte Rollen erhalten.
APIs aktivieren
Wenn Sie Glossare und Eintragslinks importieren möchten, müssen Sie die Dataplex API in Ihrem Projekt aktivieren.
Rollen, die zum Aktivieren von APIs erforderlich sind
Zum Aktivieren von APIs benötigen Sie die IAM-Rolle „Service Usage-Administrator“ (roles/serviceusage.serviceUsageAdmin), die die Berechtigung serviceusage.services.enable enthält. Weitere Informationen zum Zuweisen von Rollen
Glossare mit JSON-Dateien importieren
Führen Sie die folgenden Aufgaben aus, um Glossare, Kategorien und Begriffe zu importieren.
Zielglossar erstellen
Erstellen Sie ein Zielglossar, in das Sie Metadaten importieren möchten.
alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"' gcurl -X POST https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/glossaries?glossary_id=GLOSSARY_ID -d "$(cat<<EOF { "displayName": "DISPLAY_NAME", "description": "DESCRIPTION" } EOF )"
Ersetzen Sie Folgendes:
PROJECT_ID: die Projekt-ID des Projekts, in dem Sie das Glossar erstellenLOCATION_ID: der Ort, an dem Sie das Glossar erstellen möchtenGLOSSARY_ID: die Glossar-IDDISPLAY_NAME: Der Anzeigename des GlossarsDESCRIPTION: die Beschreibung des Glossars
JSON-Dateien vorbereiten
Erstellen Sie eine durch Zeilenumbruch getrennte JSON-Datei mit dem Glossar, den Kategorien und den Begriffen, die Sie in den Cloud Storage-Bucket hochladen möchten.
Verwenden Sie das folgende JSON-Schema, um Ihre Importdateien zu strukturieren:
{"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-category","aspects":{"dataplex-types.global.glossary-category-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","displayName":"CATEGORY_NAME","description":"CATEGORY_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"}]}}} {"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM1_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-term","aspects":{"dataplex-types.global.glossary-term-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"TERM1_CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM1_ID","displayName":"TERM1_DISPLAY_NAME","description":"TERM1_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"},{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary-category"}]}}} {"entry":{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM2_ID","entryType":"projects/dataplex-types/locations/global/entryTypes/glossary-term","aspects":{"dataplex-types.global.glossary-term-aspect":{"data":{}},"dataplex-types.global.overview":{"data":{"content":"TERM1_CONTENT"}},"dataplex-types.global.contacts":{"data":{"identities":[{role: "steward", name: "CONTACT_DISPLAY_NAME", id: "CONTACT_EMAIL"}]}}},"parentEntry":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","entrySource":{"resource":"projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/terms/TERM2_ID","displayName":"TERM2_DISPLAY_NAME","description":"TERM2_DESCRIPTION","ancestors":[{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary"},{"name":"projects/PROJECT_NUMBER/locations/LOCATION_ID/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/LOCATION_ID/glossaries/GLOSSARY_ID/categories/CATEGORY_ID","type":"projects/dataplex-types/locations/global/entryTypes/glossary-category"}]}}}
Glossar, Kategorien und Begriffe importieren
Importieren Sie das Glossar, die Kategorien und die Begriffe in den Cloud Storage-Bucket:
# Set GCURL alias alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"' gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF { "type":"IMPORT", "import_spec":{ "log_level":"DEBUG", "source_storage_uri":"gs://STORAGE_BUCKET/", "entry_sync_mode":"FULL", "aspect_sync_mode":"INCREMENTAL", "scope":{ "glossaries": "GLOSSARY_NAME" } } } EOF )"
Ersetzen Sie DATAPLEX_API durch den Dataplex API-Endpunkt im Format dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID.
Eintraglinks mit JSON-Dateien importieren
Führen Sie die folgenden Aufgaben aus, um Einträge per Bulk-Import zu verknüpfen.
JSON-Dateien vorbereiten
Erstellen Sie eine durch Zeilenumbruch getrennte JSON-Datei mit den Eintragslinks, die Sie in den Cloud Storage-Bucket hochladen möchten.
Verwenden Sie das folgende JSON-Schema, um Ihre Importdateien zu strukturieren:
Beispielformat für Links zwischen Begriffen
{"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-0606e3f2-8206-4f3a-aba9-32c6196f6048","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/synonym","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-2"}]}} {"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-2f7408e3-af3d-405d-81bb-861cf9ec5146","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/related","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-2"}]}}
Beispielformat für Links zwischen Begriffen und Daten-Assets
{"entryLink":{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entryLinks/el-import-0606e3f2-8206-4f3a-aba9-32c6196f6048","entryLinkType":"projects/dataplex-types/locations/global/entryLinkTypes/definition","entryReferences":[{"name":"projects/PROJECT_NUMBER/locations/global/entryGroups/@dataplex/entries/projects/PROJECT_NUMBER/locations/global/glossaries/import-glossary/terms/term-1"},{"name":"projects/PROJECT_NUMBER/locations/us-central1/entryGroups/entry-group-1/entries/entry-1"}]}}
Links zwischen Begriffen als Synonyme oder ähnliche Begriffe importieren
Verwenden Sie den folgenden Befehl, um einen Metadaten-Importjob zu starten, mit dem synonym- oder related-Verbindungen zwischen Ihren Katalogbegriffen hergestellt werden:
gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF { "type":"IMPORT", "import_spec":{ "log_level":"DEBUG", "source_storage_uri":"gs://STORAGE_BUCKET/", "entry_sync_mode":"FULL", "aspect_sync_mode":"INCREMENTAL", "scope":{ "entry_groups":[ "projects/PROJECT_ID/locations/LOCATION_ID/entryGroups/@dataplex" ], "entry_link_types":[ "projects/dataplex-types/locations/global/entryLinkTypes/synonym", "projects/dataplex-types/locations/global/entryLinkTypes/related" ], "referenced_entry_scopes":[ "PROJECT_IDS" ] } } } EOF )"
Ersetzen Sie DATAPLEX_API durch dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID.
Links zwischen Begriffen und bestimmten Datenassets oder Spalten importieren
Wenn Sie eine Verknüpfung zwischen Glossarbegriffen und Datenassets erstellen möchten, führen Sie den Importjob für jede Eintragsgruppe aus, zu der der Eintrag für das Datenasset gehört. Alle Links zu Definitionseinträgen werden in dieser Eintragsgruppe erstellt.
gcurl https://DATAPLEX_API/metadataJobs?metadata_job_id=JOB_ID -d "$(cat<<EOF { "type":"IMPORT", "import_spec":{ "log_level":"DEBUG", "source_storage_uri":"gs://STORAGE_BUCKET/", "entry_sync_mode":"FULL", "aspect_sync_mode":"INCREMENTAL", "scope":{ "entry_groups":[ "projects/PROJECT_ID/locations/ENTRY_GROUP_LOCATION_ID/entryGroups/@dataplex" ], "entry_link_types":[ "projects/dataplex-types/locations/global/entryLinkTypes/definition" ], "referenced_entry_scopes":[ "PROJECT_IDS" ] } } } EOF )"
Ersetzen Sie DATAPLEX_API durch dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID.
Status des Importjobs überwachen
Führen Sie den folgenden Befehl aus, um den Status des Vorgangs
importabzurufen:gcurl https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/operations/operation-OPERATION_IDErsetzen Sie
OPERATION_IDdurch die ID des Vorgangs.Führen Sie den folgenden Befehl aus, um den Status des Metadatenjobs abzurufen:
gcurl -X GET https://dataplex.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/metadataJobs/JOB_ID
Nächste Schritte
- Informationen zum Verwalten von Unternehmensglossaren in Knowledge Catalog
- Informationen zum Importieren von Glossaren aus einer Google-Tabelle
- Weitere Informationen zur Metadatenverwaltung