ModuleNotFoundError: No module named 'azure.mgmt.datafactory.models.RunFilterParameters'

Viewed 43

I tried calling the lib "import azure.mgmt.datafactory.models.RunFilterParameters" inside databricks and got the following error:

ModuleNotFoundError: No module named 'azure.mgmt.datafactory.models.RunFilterParameters'

I tried to execute this part of the function:

self.activity_filter_parameters = RunFilterParameters(last_updated_after=self.today_date - timedelta(hours=pipeline_timedelta+10), 
                                         last_updated_before=self.today_date,
                                        order_by=[RunQueryOrderBy(order_by='ActivityRunStart', order='DESC')])

self.activity_filter_parameters_asc = RunFilterParameters(last_updated_after=self.today_date - timedelta(hours=pipeline_timedelta+10), 
                                         last_updated_before=self.today_date,
                                        order_by=[RunQueryOrderBy(order_by='ActivityRunStart', order='ASC')])

self.pipeline_filter_parameters = RunFilterParameters(last_updated_after=self.today_date - timedelta(hours=pipeline_timedelta), 
                                                 last_updated_before=self.today_date,
                                                 order_by=[RunQueryOrderBy(order_by='RunStart', order='DESC')])

I checked that it appears in the documentation normally (https://docs.microsoft.com/en-us/python/api/azure-mgmt-datafactory/azure.mgmt.datafactory.models.runfilterparameters?view=azure-python). Can I do anything to fix this?

1 Answers

When I first saw this error, I would think it was a python writing problem(From the code snippets I've seen I think so), but I didn't see the complete code and complete error message. Is your error exactly from the code you showed?

I can reproduce the problem, but not sure if it's the same in your case:

enter image description here

How do you use the module?

I can use it correctly via these code:

import os
import sys
import azure.mgmt.datafactory.models

# use RunFilterParameters
run_filter_parameters = azure.mgmt.datafactory.models.RunFilterParameters(last_updated_after='2022-01-01T00:00:00Z', last_updated_before='2022-01-01T00:00:00Z')

Or the common usage:

import os
import sys
import azure.mgmt.datafactory.models as xxx

# use RunFilterParameters
run_filter_parameters = xxx.RunFilterParameters(last_updated_after='2022-01-01T00:00:00Z', last_updated_before='2022-01-01T00:00:00Z')

By the way, notice the where the pip installed the packages, every python version has it's own site-package directory to store packages. For your situation I think the issue should not comes from this, I just mention about this.

And the underlying principle of python module search(Probably not for your problem itself, just sharing it with you so you can troubleshoot with similar problems in the future.):

https://docs.python.org/3/tutorial/modules.html#the-module-search-path

Related