open-metadata / OpenMetadata

OpenMetadata is a unified metadata platform for data discovery, data observability, and data governance powered by a central metadata repository, in-depth column level lineage, and seamless team collaboration.
https://open-metadata.org
Apache License 2.0
5.18k stars 985 forks source link

Table owners not shown properly after a dbt ingestion and re-indexing #17747

Open nicor88 opened 1 week ago

nicor88 commented 1 week ago

Affected module I changed the owner of some of my table, using then meta.owner tag in dbt. I re-run the dbt-ingestion, and after that a re-indexing, but the owners are still now shown properly in the UI. I believe that the affected part is the re-indexing, because the data in the database looks correct.

Describe the bug

To Reproduce

Expected behavior

Version:

Additional context

As mentioned above, the data in the database is correct.

select name,
       json ->> '$.databaseSchema.displayName' glue_database,
       json ->> '$.dataModel.owners[0].name' as owner
from openmetadata.table_entity
where json ->> '$.dataModel.owners[0].name' in ('user_1', 'user_2')

return the right owner for the models.

but the data in the UI and in elastic search is still showing an outdated owner. This is far from ideal because "as I'm dbt centric", and I like handle changes as code, means that I get dbt owner not synced with OM.

nicor88 commented 1 week ago

@OnkarVO7 I believe that this could be somehow related to this: https://github.com/open-metadata/OpenMetadata/pull/17610

Specifically this section of code:

// Carry forward the table owners from the model to table entity, if empty
    if (nullOrEmpty(table.getOwners())) {
      storeOwners(table, dataModel.getOwners());
    }

might not be evaluated to True, because when owner are actually not empty or not null, we never reset them.

Maybe this could work:

if (!nullOrEmpty(dataModel.getOwners())) {
      storeOwners(table, dataModel.getOwners());
    }

Pretty much we always pick the owners from the dataModel. When doing so, I'm not sure if we cover all the use cases. When a user update the owner in the UI, I assume that this goes to elastic search, and there might be some ambiguous situation. Either way I expect that what is stored in the DB is always the source of truth.

cc @OnkarVO7