Anda dapat mengaktifkan atau menonaktifkan penyerapan silsilah secara selektif untuk integrasi tertentu di tingkat project, folder, atau organisasi.
Untuk mengetahui informasi selengkapnya tentang integrasi dan skenario konfigurasi yang didukung, lihat Mengontrol penyerapan silsilah data.
Prasyarat
Untuk mengontrol penyerapan silsilah, Anda harus menggunakan Data Lineage API. Pastikan Anda telah mengonfigurasi project klien untuk penagihan dan kuota, karena Data Lineage API adalah API berbasis klien.
Peran dan izin
Untuk mendapatkan izin yang Anda perlukan guna mengonfigurasi dan mengontrol penyerapan silsilah data, minta administrator Anda untuk memberi Anda peran Identity and Access Management (IAM) berikut:
Untuk mendapatkan izin yang Anda perlukan untuk mengonfigurasi dan mengontrol penyerapan silsilah data, minta administrator Anda untuk memberi Anda peran IAM berikut di project Anda:
-
Mengonfigurasi dan mengelola silsilah data:
Administrator Silsilah Data (
roles/datalineage.admin)
Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi izin yang diperlukan untuk mengonfigurasi dan mengontrol penyerapan silsilah data. Untuk melihat izin yang benar-benar diperlukan, perluas bagian Izin yang diperlukan:
Izin yang diperlukan
Izin berikut diperlukan untuk mengonfigurasi dan mengontrol penyerapan silsilah data:
-
Mendapatkan dan memperbarui konfigurasi silsilah:
-
datalineage.configs.get -
datalineage.configs.update
-
Anda mungkin juga bisa mendapatkan izin ini dengan peran khusus atau peran bawaan lainnya.
Aktifkan
datalineage.googleapis.comAPI di project klien Anda. Untuk mengetahui informasi selengkapnya, lihat Mengaktifkan silsilah data.Tetapkan project klien. Untuk contoh berikut, gunakan header
X-Goog-User-Project. Untuk mengetahui informasi selengkapnya, lihat Parameter sistem.
Mendapatkan konfigurasi saat ini
Untuk memeriksa apakah penyerapan silsilah diaktifkan untuk resource atau untuk mendapatkan nilai etag sebelum Anda mengubah konfigurasi, ambil konfigurasi saat ini.
C#
C#
Sebelum mencoba contoh ini, ikuti petunjuk penyiapan C# di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog C# API.
Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.
Go
Go
Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Go di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Go API.
Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.
Java
Java
Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Java di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Java API.
Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.
Python
Python
Sebelum mencoba contoh ini, ikuti petunjuk penyiapan Python di Panduan memulai Knowledge Catalog menggunakan library klien. Untuk mengetahui informasi selengkapnya, lihat dokumentasi referensi Knowledge Catalog Python API.
Untuk melakukan autentikasi ke Knowledge Catalog, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan autentikasi untuk lingkungan pengembangan lokal.
gcloud
Untuk melihat konfigurasi silsilah saat ini, gunakan perintah
gcloud datalineage config describe. Anda dapat mengambil konfigurasi untuk project, folder, atau organisasi.
Contoh berikut menunjukkan cara mendapatkan konfigurasi untuk project saat ini:
gcloud datalineage config describe
Misalnya, untuk mendapatkan konfigurasi project tertentu, gunakan
flag --project:
gcloud datalineage config describe --project=PROJECT_ID
Ganti kode berikut:
PROJECT_ID: ID project yang konfigurasinya ingin Anda lihat.
Untuk melihat konfigurasi penyerapan silsilah saat ini dari layanan untuk folder atau organisasi, ganti --project= dengan salah satu opsi berikut:PROJECT_ID
--folder=jika Anda ingin melihat setelan penyerapan data untuk folder.FOLDER_ID--organization=jika Anda ingin melihat setelan penyerapan data untuk organisasi.ORGANIZATION_ID
REST
Untuk melihat konfigurasi silsilah saat ini, gunakan metode
projects.locations.config.get. Anda dapat mengambil konfigurasi untuk project, folder, atau organisasi.
Contoh berikut menunjukkan cara mendapatkan konfigurasi untuk project:
Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:
CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.PROJECT_ID: ID project yang konfigurasinya ingin Anda lihat.
Metode HTTP dan URL:
GET https://datalineage.googleapis.com/v1/projects/PROJECT_ID/locations/global/config
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
Perintah akan menampilkan salah satu output berikut:
- Jika Anda tidak memberikan setelan penyerapan silsilah apa pun, Anda akan mendapatkan output dengan objek
ingestionkosong:{ "name": "projects/123456789012/locations/global/config", "ingestion": {} }
Artinya, layanan menggunakan setelan penyerapan silsilah default. Dalam contoh ini, setelan penyerapan silsilah untuk Managed Service untuk Apache Spark adalah
enabled. - Jika Anda mengaktifkan penyerapan silsilah secara eksplisit, Anda akan mendapatkan
output berikut:
{ "name": "projects/123456789012/locations/global/config", "ingestion": { "rules": [ { "integrationSelector": { "integration": "DATAPROC" }, "lineageEnablement": { "enabled": true } } ] }, "etag": "1a2b3c4d5e" }
- Jika penyerapan silsilah dinonaktifkan, Anda akan mendapatkan output berikut:
{ "name": "projects/123456789012/locations/global/config", "ingestion": { "rules": [ { "integrationSelector": { "integration": "DATAPROC" }, "lineageEnablement": { "enabled": false } } ] }, "etag": "1a2b3c4d5e" }
Untuk mendapatkan konfigurasi folder atau organisasi, ganti
projects/ dengan "PROJECT_IDfolders/ atau FOLDER_IDorganizations/.ORGANIZATION_ID
Kolom etag dalam respons adalah checksum yang dihasilkan oleh server berdasarkan nilai konfigurasi saat ini. Saat memperbarui konfigurasi menggunakan metode patch, Anda dapat menyertakan nilai etag yang ditampilkan dari permintaan get baru-baru ini dalam isi permintaan. Jika Anda memberikan etag,
Knowledge Catalog akan menggunakannya untuk memverifikasi bahwa konfigurasi tidak berubah
sejak permintaan baca terakhir Anda. Jika ada ketidakcocokan, permintaan update akan gagal. Hal ini mencegah Anda secara tidak sengaja menimpa konfigurasi yang dibuat oleh pengguna lain dalam skenario baca-ubah-tulis. Jika Anda tidak memberikan etag
dalam permintaan patch, Knowledge Catalog akan mengganti konfigurasi
tanpa syarat.
Menonaktifkan penyerapan silsilah untuk layanan
Untuk mengelola biaya, menerapkan kebijakan tata kelola data, atau mengecualikan project pengembangan dan beban kerja lainnya yang tidak mendapatkan manfaat dari pelacakan asal-usul, nonaktifkan penyerapan asal-usul untuk layanan.
Java
package com.google.cloud.datacatalog.lineage.configmanagement.v1.samples;
import com.google.api.gax.rpc.NotFoundException;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.IntegrationSelector;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.LineageEnablement;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.ConfigManagementServiceClient;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.ConfigName;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.GetConfigRequest;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.UpdateConfigRequest;
public class DisableLineageIngestion {
public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-project-id";
String location = "global";
disableLineageIngestion(projectId, location);
}
// Disables lineage ingestion for a specific service
// (Managed Service for Apache Spark).
public static void disableLineageIngestion(String projectId, String location) throws Exception {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (ConfigManagementServiceClient client = ConfigManagementServiceClient.create()) {
// Format the resource name.
String name = ConfigName.ofProjectLocationName(projectId, location).toString();
Config.Builder configBuilder = Config.newBuilder().setName(name);
// It is a best practice to read the existing config to preserve other rules
// and use the etag for optimistic concurrency control.
try {
GetConfigRequest getRequest = GetConfigRequest.newBuilder().setName(name).build();
Config existingConfig = client.getConfig(getRequest);
configBuilder.mergeFrom(existingConfig);
} catch (NotFoundException e) {
// If config doesn't exist, we will proceed by creating a new one.
}
// Create an integration selector for the service you want to disable.
IntegrationSelector selector =
IntegrationSelector.newBuilder().setIntegration(Integration.DATAPROC).build();
// Set lineage enablement to false to disable tracking.
LineageEnablement enablement = LineageEnablement.newBuilder().setEnabled(false).build();
// Build the ingestion rule.
IngestionRule disableRule =
IngestionRule.newBuilder()
.setIntegrationSelector(selector)
.setLineageEnablement(enablement)
.build();
// Preserve existing rules except for the one we are modifying, then add the new rule.
// We clear the ingestion block out of the configBuilder entirely to reconstruct it.
Ingestion.Builder ingestionBuilder = Ingestion.newBuilder();
if (configBuilder.hasIngestion()) {
for (IngestionRule rule : configBuilder.getIngestion().getRulesList()) {
// Keep all existing rules EXCEPT the one targeting DATAPROC
if (rule.getIntegrationSelector().getIntegration() != Integration.DATAPROC) {
ingestionBuilder.addRules(rule);
}
}
}
ingestionBuilder.addRules(disableRule);
// Update the config builder with the reconstructed ingestion settings.
configBuilder.setIngestion(ingestionBuilder.build());
// Build the update request.
UpdateConfigRequest request = UpdateConfigRequest.newBuilder()
.setConfig(configBuilder.build())
.build();
// Update the config.
Config response = client.updateConfig(request);
System.out.printf("Successfully updated config: %s\n", response.getName());
}
}
}
Python
from google.api_core.exceptions import NotFound
from google.cloud.datacatalog.lineage import configmanagement_v1
def disable_lineage_ingestion(project_id: str, location: str = "global") -> configmanagement_v1.Config:
"""Disables lineage ingestion for a specific service.
Args:
project_id: The ID of your Google Cloud project.
location: The region location, usually 'global'.
Returns:
The updated Configuration object.
"""
# Initialize client that will be used to send requests.
client = configmanagement_v1.ConfigManagementServiceClient()
# The config name format
name = f"projects/{project_id}/locations/{location}/config"
try:
# Retrieve the existing config to preserve other configurations and
# obtain the latest etag for optimistic concurrency control.
config = client.get_config(name=name)
# Filter out existing rules for the integration we are updating
new_rules = [
rule for rule in config.ingestion.rules
if rule.integration_selector.integration != configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration.DATAPROC
]
except NotFound:
# If the config does not exist, start fresh
config = configmanagement_v1.Config(name=name)
new_rules = []
# Define the integration to disable tracking for (e.g., DATAPROC).
integration_selector = configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector(
integration=configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration.DATAPROC
)
# Set lineage enablement to False to disable tracking.
lineage_enablement = configmanagement_v1.Config.Ingestion.IngestionRule.LineageEnablement(
enabled=False
)
# Create the ingestion rule.
disable_rule = configmanagement_v1.Config.Ingestion.IngestionRule(
integration_selector=integration_selector,
lineage_enablement=lineage_enablement,
)
# Append the new disabling rule and assign it back to the config ingestion rules
new_rules.append(disable_rule)
config.ingestion = configmanagement_v1.Config.Ingestion(rules=new_rules)
# Create the update request using the config (which includes the etag if it existed).
request = configmanagement_v1.UpdateConfigRequest(
config=config,
)
# Make the request to update the config
response = client.update_config(request=request)
print(f"Successfully updated config: {response.name}")
return response
gcloud
Untuk menonaktifkan penyerapan silsilah untuk layanan tertentu,
gunakan perintah gcloud datalineage config update dengan string JSON inline atau jalur ke file JSON yang menetapkan lineageEnablement.enabled ke false untuk integration tertentu.
Contoh berikut menunjukkan cara menonaktifkan penyerapan silsilah layanan untuk project menggunakan string JSON inline:
gcloud datalineage config update --project=PROJECT_ID \
--config='{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": false
}
}
]
},
"etag": "ETAG"
}'
Ganti kode berikut:
PROJECT_ID: ID project yang konfigurasinya ingin Anda perbarui.INTEGRATION: Integrasi yang Anda tetapkan konfigurasinya. MisalnyaDATAPROCatauBIGQUERY.ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru di isi permintaan, digunakan untuk memverifikasi bahwa konfigurasi tidak berubah sejak permintaan baca terakhir Anda.
Untuk memperbarui konfigurasi menggunakan file JSON, jalankan:
gcloud datalineage config update --project=PROJECT_ID --config=CONFIG_FILE
Ganti kode berikut:
CONFIG_FILE: Jalur ke file JSON yang berisi konfigurasi.
Untuk menonaktifkan penyerapan silsilah layanan untuk folder atau organisasi, ganti
--project= dengan salah satu opsi
berikut:PROJECT_ID
--folder=jika Anda ingin memperbarui setelan penyerapan data untuk folder.FOLDER_ID--organization=jika Anda ingin memperbarui setelan penyerapan data untuk organisasi.ORGANIZATION_ID
REST
Untuk menonaktifkan penyerapan silsilah untuk layanan tertentu, gunakan metode projects.locations.config.patch dengan aturan penyerapan yang menetapkan lineageEnablement.enabled ke false untuk integration tertentu.
Untuk mencegah konfigurasi yang dibuat oleh pengguna lain ditimpa secara tidak sengaja dalam skenario baca-ubah-tulis, Anda dapat menyertakan kolom etag dalam isi permintaan. Untuk mengetahui informasi selengkapnya, lihat Mendapatkan konfigurasi saat ini.
Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:
CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.PROJECT_ID: ID project yang konfigurasinya ingin Anda perbarui.ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru.INTEGRATION:integrationyang Anda tetapkan konfigurasi untuknya. Misalnya,DATAPROC.
Metode HTTP dan URL:
PATCH https://datalineage.googleapis.com/v1/projects/PROJECT_ID/locations/global/config
Meminta isi JSON:
{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": false
}
}
]
},
"etag": "ETAG"
}
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
Anda akan melihat respons JSON seperti berikut:
{
"name": "projects/PROJECT_ID/locations/global/config",
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": false
}
}
]
},
"etag": "1a2b3c4d5e"
}
Untuk menonaktifkan penyerapan silsilah untuk folder atau organisasi, ganti
projects/ dengan "PROJECT_IDfolders/ atau FOLDER_IDorganizations/.ORGANIZATION_ID
Mengaktifkan penyerapan silsilah untuk layanan
Untuk melanjutkan pelacakan setelah menonaktifkannya, atau untuk mengaktifkan integrasi yang dinonaktifkan secara default, aktifkan penyerapan silsilah untuk layanan.
Java
package com.google.cloud.datacatalog.lineage.configmanagement.v1.samples;
import com.google.api.gax.rpc.NotFoundException;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.IntegrationSelector;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.Config.Ingestion.IngestionRule.LineageEnablement;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.ConfigManagementServiceClient;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.ConfigName;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.GetConfigRequest;
import com.google.cloud.datacatalog.lineage.configmanagement.v1.UpdateConfigRequest;
public class EnableLineageIngestion {
public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-project-id";
String location = "global";
enableLineageIngestion(projectId, location);
}
// Enables lineage ingestion for a specific service
// (Managed Service for Apache Spark).
public static void enableLineageIngestion(String projectId, String location) throws Exception {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests.
try (ConfigManagementServiceClient client = ConfigManagementServiceClient.create()) {
// Format the resource name.
String name = ConfigName.ofProjectLocationName(projectId, location).toString();
Config.Builder configBuilder = Config.newBuilder().setName(name);
// It is a best practice to read the existing config to preserve other rules
// and use the etag for optimistic concurrency control.
try {
GetConfigRequest getRequest = GetConfigRequest.newBuilder().setName(name).build();
Config existingConfig = client.getConfig(getRequest);
configBuilder.mergeFrom(existingConfig);
} catch (NotFoundException e) {
// If config doesn't exist, we will proceed by creating a new one.
}
// Create an integration selector for the service you want to enable (e.g., DATAPROC).
IntegrationSelector selector =
IntegrationSelector.newBuilder().setIntegration(Integration.DATAPROC).build();
// Set lineage enablement to true to enable tracking.
LineageEnablement enablement = LineageEnablement.newBuilder().setEnabled(true).build();
// Build the ingestion rule.
IngestionRule enableRule =
IngestionRule.newBuilder()
.setIntegrationSelector(selector)
.setLineageEnablement(enablement)
.build();
// Preserve existing rules except for the one we are modifying, then add the new rule.
// We clear the ingestion block out of the configBuilder entirely to reconstruct it.
Ingestion.Builder ingestionBuilder = Ingestion.newBuilder();
if (configBuilder.hasIngestion()) {
for (IngestionRule rule : configBuilder.getIngestion().getRulesList()) {
// Keep all existing rules EXCEPT the one targeting DATAPROC
if (rule.getIntegrationSelector().getIntegration() != Integration.DATAPROC) {
ingestionBuilder.addRules(rule);
}
}
}
ingestionBuilder.addRules(enableRule);
// Update the config builder with the reconstructed ingestion settings.
configBuilder.setIngestion(ingestionBuilder.build());
// Build the update request.
UpdateConfigRequest request = UpdateConfigRequest.newBuilder()
.setConfig(configBuilder.build())
.build();
// Update the config.
Config response = client.updateConfig(request);
System.out.printf("Successfully updated config: %s\n", response.getName());
}
}
}
Python
from google.api_core.exceptions import NotFound
from google.cloud.datacatalog.lineage import configmanagement_v1
def enable_lineage_ingestion(project_id: str, location: str = "global") -> configmanagement_v1.Config:
"""Enables lineage ingestion for a specific service like Dataproc
(Managed Service for Apache Spark).
Args:
project_id: The ID of your Google Cloud project.
location: The region location, usually 'global'.
Returns:
The updated Configuration object.
"""
# Initialize client that will be used to send requests.
client = configmanagement_v1.ConfigManagementServiceClient()
# The config name format
name = f"projects/{project_id}/locations/{location}/config"
try:
# Retrieve the existing config to preserve other configurations and
# obtain the latest etag for optimistic concurrency control.
config = client.get_config(name=name)
# Filter out existing rules for the integration we are updating
new_rules = [
rule for rule in config.ingestion.rules
if rule.integration_selector.integration != configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration.DATAPROC
]
except NotFound:
# If the config does not exist, start fresh
config = configmanagement_v1.Config(name=name)
new_rules = []
# Define the integration to enable tracking for (e.g., DATAPROC).
integration_selector = configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector(
integration=configmanagement_v1.Config.Ingestion.IngestionRule.IntegrationSelector.Integration.DATAPROC
)
# Set lineage enablement to True to enable tracking.
lineage_enablement = configmanagement_v1.Config.Ingestion.IngestionRule.LineageEnablement(
enabled=True
)
# Create the ingestion rule.
enable_rule = configmanagement_v1.Config.Ingestion.IngestionRule(
integration_selector=integration_selector,
lineage_enablement=lineage_enablement,
)
# Append the new enabling rule and assign it back to the config ingestion rules
new_rules.append(enable_rule)
config.ingestion = configmanagement_v1.Config.Ingestion(rules=new_rules)
# Create the update request using the config (which includes the etag if it existed).
request = configmanagement_v1.UpdateConfigRequest(
config=config,
)
# Make the request to update the config
response = client.update_config(request=request)
print(f"Successfully updated config: {response.name}")
return response
gcloud
Untuk mengaktifkan penyerapan silsilah untuk layanan tertentu,
gunakan perintah gcloud datalineage config update dengan string JSON inline atau jalur ke file JSON yang menetapkan lineageEnablement.enabled ke true untuk integration tertentu. Integrasi saat ini mencakup Managed Service untuk Apache Spark, BigQuery, dan Managed Airflow.
Contoh berikut menunjukkan cara mengaktifkan penyerapan silsilah layanan untuk project menggunakan string JSON inline:
gcloud datalineage config update --project=PROJECT_ID \
--config='{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "ETAG"
}'
Ganti kode berikut:
PROJECT_ID: ID project yang konfigurasinya ingin Anda perbarui.INTEGRATION: Integrasi yang Anda tetapkan konfigurasinya (misalnya,DATAPROCatauBIGQUERY).ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru di isi permintaan, digunakan untuk memverifikasi bahwa konfigurasi tidak berubah sejak permintaan baca terakhir Anda.
Untuk memperbarui konfigurasi menggunakan file JSON, jalankan:
gcloud datalineage config update --project=PROJECT_ID --config=CONFIG_FILE
Ganti kode berikut:
CONFIG_FILE: Jalur ke file JSON yang berisi konfigurasi.
Untuk mengaktifkan penyerapan silsilah layanan untuk folder atau organisasi, ganti
--project= dengan salah satu
berikut:PROJECT_ID
--folder=jika Anda ingin memperbarui setelan penyerapan data untuk folder.FOLDER_ID--organization=jika Anda ingin memperbarui setelan penyerapan data untuk organisasi.ORGANIZATION_ID
REST
Untuk mengaktifkan penyerapan silsilah untuk layanan tertentu, gunakan metode projects.locations.config.patch dengan aturan penyerapan yang menetapkan lineageEnablement.enabled ke true untuk integration tertentu.
Untuk mencegah konfigurasi yang dibuat oleh pengguna lain ditimpa secara tidak sengaja dalam skenario baca-ubah-tulis, Anda dapat menyertakan kolom etag dalam isi permintaan. Untuk mengetahui informasi selengkapnya, lihat Mendapatkan konfigurasi saat ini.
Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:
CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.PROJECT_ID: ID project yang konfigurasinya ingin Anda perbarui.ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru.INTEGRATION:integrationyang Anda tetapkan konfigurasi untuknya. Misalnya,DATAPROC.
Metode HTTP dan URL:
PATCH https://datalineage.googleapis.com/v1/projects/PROJECT_ID/locations/global/config
Meminta isi JSON:
{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "ETAG"
}
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
Anda akan melihat respons JSON seperti berikut:
{
"name": "projects/PROJECT_ID/locations/global/config",
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "INTEGRATION"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "1a2b3c4d5e"
}
Untuk mengaktifkan penyerapan silsilah layanan untuk folder atau organisasi, ganti
projects/ dengan PROJECT_IDfolders/ atau
FOLDER_IDorganizations/.ORGANIZATION_ID
Mengonfigurasi penyerapan silsilah untuk beberapa layanan
Untuk mengonfigurasi penyerapan silsilah untuk beberapa integrasi secara bersamaan, gunakan metode projects.locations.config.patch, folders.locations.config.patch, atau organizations.locations.config.patch. Anda dapat memperbarui konfigurasi di tingkat project, folder, atau organisasi dengan menentukan beberapa aturan di isi permintaan. Untuk mengetahui informasi selengkapnya, lihat Cara kerja konfigurasi penyerapan data untuk integrasi multi-layanan.
Tingkat organisasi
Konfigurasi organisasi untuk Mengaktifkan penyerapan silsilah untuk Managed Service untuk Apache Spark:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-H "X-Goog-User-Project: CLIENT_PROJECT_ID" \
"https://datalineage.googleapis.com/v1/organizations/ORGANIZATION_ID/locations/global/config" \
-d '{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "DATAPROC"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "ORGANIZATION_CONFIG_ETAG"
}'
Ganti kode berikut:
ORGANIZATION_ID: ID organisasi yang konfigurasinya ingin Anda perbarui.CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.ORGANIZATION_CONFIG_ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru untuk konfigurasi organisasi.
Tingkat folder
Konfigurasi folder untuk Mengaktifkan penyerapan silsilah untuk BigQuery:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-H "X-Goog-User-Project: CLIENT_PROJECT_ID" \
"https://datalineage.googleapis.com/v1/folders/FOLDER_ID/locations/global/config" \
-d '{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "BIGQUERY"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "FOLDER_CONFIG_ETAG"
}'
Ganti kode berikut:
FOLDER_ID: ID folder yang konfigurasinya ingin Anda perbarui.CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.FOLDER_CONFIG_ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru untuk konfigurasi folder.
Level project
Konfigurasi project untuk Menonaktifkan penyerapan silsilah untuk BigQuery dan Mengaktifkan penyerapan silsilah untuk Managed Service untuk Apache Airflow secara bersamaan:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-H "X-Goog-User-Project: CLIENT_PROJECT_ID" \
"https://datalineage.googleapis.com/v1/projects/PROJECT_ID/locations/global/config" \
-d '{
"ingestion": {
"rules": [
{
"integrationSelector": {
"integration": "BIGQUERY"
},
"lineageEnablement": {
"enabled": false
}
},
{
"integrationSelector": {
"integration": "MANAGED_AIRFLOW"
},
"lineageEnablement": {
"enabled": true
}
}
]
},
"etag": "PROJECT_CONFIG_ETAG"
}'
Ganti kode berikut:
PROJECT_ID: ID project yang konfigurasinya ingin Anda perbarui.CLIENT_PROJECT_ID: ID project klien Anda yang digunakan untuk penagihan atau kuota.PROJECT_CONFIG_ETAG: Nilaietagyang ditampilkan dari permintaangetterbaru untuk konfigurasi project.
Langkah berikutnya
- Pelajari cara mengontrol penyerapan silsilah data.
- Pelajari cara melihat informasi silsilah.