Hello everyone, Is there any way that I could dele...
# troubleshoot
g
Hello everyone, Is there any way that I could delete the time-series metadata from elasticsearch? I'm trying to delete assertions, but the metadata stills appear in the UI.
h
How are you deleting assertions ? You can use delete CLI to delete timeseries aspects https://datahubproject.io/docs/how/delete-metadata#:~:text=Deletion%20by%20a%20specific%20aspect
g
I used the CLI tool, but I thought deleting assertions would delete all aspects associated as happens with other entities like Dataset.
This will permanently delete 65 entities. Are you sure? [y/N]: y
Failed to execute operation
0% (0 of 65) | | Elapsed Time: 00000 ETA: -- --java.lang.UnsupportedOperationException: Not supported for non-timeseries aspect '{}'.
datahub delete -p anomalo -a assertionRunEvent --hard
And I don't know why the match filters return URNs that don't have assertionRunEvent.
On the UI:
But: {datahub.cli.delete_cli:321} - Filter matched 41 (soft-deleted) dataset entities of None. Sample: [<urn of the entity above>...
h
right, it appears that the delete cli does not consider filtering for urns that have certain aspect, when showing the message about how many entities will get affected. https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/cli/delete_cli.py#L292 However it does consider only the particular timeseries aspect when going ahead to delete the timeseries aspect https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/cli/delete_cli.py#L415 and does not delete the entire dataset. https://github.com/datahub-project/datahub/blob/master/metadata-service/restli-ser[…]java/com/linkedin/metadata/resources/entity/EntityResource.java So you can proceed with deletion and ignore the incorrect error message. Would it be possible for you to create github issue for hilighting this incorrect display message in delete cli ?
g
Yeah, i can create! Thanks @hundreds-photographer-13496
h
Hmm, have you tried hard deleting assertion entity (not the assertionRunEvent aspect) ? that should remove it from UI as well.
g
I tried it first, but it seems that the graphql get this information from Elasticsearch because my database dont have any information about Assertions.
h
Okay. I quickly tried hard deleting assertion by urn and it worked in my case. Assertion no longer shows up in UI. datahub delete --urn "urnliassertion:432475190cc846f2894b5b3aa4d55af2" --hard
Also I tried bulk deleting assertions by platform and it worked -
datahub delete -p great-expectations --entity-type assertion --hard
datahub delete -p great-expectations -a assertionRunEvent  --entity-type assertion --hard
Can you try this at your end and confirm it works.
g
Didn't work:
I saw that the entities returned in the Graphql when I entered in the validation tab are of type: EntityAssertionsResult. I ran the following commands: Command: datahub delete -p anomalo -a entityAssertionsResult --hard Result: java.lang.UnsupportedOperationException: Not supported for non-timeseries aspect '{}'. Command: datahub delete -p anomalo -a entityAssertionsResult --entity-type assertion --hard Result: No urns to delete. Maybe you want to change entity_type=assertion or platform=anomalo to be something different? Took 5.379 seconds to hard delete 0 versioned rows and 0 timeseries aspect rows for 0 entities.
h
That's graphql api entity name. Actual name is assertionRunEvent. https://datahubproject.io/docs/generated/metamodel/entities/assertion/
g
The API response has the following values (image below): So, i did this call:
datahub delete -p anomalo -a entityAssertionsResult --entity-type dataset --hard
The result:
This will permanently delete 37 entities. Are you sure? [y/N]: y
Failed to execute operation
0% (0 of 37) | | Elapsed Time: 00000 ETA: -- --java.lang.UnsupportedOperationException: Not supported for non-timeseries aspect '{}'.
I tried this:
datahub delete -p anomalo -a assertionRunEvent --entity-type dataset --hard
Result:
This will permanently delete 37 entities. Are you sure? [y/N]: y
Failed to execute operation
0% (0 of 37) | | Elapsed Time: 00000 ETA: -- --java.lang.UnsupportedOperationException: Not supported for non-timeseries aspect '{}'.
Changing entity type from dataset to assertion:Changing dataset to assertion:
No urns to delete. Maybe you want to change entity_type=assertion or platform=anomalo to be something different?
Took 5.81 seconds to hard delete 0 versioned rows and 0 timeseries aspect rows for 0 entities.
I even tried to change the platform to 'bigquery', the platform that datasets are part of, but I got the same result.
h
What have you set as platform in dataPlatformInstance aspect when creating these assertions ?
g
Yes. Using the following function:
def emit_anomalo_platform_instance(entity_urn: str, entity_type: str = "assertion") -> Iterable[MetadataWorkUnit]:
"""
Method responsible for creating the PlatformInstance metadata objects
Args:
entity_urn (str): Entity urn
entity_type (str): Entity type
"""
assertion_anomalo_platform_intance_mcp = MetadataChangeProposalWrapper(
entityType=entity_type,
changeType=ChangeType.UPSERT,
entityUrn=entity_urn,
aspectName="dataPlatformInstance",
aspect=DataPlatformInstance(
platform=builder.make_data_platform_urn("anomalo")
)
)
yield MetadataWorkUnit(id=f"{entity_urn}-platform-instance-wu", mcp=assertion_anomalo_platform_intance_mcp)
h
Have you tried this -
datahub delete -p anomalo --entity-type assertion --hard
g
Yes. The result is:
No urns to delete. Maybe you want to change entity_type=assertion or platform=anomalo to be something different?
Took 5.37 seconds to hard delete 0 versioned rows and 0 timeseries aspect rows for 0 entities.
I don't have any entity with urn like 'urnliasser%' in my database. The problem is the timeseries indices. They must be deleted when I hard delete the assertion entity.
h
And you also did this - ? datahub delete -p anomalo -a assertionRunEvent --entity-type assertion --hard
g
Yes. Returned the same result as the above command.
h
okay so have you checked your elastic index for the assertion data ?
does it still exist there
g
Maybe, I'll need to reset the elasticsearch persistence storage because of that. The problem is that I don't have backup process for the analytics events
Here:
h
I don't have any entity with urn like 'urnliasser%' in my database. The problem is the timeseries indices. They must be deleted when I hard delete the assertion entity.
This was the case, when I tried this at my end.
g
And
I expected these indexes to be empty.
I tried running the index restore job to see if the indexes were clean but didn't work.
h
I am not sure but there might be some issue in delete cli here. Probably when delete commands are issued in some specific order. Because when I tried at my end , it worked just fine. Let me dig into this and get back if I find anything.
g
Ok. Can i resolve this problem by deleting the index and running again the elasticsearch setup job?
h
you mean deleting the assertion index alone ?
g
Yes!
Running something like curl -X DELETE .../<indice>
h
hmm, I think that should work, but I have not done this before.
https://datahubspace.slack.com/archives/C029A3M079U/p1673961264121399 This tells me that it would work. In your case, I believe you would need to delete index for assertion entity alone, and not dataset entity. Do you want to delete all the assertions ingested so far ? (irrespective of platform) ?
g
Do you want to delete all the assertions ingested so far ? (irrespective of platform) ?
Yes!! That's what I'm trying to do.
h
okay, then you can go ahead and delete the assertion indexes.