On Tue, Oct 28, 2014 at 5:23 PM, Larry Green <lgr...@smartmarketdata.com> wrote: > Simple question. > > Configuration= > Anaconda3 > Python 3.4 and many various 3rd party modules. > sqlalchemy 0.9.4 verified installed > Windows 7 x64 machine. > > The first part of the sqlalchemy tutorial states do the following in python: > > import sqlalchemy > > works perfectly, then: > > from sqlalchemy import create_engine > > works perfectly, then I enter code to create a MySQL engine for sqlalchemy: > > engine = create_engine("mysql://root:mypwd@127.0.0.1/mydatabase", > encoding='utf-8', echo=True) > > this runs, but then errors (ImportError: No module named 'MySQLdb'). I have > verified that the mysqldb.py file the error says is missing is in the > "C:\Anaconda3\lib\site-packages\sqlalchemy\connectors\mysqldb.py. But no > "module"? Is this not included in the Anaconda build? Do I have to install > the mySQLdb module? If so, what version and how do I do it? > > Here is the traceback: > > Traceback (most recent call last): > File "<ipython-input-10-cb42ba2637c2>", line 1, in <module> > engine = create_engine("mysql://root:mypwd@127.0.0.1/mydatabase", > encoding='utf-8', echo=True) > File "C:\Anaconda3\lib\site-packages\sqlalchemy\engine\__init__.py", line > 344, in create_engine > return strategy.create(*args, **kwargs) > File "C:\Anaconda3\lib\site-packages\sqlalchemy\engine\strategies.py", > line 73, in create > dbapi = dialect_cls.dbapi(**dbapi_args) > File "C:\Anaconda3\lib\site-packages\sqlalchemy\connectors\mysqldb.py", > line 63, in dbapi > return __import__('MySQLdb') > ImportError: No module named 'MySQLdb' > > Please help. >
SQLAlchemy provides adapters for many database engines, but it generally relies on separate packages for the underlying connection. See http://docs.sqlalchemy.org/en/rel_0_9/dialects/index.html in general, and http://docs.sqlalchemy.org/en/rel_0_9/dialects/mysql.html for mysql specifically. Most tutorials use sqlite as the database, since the sqlite library is included as part of Python. Certainly the tutorials at http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html and http://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html use sqlite. Which tutorial are you trying to follow? Hope that helps, Simon -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.