Skip to content

Deployment Error: teradatasqlalchemy Module Not Found on Azure #1648

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

Open
Mikeflames opened this issue Mar 7, 2025 · 9 comments
Open

Deployment Error: teradatasqlalchemy Module Not Found on Azure #1648

Mikeflames opened this issue Mar 7, 2025 · 9 comments

Comments

@Mikeflames
Copy link

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

@Sagarthore11
Copy link

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

@Mikeflames
Copy link
Author

Yes still the same issue :-

Image

Env Variables :-

Image

@Sagarthore11
Copy link

Could please share me an requirement.txt ?

@Mikeflames
Copy link
Author

Mikeflames commented Mar 7, 2025

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
Copy link
Author

Mikeflames commented Mar 7, 2025

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

@Catastrophe1
Copy link

Hi @Mikeflames Please check this and see if it helps: #1299 (comment)

@Mikeflames
Copy link
Author

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

@Mikeflames
Copy link
Author

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

@Mikeflames
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants