Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/actions/events/metadata-change-log-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,35 @@ The fields include
```
## FAQ

### How can I access system metadata for entities using the DataHub Python SDK?

To access system metadata, you should focus on retrieving aspects that include system metadata as part of their response. `SystemMetadataClass` is used within other aspects to provide metadata about the ingestion process, not as a standalone aspect. For example, you can query the `DatasetProperties` aspect and check its system metadata.

Here's an example of how you can fetch an aspect and access its system metadata using Python:

```python
from datahub.ingestion.graph.client import DataHubGraph, DataHubGraphConfig
from datahub.metadata.schema_classes import DatasetPropertiesClass

# Initialize the DataHubGraph client
datahub_graph = DataHubGraph(DataHubGraphConfig(server="http://localhost:8080"))

# Define the dataset URN
dataset_urn = "urn:li:dataset:(urn:li:dataPlatform:bigquery,my_project.my_dataset.my_table,PROD)"

# Fetch the DatasetProperties aspect
dataset_properties = datahub_graph.get_aspect(entity_urn=dataset_urn, aspect_type=DatasetPropertiesClass)

# Access the system metadata
if dataset_properties and dataset_properties.systemMetadata:
last_synchronized_time = dataset_properties.systemMetadata.lastObserved
print(f"Last Synchronized Time: {last_synchronized_time}")
else:
print("System metadata not available.")
```

Common errors include "type object 'SystemMetadataClass' has no attribute 'ASPECT_NAME'", which occurs because `SystemMetadataClass` is not directly queryable as an aspect. Instead, access it through other aspects that include it.

### Where can I find all the aspects and their schemas?

Great Question! All MetadataChangeLog events are based on the Metadata Model which is comprised of Entities,
Expand Down