seanharr11 / etlalchemy

Extract, Transform, Load: Any SQL Database in 4 lines of Code.
MIT License
554 stars 83 forks source link

cannot import name ETLAlchemySource #32

Open nitin23c opened 6 years ago

nitin23c commented 6 years ago

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:password@192.168.0.101: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.

original-heart commented 6 years ago

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

seanharr11 commented 6 years ago

@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.

dalec-vi commented 6 years ago

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