-
Notifications
You must be signed in to change notification settings - Fork 26
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 azure provider breaking change #1341
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9114e28
style: fix mypy issue
Lee-W 4671695
style: ignore example_dags wrong type
Lee-W 6fea5d3
fix(microsoft): make resource_group_name and factory_name required ar…
Lee-W ce5fcac
style(microsoft): cast type for fixing mypy issue
Lee-W 021a45b
fix(microsoft): add missing types for fixing example_adf_run_pipeline.py
Lee-W 373f7dd
fix(azure): remove deprecated pipelineinfo
Lee-W 0c09b44
ci(circle-ci): remove unnecessay dependency build-docs
Lee-W 2009f93
ci(circle-ci): add temperorary solution for mypy env setup
Lee-W bdef5a1
test(azure): fix missing argument issue
Lee-W 69378b5
style(microsoft): ignore type casting testing coverage
Lee-W File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,6 @@ | |
default_args = { | ||
"execution_timeout": timedelta(hours=EXECUTION_TIMEOUT), | ||
"azure_data_factory_conn_id": "azure_data_factory_default", | ||
"factory_name": DATAFACTORY_NAME, # This can also be specified in the ADF connection. | ||
"resource_group_name": RESOURCE_GROUP_NAME, # This can also be specified in the ADF connection. | ||
"retries": int(os.getenv("DEFAULT_TASK_RETRIES", 2)), | ||
"retry_delay": timedelta(seconds=int(os.getenv("DEFAULT_RETRY_DELAY_SECONDS", 60))), | ||
} | ||
|
@@ -88,7 +86,7 @@ def create_adf_storage_pipeline() -> None: | |
df_resource = Factory(location=LOCATION) | ||
df = adf_client.factories.create_or_update(RESOURCE_GROUP_NAME, DATAFACTORY_NAME, df_resource) | ||
while df.provisioning_state != "Succeeded": | ||
df = adf_client.factories.get(RESOURCE_GROUP_NAME, DATAFACTORY_NAME) | ||
df = adf_client.factories.get(RESOURCE_GROUP_NAME, DATAFACTORY_NAME) # type: ignore[assignment] | ||
time.sleep(1) | ||
|
||
# Create an Azure Storage linked service | ||
|
@@ -97,17 +95,17 @@ def create_adf_storage_pipeline() -> None: | |
storage_string = SecureString(value=CONNECTION_STRING) | ||
|
||
ls_azure_storage = LinkedServiceResource( | ||
properties=AzureStorageLinkedService(connection_string=storage_string) | ||
properties=AzureStorageLinkedService(connection_string=storage_string) # type: ignore[arg-type] | ||
) | ||
adf_client.linked_services.create_or_update( | ||
RESOURCE_GROUP_NAME, DATAFACTORY_NAME, STORAGE_LINKED_SERVICE_NAME, ls_azure_storage | ||
) | ||
|
||
# Create an Azure blob dataset (input) | ||
ds_ls = LinkedServiceReference(reference_name=STORAGE_LINKED_SERVICE_NAME) | ||
ds_ls = LinkedServiceReference(type="LinkedServiceReference", reference_name=STORAGE_LINKED_SERVICE_NAME) | ||
ds_azure_blob = DatasetResource( | ||
properties=AzureBlobDataset( | ||
linked_service_name=ds_ls, folder_path=BLOB_PATH, file_name=BLOB_FILE_NAME | ||
linked_service_name=ds_ls, folder_path=BLOB_PATH, file_name=BLOB_FILE_NAME # type: ignore[arg-type] | ||
) | ||
) | ||
adf_client.datasets.create_or_update( | ||
|
@@ -116,7 +114,7 @@ def create_adf_storage_pipeline() -> None: | |
|
||
# Create an Azure blob dataset (output) | ||
ds_out_azure_blob = DatasetResource( | ||
properties=AzureBlobDataset(linked_service_name=ds_ls, folder_path=OUTPUT_BLOB_PATH) | ||
properties=AzureBlobDataset(linked_service_name=ds_ls, folder_path=OUTPUT_BLOB_PATH) # type: ignore[arg-type] | ||
) | ||
adf_client.datasets.create_or_update( | ||
RESOURCE_GROUP_NAME, DATAFACTORY_NAME, DATASET_OUTPUT_NAME, ds_out_azure_blob | ||
|
@@ -125,8 +123,8 @@ def create_adf_storage_pipeline() -> None: | |
# Create a copy activity | ||
blob_source = BlobSource() | ||
blob_sink = BlobSink() | ||
ds_in_ref = DatasetReference(reference_name=DATASET_INPUT_NAME) | ||
ds_out_ref = DatasetReference(reference_name=DATASET_OUTPUT_NAME) | ||
ds_in_ref = DatasetReference(type="DatasetReference", reference_name=DATASET_INPUT_NAME) | ||
ds_out_ref = DatasetReference(type="DatasetReference", reference_name=DATASET_OUTPUT_NAME) | ||
Comment on lines
+126
to
+127
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. same question for backward compatibility. |
||
copy_activity = CopyActivity( | ||
name=ACTIVITY_NAME, inputs=[ds_in_ref], outputs=[ds_out_ref], source=blob_source, sink=blob_sink | ||
) | ||
|
@@ -194,13 +192,17 @@ def delete_azure_data_factory_storage_pipeline() -> None: | |
run_pipeline_wait = AzureDataFactoryRunPipelineOperatorAsync( | ||
task_id="run_pipeline_wait", | ||
pipeline_name=PIPELINE_NAME, | ||
factory_name=DATAFACTORY_NAME, | ||
resource_group_name=RESOURCE_GROUP_NAME, | ||
) | ||
# [END howto_operator_adf_run_pipeline_async] | ||
|
||
# [START howto_operator_adf_run_pipeline] | ||
run_pipeline_no_wait = AzureDataFactoryRunPipelineOperatorAsync( | ||
task_id="run_pipeline_no_wait", | ||
pipeline_name=PIPELINE_NAME, | ||
factory_name=DATAFACTORY_NAME, | ||
resource_group_name=RESOURCE_GROUP_NAME, | ||
wait_for_termination=False, | ||
) | ||
# [END howto_operator_adf_run_pipeline] | ||
|
@@ -209,6 +211,8 @@ def delete_azure_data_factory_storage_pipeline() -> None: | |
pipeline_run_sensor_async = AzureDataFactoryPipelineRunStatusSensorAsync( | ||
task_id="pipeline_run_sensor_async", | ||
run_id=cast(str, XComArg(run_pipeline_wait, key="run_id")), | ||
factory_name=DATAFACTORY_NAME, | ||
resource_group_name=RESOURCE_GROUP_NAME, | ||
) | ||
# [END howto_sensor_pipeline_run_sensor_async] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need to support/take care of backward compatibility for the previous versions of the provider?
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.
It seems to be there since 1.0.0 https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-datafactory_1.0.0/sdk/synapse/azure-synapse/azure/synapse/artifacts/models/_models_py3.py
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.
And we used to install azure-mgmt-datafactory >= 1.0.0 here.
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.
Also as an example DAG, I think we should use the newer version. WDYT?