When using sqlalchemy with a mysql URL and mysql-python installed as suggested. A stacktrace is still thrown that the wrong dependency has been fulfilled. Reproducible: Always Steps to Reproduce: 1. emerge -1 \=sqlalchemy-0.9.2 2. emerge -1 mysql-python 3. invoke python script with a URL such as "mysql://user:pass@host" Actual Results: Stacktrace: alunduil@elijah mongo and mysql % ipython In [1]: import sqlalchemy.schema In [2]: m = sqlalchemy.schema.MetaData("mysql://root:I'm required why@192.168.0.2") --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-2-397c9b8f8a1c> in <module>() ----> 1 m = sqlalchemy.schema.MetaData("mysql://root:I'm required why@192.168.0.2") /usr/lib64/python3.3/site-packages/sqlalchemy/sql/schema.py in __init__(self, bind, reflect, schema, quote_schema, naming_convention) 3020 self._fk_memos = collections.defaultdict(list) 3021 -> 3022 self.bind = bind 3023 if reflect: 3024 util.warn("reflect=True is deprecate; please " <string> in <lambda>(self, bind) /usr/lib64/python3.3/site-packages/sqlalchemy/sql/schema.py in _bind_to(self, url, bind) 3116 3117 if isinstance(bind, util.string_types + (url.URL, )): -> 3118 self._bind = sqlalchemy.create_engine(bind) 3119 else: 3120 self._bind = bind /usr/lib64/python3.3/site-packages/sqlalchemy/engine/__init__.py in create_engine(*args, **kwargs) 342 strategy = kwargs.pop('strategy', default_strategy) 343 strategy = strategies.strategies[strategy] --> 344 return strategy.create(*args, **kwargs) 345 346 /usr/lib64/python3.3/site-packages/sqlalchemy/engine/strategies.py in create(self, name_or_url, **kwargs) 71 if k in kwargs: 72 dbapi_args[k] = pop_kwarg(k) ---> 73 dbapi = dialect_cls.dbapi(**dbapi_args) 74 75 dialect_args['dbapi'] = dbapi /usr/lib64/python3.3/site-packages/sqlalchemy/connectors/mysqldb.py in dbapi(cls) 61 def dbapi(cls): 62 # is overridden when pymysql is used ---> 63 return __import__('MySQLdb') 64 65 ImportError: No module named 'MySQLdb' In [3]: Expected Results: Successful connection pool creation. Proper return of the metadata object. It seems that when using this mechanism sqlalchemy has changed to the more modern pymysql package rather than mysql-python. The recommendation should be to install pymysql (which isn't in the tree). Just curious, why did we drop the USE flags for mysql, mssql, and postgresql?
Did a bit more research and found that pymysql supports python3 whereas mysql-python does not. For python less than 3, mysql-python is still a valid choice to provide the dbapi that sqlalchemy requires.
Looks like another case of python2 vs python3 sorry for any noise.