SQLAlchemy uses setuptools entry points to load database drivers. Here's the definition for the teradata dialect:
https://github.com/Teradata/sqlalchemy-teradata/blob/master/setup.py#L25 For that to work, you would normally have a directory called something like "sqlalchemy_teradata-0.1.0.dist-info" (or possible .egg-info) in your site-packages. The directory would contain an entry_points.txt file that points to the dialect class. Does your site-packages.zip contain that dist info directory with the entry_points file inside? Simon On Mon, Feb 1, 2021 at 4:50 PM Anhelina Rudkovska <lina.rudkovska...@gmail.com> wrote: > > > Everything works as expected on local machine. > > Code fails where SQLAlchemy db engine initializes. We use latest (17.0.0.8) > release of https://pypi.org/project/teradatasqlalchemy/ library to provide DB > engine for SQLAlchemy. SQLAlchemy reports that it can not load plugin > teradatasql. I attached screenshot with error and piece of code which is used > to establish connection. > Seems like library pkg_resources which is called inside SQLAlchemy can't > resolve teradatasql inside Amazon environment from .zip. Site-packages > shipped for Amazon as site-packages.zip placed on AWS s3. > Direct imports of teradatasql or pkg_resources work fine (or > teradatasqlalchemy which is located in .zip with site-packages on s3 too). > Site-packages in archive look same as > site-packages in their directory on local machine (i.e. where python located > or in virtual env, or inside filesystem of docker container). > > To develop script and run ETL job locally we use container (as described here > https://aws.amazon.com/blogs/big-data/developing-aws-glue-etl-jobs-locally-using-a-container/) > created from our image (installation of python libraries for script from > requirements.txt in Dockerfile was added) which inherits from > amazon/aws-glue-libs. > > I also notified Amazon Support. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/87ce8dc9-b015-4ef0-a92a-5c5c10b528fan%40googlegroups.com. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAFHwexfk13QA3YOtjbnt%3D4oYh2AS93mt3eH3y9SnjpbsWjKMOg%40mail.gmail.com.