-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(ingest/unity): Use assigned metastore if not metastore listed in unity catalog #7446
Conversation
There was a problem hiding this 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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
if ( | ||
assigned_metastore | ||
and metastore.metastore_id != assigned_metastore.metastore_id | ||
): | ||
metastores.append(metastore) |
There was a problem hiding this comment.
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
There was a problem hiding this 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
for id in metastores.keys(): | ||
metastore = metastores[id] |
There was a problem hiding this comment.
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()
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