-
Notifications
You must be signed in to change notification settings - Fork 133
Update _git.py - added param to initialize_git_connection fn #490
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,7 +264,7 @@ def get_git_connection(workspace: Optional[str | UUID] = None) -> pd.DataFrame: | |
return df | ||
|
||
|
||
def initialize_git_connection(workspace: Optional[str | UUID] = None) -> str: | ||
def initialize_git_connection(workspace: Optional[str | UUID] = None, initialization_strategy: Optional[str] = 'None') -> str: | ||
""" | ||
Initializes a connection for a workspace that is connected to Git. | ||
|
||
|
@@ -276,6 +276,11 @@ def initialize_git_connection(workspace: Optional[str | UUID] = None) -> str: | |
The Fabric workspace name or ID. | ||
Defaults to None which resolves to the workspace of the attached lakehouse | ||
or if no lakehouse attached, resolves to the workspace of the notebook. | ||
initialization_strategy : str | ||
Defines the strategy required for an initialization process when content | ||
exists on both the remote side and the workspace side. | ||
Additional strategies may be added over time. | ||
Supported options: PreferWorkspace, PreferRemote or None (default) | ||
|
||
Returns | ||
------- | ||
|
@@ -285,8 +290,14 @@ def initialize_git_connection(workspace: Optional[str | UUID] = None) -> str: | |
|
||
(workspace_name, workspace_id) = resolve_workspace_name_and_id(workspace) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a check that the initialization_strategy is one of the 3 valid options. raise ValueError if it's not in those 3 options. This is just to make better error messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a helpful note for @hurtn: You can look at how |
||
|
||
payload = { | ||
"initializationStrategy": initialization_strategy | ||
} | ||
|
||
response_json = _base_api( | ||
request=f"/v1/workspaces/{workspace_id}/git/initializeConnection", | ||
payload=payload, | ||
method="post", | ||
lro_return_json=True, | ||
status_codes=None, | ||
|
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.
initialization_strategy : str, default='None'