etlalchemy icon indicating copy to clipboard operation
etlalchemy copied to clipboard

cannot import name ETLAlchemySource

Open nitin23c opened this issue 6 years ago • 3 comments

Trying to create a docker image based on debian ,

However when executing the script ( Using your first example )

`#!/root/project/migrate/bin/python

from etlalchemy import ETLAlchemySource, ETLAlchemyTarget

mssql_db_source = ETLAlchemySource("mssql+pyodbc://sa:password@SQLServer") mysql_db_target = ETLAlchemyTarget("mysql://root:[email protected]:12345/dbname", drop_database=True) mysql_db_target.addSource(mssql_db_source) mysql_db_target.migrate()`

Below is the trace

(migrate)root@a7e70412e776:~/project/migrate# ./migrate.py Traceback (most recent call last): File "./migrate.py", line 3, in <module> from etlalchemy import ETLAlchemySource, ETLAlchemyTarget File "/root/project/migrate/local/lib/python2.7/site-packages/etlalchemy/__init__.py", line 1, in <module> from ETLAlchemySource import ETLAlchemySource File "/root/project/migrate/local/lib/python2.7/site-packages/etlalchemy/ETLAlchemySource.py", line 6, in <module> from migrate.changeset.constraint import ForeignKeyConstraint File "/root/project/migrate/migrate.py", line 3, in <module> from etlalchemy import ETLAlchemySource, ETLAlchemyTarget ImportError: cannot import name ETLAlchemySource

Kindly help.

nitin23c avatar Mar 29 '18 20:03 nitin23c

@nitin23c please try to python2.7, it works well for me

original-heart avatar Apr 03 '18 06:04 original-heart

@nitin23c - I would suggest creating a new Python2.7 virtual environment, activating the virtual environment, and then install etlalchemy in the fresh environment. This seems to be an error with the migrate.changeset.constraint module import. You can also try to run pip install sqlalchemy_migrate, as that has fixed this problem in the past.

seanharr11 avatar Apr 11 '18 01:04 seanharr11

I had the same issue. Renaming your script from migrate.py to something else will resolve this.

dalec-vi avatar Aug 06 '18 11:08 dalec-vi