import pandas as pd
import sqlalchemy
import os
from sqlalchemy import create_engine

engine = create_engine('mysql+pymysql://commonswiki.labsdb/commonswiki_p?read_default_file=%s' % os.path.expanduser('~/replica.my.cnf'))
pd.read_sql('SELECT * FROM recentchanges LIMIT 3', engine)

EmptyTraceback (most recent call last)
/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _do_get(self)
   1043             wait = use_overflow and self._overflow >= self._max_overflow
-> 1044             return self._pool.get(wait, self._timeout)
   1045         except sqla_queue.Empty:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/queue.py in get(self, block, timeout)
    144                 if self._empty():
--> 145                     raise Empty
    146             elif timeout is None:

Empty: 

During handling of the above exception, another exception occurred:

OperationalErrorTraceback (most recent call last)
/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   2073         try:
-> 2074             return fn()
   2075         except dialect.dbapi.Error as e:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in connect(self)
    375         if not self._use_threadlocal:
--> 376             return _ConnectionFairy._checkout(self)
    377 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _checkout(cls, pool, threadconns, fairy)
    712         if not fairy:
--> 713             fairy = _ConnectionRecord.checkout(pool)
    714 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in checkout(cls, pool)
    479     def checkout(cls, pool):
--> 480         rec = pool._do_get()
    481         try:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _do_get(self)
   1059                     with util.safe_reraise():
-> 1060                         self._dec_overflow()
   1061             else:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     59             self._exc_info = None   # remove potential circular references
---> 60             compat.reraise(exc_type, exc_value, exc_tb)
     61         else:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/compat.py in reraise(tp, value, tb, cause)
    183             raise value.with_traceback(tb)
--> 184         raise value
    185 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _do_get(self)
   1056                 try:
-> 1057                     return self._create_connection()
   1058                 except:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _create_connection(self)
    322 
--> 323         return _ConnectionRecord(self)
    324 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in __init__(self, pool)
    448         self.__pool = pool
--> 449         self.connection = self.__connect()
    450         self.finalize_callback = deque()

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in __connect(self)
    606             self.starttime = time.time()
--> 607             connection = self.__pool._invoke_creator(self)
    608             self.__pool.logger.debug("Created new connection %r", connection)

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/strategies.py in connect(connection_record)
     96                             return connection
---> 97                 return dialect.connect(*cargs, **cparams)
     98 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/default.py in connect(self, *cargs, **cparams)
    384     def connect(self, *cargs, **cparams):
--> 385         return self.dbapi.connect(*cargs, **cparams)
    386 

/srv/paws/lib/python3.4/site-packages/pymysql/__init__.py in Connect(*args, **kwargs)
     87     from .connections import Connection
---> 88     return Connection(*args, **kwargs)
     89 

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in __init__(self, host, user, password, database, port, unix_socket, charset, sql_mode, read_default_file, conv, use_unicode, client_flag, cursorclass, init_command, connect_timeout, ssl, read_default_group, compress, named_pipe, no_delay, autocommit, db, passwd, local_infile, max_allowed_packet, defer_connect, auth_plugin_map)
    678         else:
--> 679             self.connect()
    680 

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in connect(self, sock)
    890             self._get_server_information()
--> 891             self._request_authentication()
    892 

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in _request_authentication(self)
   1096         self.write_packet(data)
-> 1097         auth_packet = self._read_packet()
   1098 

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in _read_packet(self, packet_type)
    965         packet = packet_type(buff, self.encoding)
--> 966         packet.check_error()
    967         return packet

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in check_error(self)
    393             if DEBUG: print("errno =", errno)
--> 394             err.raise_mysql_exception(self._data)
    395 

/srv/paws/lib/python3.4/site-packages/pymysql/err.py in raise_mysql_exception(data)
    119     errinfo = _get_error_info(data)
--> 120     _check_mysql_exception(errinfo)

/srv/paws/lib/python3.4/site-packages/pymysql/err.py in _check_mysql_exception(errinfo)
    111     if errorclass:
--> 112         raise errorclass(errno, errorvalue)
    113 

OperationalError: (1045, "Access denied for user 'tools.paws'@'10.68.23.37' (using password: NO)")

The above exception was the direct cause of the following exception:

OperationalErrorTraceback (most recent call last)
<ipython-input-21-6f2defeb0d9b> in <module>()
      5 
      6 engine = create_engine('mysql+pymysql://commonswiki.labsdb/commonswiki_p?read_default_file=%s' % os.path.expanduser('~/replica.my.cnf'))
----> 7 pd.read_sql('SELECT * FROM recentchanges LIMIT 3', engine)

/srv/paws/lib/python3.4/site-packages/pandas/io/sql.py in read_sql(sql, con, index_col, coerce_float, params, parse_dates, columns, chunksize)
    513             sql, index_col=index_col, params=params,
    514             coerce_float=coerce_float, parse_dates=parse_dates,
--> 515             chunksize=chunksize)
    516 
    517 

/srv/paws/lib/python3.4/site-packages/pandas/io/sql.py in read_query(self, sql, index_col, coerce_float, parse_dates, params, chunksize)
   1188         args = _convert_params(sql, params)
   1189 
-> 1190         result = self.execute(*args)
   1191         columns = result.keys()
   1192 

/srv/paws/lib/python3.4/site-packages/pandas/io/sql.py in execute(self, *args, **kwargs)
   1079     def execute(self, *args, **kwargs):
   1080         """Simple passthrough to SQLAlchemy connectable"""
-> 1081         return self.connectable.execute(*args, **kwargs)
   1082 
   1083     def read_table(self, table_name, index_col=None, coerce_float=True,

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in execute(self, statement, *multiparams, **params)
   1988         """
   1989 
-> 1990         connection = self.contextual_connect(close_with_result=True)
   1991         return connection.execute(statement, *multiparams, **params)
   1992 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in contextual_connect(self, close_with_result, **kwargs)
   2037         return self._connection_cls(
   2038             self,
-> 2039             self._wrap_pool_connect(self.pool.connect, None),
   2040             close_with_result=close_with_result,
   2041             **kwargs)

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   2076             if connection is None:
   2077                 Connection._handle_dbapi_exception_noconnection(
-> 2078                     e, dialect, self)
   2079             else:
   2080                 util.reraise(*sys.exc_info())

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _handle_dbapi_exception_noconnection(cls, e, dialect, engine)
   1403             util.raise_from_cause(
   1404                 sqlalchemy_exception,
-> 1405                 exc_info
   1406             )
   1407         else:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/compat.py in raise_from_cause(exception, exc_info)
    198     exc_type, exc_value, exc_tb = exc_info
    199     cause = exc_value if exc_value is not exception else None
--> 200     reraise(type(exception), exception, tb=exc_tb, cause=cause)
    201 
    202 if py3k:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/compat.py in reraise(tp, value, tb, cause)
    181             value.__cause__ = cause
    182         if value.__traceback__ is not tb:
--> 183             raise value.with_traceback(tb)
    184         raise value
    185 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _wrap_pool_connect(self, fn, connection)
   2072         dialect = self.dialect
   2073         try:
-> 2074             return fn()
   2075         except dialect.dbapi.Error as e:
   2076             if connection is None:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in connect(self)
    374         """
    375         if not self._use_threadlocal:
--> 376             return _ConnectionFairy._checkout(self)
    377 
    378         try:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _checkout(cls, pool, threadconns, fairy)
    711     def _checkout(cls, pool, threadconns=None, fairy=None):
    712         if not fairy:
--> 713             fairy = _ConnectionRecord.checkout(pool)
    714 
    715             fairy._pool = pool

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in checkout(cls, pool)
    478     @classmethod
    479     def checkout(cls, pool):
--> 480         rec = pool._do_get()
    481         try:
    482             dbapi_connection = rec.get_connection()

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _do_get(self)
   1058                 except:
   1059                     with util.safe_reraise():
-> 1060                         self._dec_overflow()
   1061             else:
   1062                 return self._do_get()

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py in __exit__(self, type_, value, traceback)
     58             exc_type, exc_value, exc_tb = self._exc_info
     59             self._exc_info = None   # remove potential circular references
---> 60             compat.reraise(exc_type, exc_value, exc_tb)
     61         else:
     62             if not compat.py3k and self._exc_info and self._exc_info[1]:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/util/compat.py in reraise(tp, value, tb, cause)
    182         if value.__traceback__ is not tb:
    183             raise value.with_traceback(tb)
--> 184         raise value
    185 
    186 else:

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _do_get(self)
   1055             if self._inc_overflow():
   1056                 try:
-> 1057                     return self._create_connection()
   1058                 except:
   1059                     with util.safe_reraise():

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in _create_connection(self)
    321         """Called by subclasses to create a new ConnectionRecord."""
    322 
--> 323         return _ConnectionRecord(self)
    324 
    325     def _invalidate(self, connection, exception=None):

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in __init__(self, pool)
    447     def __init__(self, pool):
    448         self.__pool = pool
--> 449         self.connection = self.__connect()
    450         self.finalize_callback = deque()
    451 

/srv/paws/lib/python3.4/site-packages/sqlalchemy/pool.py in __connect(self)
    605         try:
    606             self.starttime = time.time()
--> 607             connection = self.__pool._invoke_creator(self)
    608             self.__pool.logger.debug("Created new connection %r", connection)
    609             return connection

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/strategies.py in connect(connection_record)
     95                         if connection is not None:
     96                             return connection
---> 97                 return dialect.connect(*cargs, **cparams)
     98 
     99             creator = pop_kwarg('creator', connect)

/srv/paws/lib/python3.4/site-packages/sqlalchemy/engine/default.py in connect(self, *cargs, **cparams)
    383 
    384     def connect(self, *cargs, **cparams):
--> 385         return self.dbapi.connect(*cargs, **cparams)
    386 
    387     def create_connect_args(self, url):

/srv/paws/lib/python3.4/site-packages/pymysql/__init__.py in Connect(*args, **kwargs)
     86     """
     87     from .connections import Connection
---> 88     return Connection(*args, **kwargs)
     89 
     90 from pymysql import connections as _orig_conn

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in __init__(self, host, user, password, database, port, unix_socket, charset, sql_mode, read_default_file, conv, use_unicode, client_flag, cursorclass, init_command, connect_timeout, ssl, read_default_group, compress, named_pipe, no_delay, autocommit, db, passwd, local_infile, max_allowed_packet, defer_connect, auth_plugin_map)
    677             self.socket = None
    678         else:
--> 679             self.connect()
    680 
    681     def _create_ssl_ctx(self, sslp):

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in connect(self, sock)
    889 
    890             self._get_server_information()
--> 891             self._request_authentication()
    892 
    893             if self.sql_mode is not None:

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in _request_authentication(self)
   1095 
   1096         self.write_packet(data)
-> 1097         auth_packet = self._read_packet()
   1098 
   1099         # if authentication method isn't accepted the first byte

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in _read_packet(self, packet_type)
    964 
    965         packet = packet_type(buff, self.encoding)
--> 966         packet.check_error()
    967         return packet
    968 

/srv/paws/lib/python3.4/site-packages/pymysql/connections.py in check_error(self)
    392             errno = self.read_uint16()
    393             if DEBUG: print("errno =", errno)
--> 394             err.raise_mysql_exception(self._data)
    395 
    396     def dump(self):

/srv/paws/lib/python3.4/site-packages/pymysql/err.py in raise_mysql_exception(data)
    118 def raise_mysql_exception(data):
    119     errinfo = _get_error_info(data)
--> 120     _check_mysql_exception(errinfo)

/srv/paws/lib/python3.4/site-packages/pymysql/err.py in _check_mysql_exception(errinfo)
    110     errorclass = error_map.get(errno, None)
    111     if errorclass:
--> 112         raise errorclass(errno, errorvalue)
    113 
    114     # couldn't find the right error number

OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'tools.paws'@'10.68.23.37' (using password: NO)")