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

[WIP] feat(cli): Make consistent use of DataHubGraphClientConfig #10466

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

pedro93
Copy link
Collaborator

@pedro93 pedro93 commented May 9, 2024

Deprecates get_url_and_token() in favor of a more complete option: load_graph_config() that returns a full DatahubClientConfig.
This change was then propagated across previous usages of get_url_and_token so that connections to DataHub server from the client respect the full breadth of configuration specified by DatahubClientConfig.

I.e: You can now specify disable_ssl_verification: true in your ~/.datahubenv file so that all cli functions to the server work when ssl certification is disabled.

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

@pedro93 pedro93 requested a review from shirshanka May 14, 2024 18:57
@@ -541,6 +546,9 @@ def _relationships_endpoint(self):
def _aspect_count_endpoint(self):
return f"{self.config.server}/aspects?action=getCount"

def _session(self) -> Session:
return super()._session
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't look right

I don't think it's necessary, unless you want _session to be a method instead of an attr

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was not able in the DataHubGraph object to pull attributes from the super class, so I built this function to surface that. At least the auto-import in Intellij wasn't finding it.

What would be the right way to surface this super's attribute?

Copy link
Collaborator

Choose a reason for hiding this comment

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

you should be able to do graph._session without any changes

if you really want a method, add a @property decorator

return get_url_and_token()[1]


def get_session_and_host():
Copy link
Collaborator

Choose a reason for hiding this comment

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

to reduce the amount of code changes, you could make this call get_default_graph() and then return the tuple

basically keep it as a compatibility shim

Copy link
Collaborator Author

@pedro93 pedro93 May 14, 2024

Choose a reason for hiding this comment

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

Doing that causes a cyclical import dependency. It was my first implementation attempt.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can put the import inside the get_session_and_host method to avoid that issue

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.

None yet

2 participants