Module Expr Str ImportFrom alias alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad Str body Return AttributeLoad NameLoad attr orelse Return AttributeLoad AttributeLoad NameLoad attr attr decorator_list NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults kwarg body Return BinOpAdd BinOpAdd Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Str Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr Str Str decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr Str Str decorator_list decorator_list ClassDef bases NameLoad body Assign NameStore Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam defaults body Return Call NameLoad Str decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore BoolOpAnd CompareGt AttributeLoad NameLoad attr TupleLoad Num Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Call AttributeLoad AttributeLoad NameLoad attr attr Str If NameLoad body Assign NameStore ListLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Call NameLoad keyword Str Str orelse Assign NameStore ListLoad Return Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str NameLoad Assign NameStore Dict Assign NameStore ListLoad Str Str Str Str Str For NameStore NameLoad body If CompareIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Slice Num NameLoad Delete SubscriptDel NameLoad Index NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Num If CompareIsNot AttributeLoad NameLoad attr NameLoad body TryExcept body Assign NameStore AttributeLoad AttributeLoad Call NameLoad BinOpAdd AttributeLoad AttributeLoad NameLoad attr attr Str attr attr AugAssignBitOr NameStore AttributeLoad NameLoad attr handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return ListLoad ListLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr Str For NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr body TryExcept body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str TryExcept body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str Return Str orelse Return Call NameLoad decorator_list Assign NameStore Call NameLoad ListLoad Str Str Str Str Str FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list Assign NameStore NameLoad
N/A N/A 

.. dialect:: mysql+mysqldb
    :name: MySQL-Python
    :dbapi: mysqldb
    :connectstring: mysql+mysqldb://<user>:<password>@<host>[:<port>]/<dbname>
    :url: http://sourceforge.net/projects/mysql-python

.. _mysqldb_unicode:

Unicode
-------

Please see :ref:`mysql_unicode` for current recommendations on unicode
handling.

Py3K Support
------------

Currently, MySQLdb only runs on Python 2 and development has been stopped.
`mysqlclient`_ is fork of MySQLdb and provides Python 3 support as well
as some bugfixes.

.. _mysqlclient: https://github.com/PyMySQL/mysqlclient-python

Using MySQLdb with Google Cloud SQL
-----------------------------------

Google Cloud SQL now recommends use of the MySQLdb dialect.  Connect
using a URL like the following::

    mysql+mysqldb://root@/<dbname>?unix_socket=/cloudsql/<projectid>:<instancename>

 base MySQLDialect MySQLExecutionContext MySQLCompiler MySQLIdentifierPreparer base TEXT N/A sql N/A util N/A re MySQLExecutionContext_mysqldb N/A MySQLExecutionContext N/A rowcount N/A N/A self N/A N/A N/A N/A hasattr self _rowcount N/A N/A N/A self _rowcount N/A N/A N/A N/A self cursor rowcount N/A property N/A MySQLCompiler_mysqldb N/A MySQLCompiler N/A visit_mod_binary N/A N/A self binary operator N/A kw N/A N/A N/A N/A N/A N/A self process N/A binary left kw  %%  N/A N/A self process N/A binary right kw N/A post_process_text N/A N/A self text N/A N/A N/A N/A N/A text replace % %% N/A N/A MySQLIdentifierPreparer_mysqldb N/A MySQLIdentifierPreparer N/A _escape_identifier N/A N/A self value N/A N/A N/A value N/A N/A value replace N/A self escape_quote N/A self escape_to_quote N/A N/A N/A value replace % %% N/A N/A MySQLDialect_mysqldb N/A MySQLDialect N/A N/A driver mysqldb N/A supports_unicode_statements True N/A supports_sane_rowcount True N/A supports_sane_multi_rowcount True N/A supports_native_decimal True N/A default_paramstyle format N/A execution_ctx_cls MySQLExecutionContext_mysqldb N/A statement_compiler MySQLCompiler_mysqldb N/A preparer MySQLIdentifierPreparer_mysqldb dbapi N/A N/A cls N/A N/A N/A N/A __import__ MySQLdb N/A classmethod do_executemany N/A N/A self cursor statement parameters context N/A None N/A N/A rowcount N/A N/A cursor executemany statement parameters N/A N/A context None N/A N/A N/A context _rowcount rowcount N/A _check_unicode_returns N/A N/A self connection N/A N/A N/A has_utf8_bin N/A N/A N/A self server_version_info N/A 5 N/A N/A connection scalar N/A show collation where %s = 'utf8' and %s = 'utf8_bin' N/A N/A N/A N/A self identifier_preparer quote Charset N/A N/A N/A self identifier_preparer quote Collation N/A has_utf8_bin N/A N/A additional_tests N/A N/A N/A sql collate N/A N/A sql cast N/A N/A sql literal_column 'test collated returns' N/A TEXT charset utf8 utf8_bin N/A N/A additional_tests N/A N/A N/A N/A N/A super MySQLDialect_mysqldb self _check_unicode_returns connection additional_tests N/A create_connect_args N/A N/A self url N/A N/A N/A opts N/A N/A url translate_connect_args database db username user password passwd N/A N/A N/A opts update N/A url query N/A N/A N/A util coerce_kw_type opts compress bool N/A N/A N/A util coerce_kw_type opts connect_timeout int N/A N/A N/A util coerce_kw_type opts read_timeout int N/A N/A N/A util coerce_kw_type opts client_flag int N/A N/A N/A util coerce_kw_type opts local_infile int N/A N/A N/A util coerce_kw_type opts use_unicode bool N/A N/A N/A util coerce_kw_type opts charset str N/A ssl N/A N/A keys N/A ssl_ca ssl_key ssl_cert ssl_capath ssl_cipher N/A key keys N/A N/A N/A key opts N/A N/A N/A ssl N/A N/A key N/A 4 N/A opts N/A key N/A N/A N/A util coerce_kw_type ssl N/A key N/A 4 str N/A N/A opts N/A key N/A ssl N/A N/A N/A opts N/A ssl ssl N/A client_flag N/A N/A opts get client_flag 0 N/A N/A N/A self dbapi None N/A N/A N/A N/A CLIENT_FLAGS N/A N/A N/A __import__ N/A N/A N/A self dbapi __name__ .constants.CLIENT constants CLIENT N/A client_flag N/A CLIENT_FLAGS FOUND_ROWS N/A N/A N/A N/A AttributeError ImportError N/A N/A N/A self supports_sane_rowcount False N/A N/A opts N/A client_flag client_flag N/A N/A N/A opts N/A _get_server_version_info N/A N/A self connection N/A N/A N/A dbapi_con N/A connection connection N/A version N/A N/A r N/A N/A re compile [.\-] N/A n N/A N/A r split N/A N/A dbapi_con get_server_info N/A N/A N/A N/A N/A N/A version append N/A int n N/A N/A N/A ValueError N/A N/A N/A N/A version append n N/A N/A tuple version N/A _extract_error_code N/A N/A self exception N/A N/A N/A N/A N/A exception args N/A 0 N/A _detect_charset N/A N/A self connection N/A N/A N/A Sniff out the character set in use for connection results. N/A N/A N/A cset_name N/A N/A connection connection character_set_name N/A N/A N/A AttributeError N/A N/A N/A N/A util warn No 'character_set_name' can be detected with this MySQL-Python version; please upgrade to a recent version of MySQL-Python.  Assuming latin1. N/A latin1 N/A N/A N/A cset_name N/A N/A _isolation_lookup N/A set N/A SERIALIZABLE READ UNCOMMITTED READ COMMITTED REPEATABLE READ AUTOCOMMIT _set_isolation_level N/A N/A self connection level N/A N/A N/A N/A level AUTOCOMMIT N/A N/A N/A N/A connection autocommit True N/A N/A N/A N/A connection autocommit False N/A N/A N/A N/A super MySQLDialect_mysqldb self _set_isolation_level connection level N/A N/A N/A dialect MySQLDialect_mysqldb