Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/unity): Use assigned metastore if not metastore listed in unity catalog #7446

Merged
merged 7 commits into from
Feb 28, 2023

Conversation

treff7es
Copy link
Contributor

Based on oss community it seems like there are cases when list metastore doesn't return anything but we still can get metadata from the metastore which is assigned to the Workspace.

https://datahubspace.slack.com/archives/CUMUWQU66/p1676032592423079

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Feb 27, 2023
Copy link
Collaborator

@asikowitz asikowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to break functionality if assigned_metastore ends up None. Also, I think you're failing the testtests/integration/unity/test_unity_catalog_ingest.py::test_ingestion

def assigned_metastore(self) -> Optional[Metastore]:
response: dict = self._unity_catalog_api.get_metastore_summary()
if response.get("metastore_id") is None:
logger.info("Not found assinged metastore")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo on assigned. Also, "Assigned metastore not found" would make a little more sense to me, but I don't feel strongly either way

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Comment on lines 180 to 184
if (
assigned_metastore
and metastore.metastore_id != assigned_metastore.metastore_id
):
metastores.append(metastore)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If assigned_metastore is None then we'll get no metastores right? This doesn't seem intended.

You can do not assigned_metastore or metastore.metastore_id != assigned_metastore.metastore_id but it might be simpler to just stick the metastores in a map indexed by their id to avoid duplicates

Copy link
Collaborator

@asikowitz asikowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one style suggestion

Comment on lines 182 to 183
for id in metastores.keys():
metastore = metastores[id]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be more concisely for id, metastore in metastores.items()

@treff7es treff7es merged commit 62e33e0 into datahub-project:master Feb 28, 2023
oleg-ruban pushed a commit to RChygir/datahub that referenced this pull request Feb 28, 2023
yoonhyejin pushed a commit that referenced this pull request Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants