azure-functions-python-worker
azure-functions-python-worker copied to clipboard
Deployment Error: teradatasqlalchemy Module Not Found on Azure
I am experiencing a deployment issue with my Azure Function where the teradatasqlalchemy module is not recognized during deployment, despite working correctly locally. The error messages are as follows:
2025-03-07T09:51:43Z [Error] Failed to create engine: No module named 'teradatasqlalchemy.dialect' 2025-03-07T09:51:43Z [Error] Teradata data fetch/store error: No module named 'teradatasqlalchemy.dialect'
Local Setup: Everything works as expected. Azure Deployment:The error occurs during deployment.
The teradatasqlalchemy module should be correctly installed and recognized during Azure deployment, allowing the Azure Function to run without errors.
Attempted Solutions Verified that teradatasqlalchemy is correctly listed in requirements.txt. Attempted to disable remote build by setting ENABLE_ORYX_BUILD = false and SCM_DO_BUILD_DURING_DEPLOYMENT = 0.
Additional Context This issue seems related to how dependencies are handled during remote builds in Azure. Any assistance in resolving this would be greatly appreciated.
Similar Issue which was closed #1299
Hello @Mikeflames ,
I am happy to check more details on it.
could you please try SCM_DO_BUILD_DURING_DEPLOYMENT and ENABLE_ORYX_BUILD are set to true and see verify if you are still facing the same issue. if yes, please share me an requirement.txt pls
Yes still the same issue :-
Env Variables :-
Could please share me an requirement.txt ?
Libraries :-
azure-functions pandas pyarrow azure-storage-blob SQLAlchemy==1.3.24 teradata==15.10.0.21 teradatasql==20.0.0.25 teradatasqlalchemy==17.0.0.4
Specifically used this import :- from sqlalchemy import create_engine,text from sqlalchemy.types import VARCHAR
def connect(self):
try:
self.engine = create_engine(
f'teradatasql://{self.user}:{self.password}@{self.host}:{self.port}'
)
logging.info("Created Teradata engine successfully.")
except Exception as e:
logging.error(f"Failed to create engine: {e}")
raise
I have used Blob trigger , but it cannot connect on deployed Azure Function :-
teradata_client.connect() df = teradata_client.fetch_data() if not df.empty: teradata_client.store_csv_to_blob(df, container_name="CNAME") # teradata_client.close_connection() except Exception as e: logging.error(f"Teradata data fetch/store error: {e}")
On Local everything works fine
Hi @Mikeflames Please check this and see if it helps: https://github.com/Azure/azure-functions-python-worker/issues/1299#issuecomment-1690177702
Hi @Catastrophe1 , I tried the above solutions , didn't worked , have attached SS above.
Hi Team , any Updates have been facing this issue ,tried approaches but didn't worked out ? @Sagarthore11
Hi @Sagarthore11 / @Catastrophe1 , Any Work-arounds ? I also tried this fix to register module explicitly, but that too didn't worked out :-
from sqlalchemy.dialects import registry
registry.register('teradata', 'teradatasqlalchemy.dialect', 'TeradataDialect')