azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

Deployment Error: teradatasqlalchemy Module Not Found on Azure

Open Mikeflames opened this issue 9 months ago • 9 comments

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

Mikeflames avatar Mar 07 '25 15:03 Mikeflames

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

Sagarthore11 avatar Mar 07 '25 15:03 Sagarthore11

Yes still the same issue :-

Image

Env Variables :-

Image

Mikeflames avatar Mar 07 '25 15:03 Mikeflames

Could please share me an requirement.txt ?

Sagarthore11 avatar Mar 07 '25 15:03 Sagarthore11

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

Mikeflames avatar Mar 07 '25 15:03 Mikeflames

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

Mikeflames avatar Mar 07 '25 15:03 Mikeflames

Hi @Mikeflames Please check this and see if it helps: https://github.com/Azure/azure-functions-python-worker/issues/1299#issuecomment-1690177702

Catastrophe1 avatar Mar 10 '25 07:03 Catastrophe1

Hi @Catastrophe1 , I tried the above solutions , didn't worked , have attached SS above.

Mikeflames avatar Mar 10 '25 08:03 Mikeflames

Hi Team , any Updates have been facing this issue ,tried approaches but didn't worked out ? @Sagarthore11

Mikeflames avatar Mar 11 '25 09:03 Mikeflames

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')

Mikeflames avatar Mar 13 '25 08:03 Mikeflames