[Jc@s dZddkZddkZddkZddkZddkZddklZddkl Z l Z l Z l Z l Z ddklZddklZddklZddklZlZdd klZd d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)f Zed*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddd*dddddgZeideieiBZ eideieiBZ!de"fdYZ#de"fdYZ$dei%e#fdYZ&de&fdYZ'dei(e#fdYZ)de)fdYZ*dei(e#fdYZ+dei,e#fdYZ-d e-fdYZ.d e-fdYZ/d&e-fdYZ0d ei1e-fd YZ2d ei3fd!YZ4dei5fd"YZ6dei7fd#YZ8d#ei9fd$YZ:d$ei;fd%YZ<d)ei3fd&YZ=d"e$ei>fd'YZ?d'e?fd(YZ@de?fd)YZAde?fd*YZBd!e$eiCfd+YZDde$eiEfd,YZFde$eiCfd-YZGde$eiEfd.YZHd/eiIfd0YZJd(eJfd1YZKd eJfd2YZLdeJfd3YZMd%eMfd4YZNdeMfd5YZOdeMfd6YZPdeDfd7YZQdeDfd8YZRdeiSfd9YZThe-ei,6e2ei16e&ei%6e+ei(6e6ei56e8ei76e:ei96eDeiC6eMeiI6eTeiS6e?ei>6eFeiE6eHeiU6e<ei;6eMeiV6e)e)6e*e*6eJeJ6ZWh"e.d56eLd66e4d:6eMd76eTd;6eFd>6e8d<6e6d=6e'dU6e)d`6eQd>6e'd?6e+dm6e-d6e-d6ePd6eBd6eOd6e/d6eAd6eHd@6eGdA6e&d6eRd6e2d6e?dB6e:dC6e<dD6eNd6e0d6e@d6eKd6eDd6e=dE6ZXdFeiYfdGYZZdHei[fdIYZ\dJe"fdKYZ]dLei^fdMYZ_dNei`fdOYZadPeibfdQYZcdRe"fdSYZde ieeddTeiffdUYZgdVegfdWYZhdXegfdYYZiejdZZkejd[Zlejd\Zmd]Zne\Zoe_eo_peaeo_qeceo_reZeo_sdS(^sSupport for the MySQL database. Overview -------- For normal SQLAlchemy usage, importing this module is unnecessary. It will be loaded on-demand when a MySQL connection is needed. The generic column types like :class:`~sqlalchemy.String` and :class:`~sqlalchemy.Integer` will automatically be adapted to the optimal matching MySQL column type. But if you would like to use one of the MySQL-specific or enhanced column types when creating tables with your :class:`~sqlalchemy.Table` definitions, then you will need to import them from this module:: from sqlalchemy.databases import mysql Table('mytable', metadata, Column('id', Integer, primary_key=True), Column('ittybittyblob', mysql.MSTinyBlob), Column('biggy', mysql.MSBigInteger(unsigned=True))) All standard MySQL column types are supported. The OpenGIS types are available for use via table reflection but have no special support or mapping to Python classes. If you're using these types and have opinions about how OpenGIS can be smartly integrated into SQLAlchemy please join the mailing list! Supported Versions and Features ------------------------------- SQLAlchemy supports 6 major MySQL versions: 3.23, 4.0, 4.1, 5.0, 5.1 and 6.0, with capabilities increasing with more modern servers. Versions 4.1 and higher support the basic SQL functionality that SQLAlchemy uses in the ORM and SQL expressions. These versions pass the applicable tests in the suite 100%. No heroic measures are taken to work around major missing SQL features- if your server version does not support sub-selects, for example, they won't work in SQLAlchemy either. Currently, the only DB-API driver supported is `MySQL-Python` (also referred to as `MySQLdb`). Either 1.2.1 or 1.2.2 are recommended. The alpha, beta and gamma releases of 1.2.1 and 1.2.2 should be avoided. Support for Jython and IronPython is planned. ===================================== =============== Feature Minimum Version ===================================== =============== sqlalchemy.orm 4.1.1 Table Reflection 3.23.x DDL Generation 4.1.1 utf8/Full Unicode Connections 4.1.1 Transactions 3.23.15 Two-Phase Transactions 5.0.3 Nested Transactions 5.0.3 ===================================== =============== See the official MySQL documentation for detailed information about features supported in any given server release. Character Sets -------------- Many MySQL server installations default to a ``latin1`` encoding for client connections. All data sent through the connection will be converted into ``latin1``, even if you have ``utf8`` or another character set on your tables and columns. With versions 4.1 and higher, you can change the connection character set either through server configuration or by including the ``charset`` parameter in the URL used for ``create_engine``. The ``charset`` option is passed through to MySQL-Python and has the side-effect of also enabling ``use_unicode`` in the driver by default. For regular encoded strings, also pass ``use_unicode=0`` in the connection arguments:: # set client encoding to utf8; all strings come back as unicode create_engine('mysql:///mydb?charset=utf8') # set client encoding to utf8; all strings come back as utf8 str create_engine('mysql:///mydb?charset=utf8&use_unicode=0') Storage Engines --------------- Most MySQL server installations have a default table type of ``MyISAM``, a non-transactional table type. During a transaction, non-transactional storage engines do not participate and continue to store table changes in autocommit mode. For fully atomic transactions, all participating tables must use a transactional engine such as ``InnoDB``, ``Falcon``, ``SolidDB``, `PBXT`, etc. Storage engines can be elected when creating tables in SQLAlchemy by supplying a ``mysql_engine='whatever'`` to the ``Table`` constructor. Any MySQL table creation option can be specified in this syntax:: Table('mytable', metadata, Column('data', String(32)), mysql_engine='InnoDB', mysql_charset='utf8' ) Keys ---- Not all MySQL storage engines support foreign keys. For ``MyISAM`` and similar engines, the information loaded by table reflection will not include foreign keys. For these tables, you may supply a :class:`~sqlalchemy.ForeignKeyConstraint` at reflection time:: Table('mytable', metadata, ForeignKeyConstraint(['other_id'], ['othertable.other_id']), autoload=True ) When creating tables, SQLAlchemy will automatically set ``AUTO_INCREMENT``` on an integer primary key column:: >>> t = Table('mytable', metadata, ... Column('mytable_id', Integer, primary_key=True) ... ) >>> t.create() CREATE TABLE mytable ( id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) You can disable this behavior by supplying ``autoincrement=False`` to the :class:`~sqlalchemy.Column`. This flag can also be used to enable auto-increment on a secondary column in a multi-column key for some storage engines:: Table('mytable', metadata, Column('gid', Integer, primary_key=True, autoincrement=False), Column('id', Integer, primary_key=True) ) SQL Mode -------- MySQL SQL modes are supported. Modes that enable ``ANSI_QUOTES`` (such as ``ANSI``) require an engine option to modify SQLAlchemy's quoting style. When using an ANSI-quoting mode, supply ``use_ansiquotes=True`` when creating your ``Engine``:: create_engine('mysql://localhost/test', use_ansiquotes=True) This is an engine-wide option and is not toggleable on a per-connection basis. SQLAlchemy does not presume to ``SET sql_mode`` for you with this option. For the best performance, set the quoting style server-wide in ``my.cnf`` or by supplying ``--sql-mode`` to ``mysqld``. You can also use a :class:`sqlalchemy.pool.Pool` listener hook to issue a ``SET SESSION sql_mode='...'`` on connect to configure each connection. If you do not specify ``use_ansiquotes``, the regular MySQL quoting style is used by default. If you do issue a ``SET sql_mode`` through SQLAlchemy, the dialect must be updated if the quoting style is changed. Again, this change will affect all connections:: connection.execute('SET sql_mode="ansi"') connection.dialect.use_ansiquotes = True MySQL SQL Extensions -------------------- Many of the MySQL SQL extensions are handled through SQLAlchemy's generic function and operator support:: table.select(table.c.password==func.md5('plaintext')) table.select(table.c.username.op('regexp')('^[a-d]')) And of course any valid MySQL statement can be executed as a string as well. Some limited direct support for MySQL extensions to SQL is currently available. * SELECT pragma:: select(..., prefixes=['HIGH_PRIORITY', 'SQL_SMALL_RESULT']) * UPDATE with LIMIT:: update(..., mysql_limit=10) Troubleshooting --------------- If you have problems that seem server related, first check that you are using the most recent stable MySQL-Python package available. The Database Notes page on the wiki at http://www.sqlalchemy.org is a good resource for timely information affecting MySQL in SQLAlchemy. iN(tarray(texctlogtschematsqltutil(t operators(t functions(tcompiler(tbasetdefault(ttypest MSBigIntegertMSMediumIntegertMSBinarytMSBittMSBlobt MSBooleantMSChartMSDatet MSDateTimet MSDecimaltMSDoubletMSEnumtMSFloatt MSIntegert MSLongBlobt MSLongTextt MSMediumBlobt MSMediumTexttMSNChart MSNVarChart MSNumerictMSSettMSSmallIntegertMSStringtMSTexttMSTimet MSTimeStampt MSTinyBlobt MSTinyIntegert MSTinyTextt MSVarBinarytMSYeart accessibletaddtalltaltertanalyzetandtastasct asensitivetbeforetbetweentbiginttbinarytblobtbothtbytcalltcascadetcasetchangetchart charactertchecktcollatetcolumnt conditiont constrainttcontinuetconverttcreatetcrosst current_datet current_timetcurrent_timestampt current_usertcursortdatabaset databasestday_hourtday_microsecondt day_minutet day_secondtdectdecimaltdeclareR tdelayedtdeletetdesctdescribet deterministictdistinctt distinctrowtdivtdoubletdroptdualteachtelsetelseiftenclosedtescapedtexiststexittexplaintfalsetfetchtfloattfloat4tfloat8tfortforcetforeigntfromtfulltexttgranttgroupthavingt high_prioritythour_microsecondt hour_minutet hour_secondtiftignoretintindextinfiletinnertinoutt insensitivetinserttinttint1tint2tint3tint4tint8tintegertintervaltintotistiteratetjointkeytkeystkilltleadingtleavetlefttliketlimittlineartlinestloadt localtimetlocaltimestamptlocktlongtlongblobtlongtexttloopt low_prioritytmaster_ssl_verify_server_certtmatcht mediumblobt mediumintt mediumtextt middleinttminute_microsecondt minute_secondtmodtmodifiestnaturaltnottno_write_to_binlogtnulltnumerictontoptimizetoptiont optionallytortordertouttoutertoutfilet precisiontprimaryt proceduretpurgetrangetreadtreadst read_onlyt read_writetrealt referencestregexptreleasetrenametrepeattreplacetrequiretrestricttreturntrevoketrighttrlikeRtschemastsecond_microsecondtselectt sensitivet separatortsettshowtsmallinttspatialtspecificRt sqlexceptiontsqlstatet sqlwarningtsql_big_resulttsql_calc_found_rowstsql_small_resulttssltstartingt straight_jointtablet terminatedtthenttinyblobttinyintttinytextttottrailingttriggerttruetundotuniontuniquetunlocktunsignedtupdatetusagetusetusingtutc_datetutc_timet utc_timestamptvaluest varbinarytvarchart varcharactertvaryingtwhentwheretwhiletwithtwritetx509txort year_monthtzerofilltcolumnstfieldst privilegestsonamettabless@\s*(?:UPDATE|INSERT|CREATE|DELETE|DROP|ALTER|LOAD +DATA|REPLACE)s%\s*SET\s+(?:(?:GLOBAL|SESSION)\s+)?\wt _NumericTypecBs eZdZdZdZRS(sBase for MySQL numeric types.cCs.|idt|_|idt|_dS(NRR (tpoptFalseRR (tselftkw((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt__init__scCs4|io|d7}n|io|d7}n|S(sAExtend a numeric-type declaration with MySQL specific extensions.s UNSIGNEDs ZEROFILL(RR (Rtspec((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt_extends   (t__name__t __module__t__doc__RR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs t _StringTypecBs;eZdZddeeeedZdZdZRS(sBase for MySQL string types.cKsF||_|id||_||_||_||_||_dS(NRC(tcharsettgett collationtasciitunicodeR8tnational(RRRRRR8R tkwargs((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR#s     cCs |iod|i}n/|io d}n|io d}nd}|iod|i}n|io d}nd}|ioCdig}d||fD]}|dj o ||qq~Sdig}|||fD]}|dj o ||qq~S( sExtend a string-type declaration with standard SQL CHARACTER SET / COLLATE annotations and MySQL specific extensions. sCHARACTER SET %stASCIItUNICODEs COLLATE %stBINARYt tNATIONALN(RRRtNoneRR8R R(RRRRt_[1]tct_[2]((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR.s"          # cCsti|idd}|ititiddh}xE|D]=}t||}|dj o|tj o|||/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt__repr__Js! N(RRRR'RRRR5(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s   cBs;eZdZddedZdZdZdZRS(sMySQL NUMERIC type.i icKs3ti||tii|||d||dS(s#Construct a NUMERIC. :param precision: Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. :param scale: The number of digits after the decimal point. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. t asdecimalN(RRtsqltypestNumeric(RRtscaleR6R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR[scCsG|idjo|idS|idh|id6|id6SdS(NtNUMERICs!NUMERIC(%(precision)s, %(scale)s)RR9(RR'RR9(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt get_col_specnscCsdS(N(R'(Rtdialect((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytbind_processortscCs |ipd}|SdSdS(NcSs&t|tio t|S|SdS(N(t isinstanceRWtDecimalRn(tvalue((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytprocessys (R6R'(RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytresult_processorws  (RRRtTrueRR;R=RB(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR Xs   cBs)eZdZddedZdZRS(sMySQL DECIMAL type.i icKs&tt|i||d||dS(s#Construct a DECIMAL. :param precision: Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. :param scale: The number of digits after the decimal point. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. R6N(tsuperRR(RRR9R6R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCss|idjo|idS|idjo|idh|id6S|idh|id6|id6SdS(NtDECIMALsDECIMAL(%(precision)s)Rs!DECIMAL(%(precision)s, %(scale)s)R9(RR'RR9(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s (RRRRCRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscBs)eZdZddedZdZRS(sMySQL DOUBLE type.cKs|djo |dj p|dj o |djotidnti||tii|d||||_||_dS(s"Construct a DOUBLE. :param precision: Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. :param scale: The number of digits after the decimal point. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. sBYou must specify both precision and scale or omit both altogether.R6N( R'Rt ArgumentErrorRRR7tFloatR9R(RRR9R6R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs  cCsW|idj o6|idj o&|idh|id6|id6S|idSdS(Ns DOUBLE(%(precision)s, %(scale)s)RR9tDOUBLE(RR'R9R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s    N(RRRR'RCRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRstMSRealcBs)eZdZddedZdZRS(sMySQL REAL type.cKsti|||||dS(s Construct a REAL. :param precision: Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. :param scale: The number of digits after the decimal point. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. N(RR(RRR9R6R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCsW|idj o6|idj o&|idh|id6|id6S|idSdS(NsREAL(%(precision)s, %(scale)s)RR9tREAL(RR'R9R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s    N(RRRR'RCRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRIscBs2eZdZddedZdZdZRS(sMySQL FLOAT type.cKs?ti||tii|d||||_||_dS(s!Construct a FLOAT. :param precision: Total digits in this number. If scale and precision are both None, values are stored to limits allowed by the server. :param scale: The number of digits after the decimal point. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. R6N(RRR7RGR9R(RRR9R6R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cCsw|idj o.|idj o|id|i|ifS|idj o|id|ifS|idSdS(Ns FLOAT(%s, %s)s FLOAT(%s)tFLOAT(R9R'RR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s  cCsdS(N(R'(RR<((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR=sN(RRRR'RRR;R=(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cBs#eZdZddZdZRS(sMySQL INTEGER type.cKs`d|jo#tid|id|_n ||_ti||tii||dS(sConstruct an INTEGER. :param display_width: Optional, maximum display width for this number. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. tlengthsJ'length' is deprecated for MSInteger and subclasses. Use 'display_width'.N(Rtwarn_deprecatedRt display_widthRRR7tInteger(RRNR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s   cCs=|idj o|idh|id6S|idSdS(NsINTEGER(%(display_width)s)RNtINTEGER(RNR'R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;"sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s cBs#eZdZddZdZRS(sMySQL BIGINTEGER type.cKstt|i||dS(sConstruct a BIGINTEGER. :param display_width: Optional, maximum display width for this number. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. N(RDR R(RRNR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR,s cCs=|idj o|idh|id6S|idSdS(NsBIGINT(%(display_width)s)RNtBIGINT(RNR'R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;;sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR )s cBs#eZdZddZdZRS(sMySQL MEDIUMINTEGER type.cKstt|i||dS(sConstruct a MEDIUMINTEGER :param display_width: Optional, maximum display width for this number. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. N(RDR R(RRNR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyREs cCs=|idj o|idh|id6S|idSdS(NsMEDIUMINT(%(display_width)s)RNt MEDIUMINT(RNR'R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;TsN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR Bs cBs#eZdZddZdZRS(sMySQL TINYINT type.cKstt|i||dS(s6Construct a TINYINT. Note: following the usual MySQL conventions, TINYINT(1) columns reflected during Table(..., autoload=True) are treated as Boolean columns. :param display_width: Optional, maximum display width for this number. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. N(RDR(R(RRNR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR_scCs6|idj o|id|iS|idSdS(Ns TINYINT(%s)tTINYINT(RNR'R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;rsN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR(\s cBs#eZdZddZdZRS(sMySQL SMALLINTEGER type.cKs0||_ti||tii||dS(sConstruct a SMALLINTEGER. :param display_width: Optional, maximum display width for this number. :param unsigned: a boolean, optional. :param zerofill: Optional. If true, values will be stored as strings left-padded with zeros. Note that this does not effect the values returned by the underlying database API, which continue to be numeric. N(RNRRR7t SmallInteger(RRNR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR|s cCs=|idj o|idh|id6S|idSdS(NsSMALLINT(%(display_width)s)RNtSMALLINT(RNR'R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR"ys cBs,eZdZddZdZdZRS(sMySQL BIT type. This type is for MySQL 5.0.3 or greater for MyISAM, and 5.0.5 or greater for MyISAM, MEMORY, InnoDB and BDB. For older versions, use a MSTinyInteger() type. cCs ||_dS(sLConstruct a BIT. :param length: Optional, number of bits. N(RL(RRL((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCs d}|S(sBConvert a MySQL's 64 bit, variable length binary string to a long.cSsI|dj o8d}x%tt|D]}|d>|B}q#W|}n|S(Nli(R'tmaptord(R@tvti((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRAs  ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBs cCs$|idj o d|iSdSdS(NsBIT(%s)tBIT(RLR'(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s N(RRRR'RRBR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs  cBseZdZdZRS(sMySQL DATETIME type.cCsdS(NtDATETIME((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscBseZdZdZRS(sMySQL DATE type.cCsdS(NtDATE((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscBs eZdZdZdZRS(sMySQL TIME type.cCsdS(NtTIME((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;scCs d}|S(NcSsQ|dj o<ti|idd|idd|i|iddSdSdS(Ni<(R'tdatetimettimetseconds(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRAs <((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBs (RRRR;RB(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR%s cBseZdZdZRS(s-MySQL TIMESTAMP type. To signal the orm to automatically re-select modified rows to retrieve the updated timestamp, add a ``server_default`` to your :class:`~sqlalchemy.Column` specification:: from sqlalchemy.databases import mysql Column('updated', mysql.MSTimeStamp, server_default=sql.text('CURRENT_TIMESTAMP') ) The full range of MySQL 4.1+ TIMESTAMP defaults can be specified in the the default:: server_default=sql.text('CURRENT TIMESTAMP ON UPDATE CURRENT_TIMESTAMP') cCsdS(Nt TIMESTAMP((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR&scBs#eZdZddZdZRS(s<MySQL YEAR type, for single byte storage of years 1901-2155.cCs ||_dS(N(RN(RRN((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCs$|idjodSd|iSdS(NtYEARsYEAR(%s)(RNR'(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR+s cBs#eZdZddZdZRS(s0MySQL TEXT type, for text up to 2^16 characters.cKsEti||tii|||idt|idddS(scConstruct a TEXT. :param length: Optional, if provided the server may optimize storage by substituting the smallest TEXT type sufficient to store ``length`` characters. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param national: Optional. If true, use the server's configured national character set. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. tconvert_unicodetassert_unicodeN(RRR7tTextRRR'(RRLR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCs0|io|id|iS|idSdS(NsTEXT(%d)tTEXT(RLR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s N(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR$s cBs eZdZdZdZRS(s3MySQL TINYTEXT type, for text up to 2^8 characters.cKstt|i|dS(sConstruct a TINYTEXT. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param national: Optional. If true, use the server's configured national character set. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. N(RDR)R(RR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR$scCs |idS(NtTINYTEXT(R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;?s(RRRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR)!s cBs eZdZdZdZRS(s6MySQL MEDIUMTEXT type, for text up to 2^24 characters.cKstt|i|dS(sConstruct a MEDIUMTEXT. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param national: Optional. If true, use the server's configured national character set. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. N(RDRR(RR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRFscCs |idS(Nt MEDIUMTEXT(R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;`s(RRRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRCs cBs eZdZdZdZRS(s4MySQL LONGTEXT type, for text up to 2^32 characters.cKstt|i|dS(sConstruct a LONGTEXT. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param national: Optional. If true, use the server's configured national character set. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. N(RDRR(RR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRgscCs |idS(NtLONGTEXT(R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s(RRRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRds cBs#eZdZddZdZRS(s7MySQL VARCHAR type, for variable-length character data.cKsEti||tii|||idt|idddS(sConstruct a VARCHAR. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param national: Optional. If true, use the server's configured national character set. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. RcRdN(RRR7tStringRRR'(RRLR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCs0|io|id|iS|idSdS(Ns VARCHAR(%d)tVARCHAR(RLR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s N(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR#s cBs eZdZdZdZRS(s1MySQL CHAR type, for fixed-length character data.cKs6ti||tii|||idtdS(sConstruct an NCHAR. :param length: Maximum data length, in characters. :param binary: Optional, use the default binary collation for the national character set. This does not affect the type of data stored, use a BINARY type for binary data. :param collation: Optional, request a particular collation. Must be compatible with the national character set. RcN(RRR7tCHARRR(RRLR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cCs|idh|id6S(NsCHAR(%(length)s)RL(RRL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s(RRRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cBs#eZdZddZdZRS(sxMySQL NVARCHAR type. For variable-length character data in the server's configured national character set. cKs@t|d/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cCs|idh|id6S(NsVARCHAR(%(length)s)RL(RRL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cBs#eZdZddZdZRS(srMySQL NCHAR type. For fixed-length character data in the server's configured national character set. cKs@t|d/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cCs|idh|id6S(NsCHAR(%(length)s)RL(RRL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;sN(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs t _BinaryTypecBs eZdZdZdZRS(sBase for MySQL binary types.cCs|io d|iSdSdS(NsBLOB(%d)tBLOB(RL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s  cCs d}|S(NcSs#|djodSti|SdS(N(R'Rtbuffer(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRA s ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBs (RRRR;RB(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRms cBs#eZdZddZdZRS(s6MySQL VARBINARY type, for variable length binary data.cKstt|i||dS(slConstruct a VARBINARY. Arguments are: :param length: Maximum data length, in characters. N(RDR*R(RRLR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRscCs|io d|iSdSdS(Ns VARBINARY(%d)Rn(RL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s  N(RRRR'RR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR*s cBs,eZdZddZdZdZRS(s/MySQL BINARY type, for fixed length binary datacKstt|i||dS(s/Construct a BINARY. This is a fixed length type, and short values will be right-padded with a server-version-specific pad value. :param length: Maximum data length, in bytes. If length is not specified, this will generate a BLOB. This usage is deprecated. N(RDRR(RRLR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR%s cCs|io d|iSdSdS(Ns BINARY(%d)Rn(RL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;1s  cCs d}|S(NcSs#|djodSti|SdS(N(R'RRo(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRA8s ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRB7s N(RRRR'RR;RB(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR"s cBs5eZdZddZdZdZdZRS(s1MySQL BLOB type, for binary data up to 2^16 bytescKstt|i||dS(sConstruct a BLOB. Arguments are: :param length: Optional, if provided the server may optimize storage by substituting the smallest TEXT type sufficient to store ``length`` characters. N(RDRR(RRLR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBscCs|io d|iSdSdS(NsBLOB(%d)Rn(RL(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;Ls  cCs d}|S(NcSs#|djodSti|SdS(N(R'RRo(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRASs ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBRs cCsd|iiS(Ns%s()(R/R(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR5ZsN(RRRR'RR;RBR5(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR?s   cBseZdZdZRS(s5MySQL TINYBLOB type, for binary data up to 2^8 bytes.cCsdS(NtTINYBLOB((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;as(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR'^scBseZdZdZRS(s8MySQL MEDIUMBLOB type, for binary data up to 2^24 bytes.cCsdS(Nt MEDIUMBLOB((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;hs(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRescBseZdZdZRS(s6MySQL LONGBLOB type, for binary data up to 2^32 bytes.cCsdS(NtLONGBLOB((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;os(RRRR;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRlscBs)eZdZdZdZdZRS(sMySQL ENUM type.c Os|idd|_|idjod }x|D]r}t|djod|_Pn|d jo|d}n|d|jp|d|jod|_Pq2q2Wd|_n|idjotidg}xl|D]d}|dd!d jp|dd!d jo)|dd!i|dd |d}n|i|qW||_nt ||_|id t |_ t g}|iD]}|t|q~dg} t t|i| |d S(sConstruct an ENUM. Example: Column('myenum', MSEnum("foo", "bar", "baz")) Arguments are: :param enums: The range of valid values for this ENUM. Values will be quoted when generating the schema according to the quoting flag (see below). :param strict: Defaults to False: ensure that a given value is in this ENUM's range of permissible values when inserting or updating rows. Note that MySQL will not raise a fatal error if you attempt to store an out of range value- an alternate value will be stored instead. (See MySQL ENUM documentation.) :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. :param quoting: Defaults to 'auto': automatically determine enum value quoting. If all enum values are surrounded by the same quoting character, then use 'quoted' mode. Otherwise, use 'unquoted' mode. 'quoted': values in enums are already quoted, they will be used directly when generating the schema. 'unquoted': values in enums are not quoted, they will be escaped and surrounded by single quotes when generating the schema. Previous versions of this type always required manually quoted values to be supplied; future versions will always quote the string literals for you. This is a transitional option. tquotingtautoitunquoteditquoteds~Manually quoting ENUM value literals is deprecated. Supply unquoted values and use the quoting= option in cases of ambiguity.it"t'itstrictN(RRsR'tlenRtwarn_pending_deprecationRtappendtenumstlistRRytmaxRDRR( RR}Rtqtet strip_enumstaR(RXRL((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRvs83  "   () 7cs.tti|fd}|S(NcsXio4|dj o'|ijotid|no |S|SdS(Ns$"%s" not a valid value for this enum(RyR'R}RtInvalidRequestError(R@(Rt super_convert(s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRAs '  (RDRR=(RR<RA((RRs>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR=scCsQg}x.|iD]#}|id|iddqW|iddi|S(Ns'%s'Rxs''sENUM(%s)t,(R}R|RRR(Rt quoted_enumsR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s  !(RRRRR=R;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRss X cBs2eZdZdZdZdZdZRS(sMySQL SET type.cOs||_g}xl|D]d}|dd!djp|dd!djo)|dd!i|dd|d}n|i|qW||_tg}|D]}|t|q~dg}tt|i||dS(sConstruct a SET. Example:: Column('myset', MSSet("'foo'", "'bar'", "'baz'")) Arguments are: :param values: The range of valid values for this SET. Values will be used exactly as they appear when generating schemas. Strings must be quoted, as in the example above. Single-quotes are suggested for ANSI compatibility and are required for portability to servers with ANSI_QUOTES enabled. :param charset: Optional, a column-level character set for this string value. Takes precedence to 'ascii' or 'unicode' short-hand. :param collation: Optional, a column-level collation for this string value. Takes precedence to 'binary' short-hand. :param ascii: Defaults to False: short-hand for the ``latin1`` character set, generates ASCII in schema. :param unicode: Defaults to False: short-hand for the ``ucs2`` character set, generates UNICODE in schema. :param binary: Defaults to False: short-hand, pick the binary collation type that matches the column's character set. Generates BINARY in schema. This does not affect the type of data stored, only the collation of character data. iiRwRxiiN( t_MSSet__ddl_valuesRR|RRRzRDR!R(RRRt strip_valuesRR(RXRL((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs! () 4cCs d}|S(NcSsyt|tio=|p|idnt|tpt|}n|S|dj ot|idS|SdS(NtR(R>Rt set_typesR-RR'tsplit(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRAs ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBs cs+tt|i|fd}|S(Ncs|djpt|tttfonGd|jo*t|}|id|idndi|}o |S|SdS(NRR( R'R>RRt basestringRtremoveR-R(R@(R(s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRA(s&    (RDR!R=(RR<RA((Rs>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR=&s cCs|iddi|iS(NsSET(%s)R(RRR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;7s(RRRRRBR=R;(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR!s  .  cBs)eZdZdZdZdZRS(sMySQL BOOLEAN type.cCsdS(NtBOOL((R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;>scCs d}|S(NcSs$|djodS|otptS(N(R'RCR(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRABs ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRBAs cCs d}|S(NcSsL|tjodS|tjodS|djodS|otptSdS(Nii(RCRR'(R@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRAIs   ((RR<RA((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR=Hs (RRRR;RBR=(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR;s  tbittbooleantdateR^tenumtfixedtnchartnvarcharttextR_t timestamptyeartMySQLExecutionContextcBseZdZdZRS(cCs|iioU|i oJt|i p|iddjo!|iig|id|_qnN|i oB|i o7|i o-t i |i o|i iiddndS(NiitmysqlR(smysqlscharset(tcompiledtisinsertt executemanyRzt_last_inserted_idsR'ROt lastrowidtisupdatetshould_autocommitt statementtSET_RERt connectiontinfoR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt post_execs cCs ti|S(N(t AUTOCOMMIT_RER(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytshould_autocommit_texts(RRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs t MySQLDialectcBseZdZdZeZeZdZeZ dZ d*dZ dZ ee Z dZdZd*dZd Zd Zd Zd Zd ZeedZeedZdZdZdZdZeid+eZdZd*dZdZ eid,e Z dZ!dZ"d*dZ#dZ$eid-e$Z$dZ%eid.e%Z%d!Z&eid/e&Z&d#Z'e(d$e'd%d&Z'd*d'Z)d*d*d(Z*d*d*d)Z+RS(0sEDetails of the MySQL dialect. Not used directly in application code.RitformatcKs ||_tii||dS(N(tuse_ansiquotesR tDefaultDialectR(RRR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs cCsddk}|S(Ni(tMySQLdb(tclsR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdbapis c Cs|idddddd}|i|iti|dtti|dtti|d tti|d tti|d tti|d th}x^d ddddgD]G}||jo4||||d/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytcreate_connect_argss6  cCsti|tS(N(R7t adapt_typetcolspecs(Rttypeobj((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyttype_descriptorscCs0|i||}|dj o ||_ndS(N(RR't _rowcount(RRORt parameterstcontexttrowcount((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_executemanys cCstS(N(RC(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytsupports_unicode_statementsscCsiy|iWnT|i|djo4tidi}|o|ddjodSnnXdS( sExecute a COMMIT.iiiiii(N(iii(tcommitt_server_version_infotsystexc_infotargs(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt do_commits cCsiy|iWnT|i|djo4tidi}|o|ddjodSnnXdS( sExecute a ROLLBACK.iiiiii(N(iii(trollbackRRRR(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt do_rollbacks cCs|id|dS(Ns XA BEGIN %s(texecute(RRtxid((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_begin_twophasescCs$|id||id|dS(Ns XA END %ss XA PREPARE %s(R(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_prepare_twophasescCs/|p|id|n|id|dS(Ns XA END %ssXA ROLLBACK %s(R(RRRt is_preparedtrecover((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_rollback_twophase scCs/|p|i||n|id|dS(Ns XA COMMIT %s(RR(RRRRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_commit_twophasescCs=|id}g}|D]}||dd|d!q~S(Ns XA RECOVERtdatait gtrid_length(R(RRt resultsetR(trow((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_recover_twophasescCs|idS(N(tping(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdo_pingscCsWt||iio|iddjSt||iiodt|jStSdS( Niiiiiis(0, '')(iiiii(R>RtOperationalErrorRtInterfaceErrorRR(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt is_disconnects cCs|idiS(NsSELECT DATABASE()(Rtscalar(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytget_default_schema_name%sR<tdefault_schema_namecCsj|i|}|i||id|ii|}g}t|d|D]}||dqR~S(s1Return a Unicode SHOW TABLES from a given schema.sSHOW TABLES FROM %sRi(t_detect_charsett_autoset_identifier_styleRtidentifier_preparertquote_identifiert_compat_fetchall(RRRRtrpR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt table_names*s   c Cs|i|di|ii||}d|}d}zny0|i|}|idj}|i|SWn7ti j o(}|i i ddjot SnXWd|o|inXdS(Nt.s DESCRIBE %siiz( RRRt_quote_free_identifiersR'RRtcloseRtSQLErrortorigRR( RRt table_nameRt full_nametsttrsthaveR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt has_table3s"    cCs|i|iiS(sA tuple of the database server version. Formats the remote server version as a tuple of version values, e.g. ``(5, 0, 44)``. If there are strings in the version number they will be in the tuple too, so don't count on these all being ``int`` values. This is a fast check that does not require a round trip. It is also cached per-Connection. (RR(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytserver_version_infoSs RcCsyg}tid}xW|i|iD]@}y|it|Wq+tj o|i|q+Xq+Wt|S(s7Convert a MySQL-python server_info string into a tuple.s[.\-](tretcompileRtget_server_infoR|Rt ValueErrorttuple(Rt dbapi_contversiontrtn((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRcsc Cs|i|}|i|y |i}Wn_tj oS|i}|i|djo|iot|}nt||_}nX|i |||}|i do+|i |||}|i ||}n|i |||i||||d|S(s(Load column definitions from the server.iisCREATE ALGORITHMtonly(ii(RRt reflectortAttributeErrorRRRtMySQLIdentifierPreparertMySQLSchemaReflectort_show_create_tablet startswitht_describe_tablet_describe_to_createt_adjust_casingtreflect( RRRtinclude_columnsRRtpreparerRR ((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt reflecttableos"    cCsw|i|}|djoW|i|iijo>|ii|_ti|i|i}||ii|/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs &c Csd |ijo |id S|i|djo+y|iiSWq]tj oq]Xn|id}tg}t|D]}||d|dfq~}d|jo |dSy|iiSWn:tj o.d|jo |dSti d d SnXd S(s:Sniff out the character set in use for connection results.Rt force_charsetiiis%SHOW VARIABLES LIKE 'character_set%%'tcharacter_set_resultst character_setsCould not detect the connection character set with this combination of MySQL server and MySQL-python. MySQL-python >= 1.2.2 is recommended. Assuming latin1.tlatin1N(smysqlR%(smysqlR%(iii( RRRtcharacter_set_nameRRtdictRRtwarn(RRRR(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs&  ;    RcCs|i|}t|idd|}|p d}nQ|ddjo d}n,|ddjo d}nt|d}|i|S(sSniff out identifier case sensitivity. Cached per-connection. This value can not change without a server restart. s,SHOW VARIABLES LIKE 'lower_case_table_names'RiitOFFtON(Rt_compat_fetchoneRRR(RRRRtcs((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs        tlower_case_table_namescCsnh}|i|djonK|i|}|id}x)t||D]}|d||d/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt_detect_collationssR1cCsj||_|o t|_n t|_t|do|i||_nt|do |`ndS(NRR(t_use_ansiquotestMySQLANSIIdentifierPreparerRRthasattrRR(Rtuseansi((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs   cCs|iS((R3(ts((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytstdocs!True if ANSI_QUOTES is in effect.cCs|idj odSt|idd|}|p d}nM|dpd}|io.t|}|dB|jodpd}nd|j|_dS(sDetect and adjust for the ANSI_QUOTES sql mode. If the dialect's use_ansiquotes is unset, query the server's sql mode and reset the identifier style. Note that this currently *only* runs during reflection. Ideally this would run the first time a connection pool connects to the database, but the infrastructure for that is not yet in place. NsSHOW VARIABLES LIKE 'sql_mode'RRiit ANSI_QUOTES(RR'R.RtisdigitR(RRRRtmodetmode_no((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs     "c Cs|djo|ii|}nd|}d}zy|i|}WnEtij o6}|iiddjoti|qnXt |d|}|pti|n|di SWd|o|i nXt S(s&Run SHOW CREATE TABLE for a ``Table``.sSHOW CREATE TABLE %siizRiN( R'Rt format_tableRRRRRtNoSuchTableErrorR.tstripRR( RRRRRRRRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs$  c Cs|djo|ii|}nd|}d\}}zqy|i|}WnEtij o6}|iiddjoti|qnXt |d|}Wd|o|i nX|S(s7Run DESCRIBE for a ``Table`` and return processed rows.s DESCRIBE %siizRN(NN( R'RR>RRRRRR?RR( RRRRRRRtrowsR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR8s   N(sdialectR(smysqlsserver_version_info(smysqlscharset(smysqlR0(smysqls collations(,RRRRRCtsupports_alterRRtmax_identifier_lengthtsupports_sane_rowcounttdefault_paramstyleR'RRt classmethodRRRRRRRRRRRRRt engine_basetconnection_memoizeRRRRRRRRR2RtpropertyRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRsj    '               (      t_MySQLPythonRowProxycBs)eZdZdZdZdZRS(sReturn consistent column values for all versions of MySQL-python. Smooth over data type issues (esp. with alpha driver versions) and normalize strings as Unicode regardless of user-configured driver encoding settings. cCs||_||_dS(N(trowproxyR(RRKR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR[s cCs`|i|}t|to|i}n|io!t|to|i|iS|SdS(N(RKR>t_arrayttostringRRtdecode(RRtitem((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt __getitem__^s  cCset|i|}t|to|i}n|io!t|to|i|iS|SdS(N(R.RKR>RLRMRRRN(RR2RO((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt __getattr__fs (RRRRRPRQ(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRJOs  t MySQLCompilercBseZeiiiZeihdei6dei 6dei 6eii iZ e ihde i 6dd6eiiiZeihdd6dZd Zd Zd Zed Zd ZdZdZRS(cCsd||fS(sconcat(%s, %s)((txty((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR8sss%%cCsd||fS(s'MATCH (%s) AGAINST (%s IN BOOLEAN MODE)((RSRT((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR8uss rand%(expr)st UTC_TIMESTAMPRt millisecondt millisecondscCsI|ii|i}t|to t|dtodSdSnt|ttt t fo |i St|t odSt|t o;t|ttf o$t|do d|iSdSnzt|todSt|to|i idd St|tod St|tt t fo |i SdSdS( NRsUNSIGNED INTEGERsSIGNED INTEGERRlRLsCHAR(%s)R$R:RER[(ttypet dialect_implR<R>RR.RRRRR%R;R$RRR!RLRmR RR&R'(Rt typeclausettype_((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytvisit_typeclauses.   cKsJ|i|i}|djo|i|iSd|i|i|fS(NsCAST(%s AS %s)(RARZR'tclause(RtcastR!R[((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt visit_casts cCs.d|jotidn|iddS(Ns%%s[The SQLAlchemy MySQLDB dialect now automatically escapes '%' in text() expressions to '%%'.t%(RR+R(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytpost_process_texts cCs<t|ito|iidS|iodSdSdS(NR%s DISTINCT R(R>t _distinctRtupper(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytget_select_precolumnss  cKs]di|i|idt|iodpd|i|idtd|i|ifS(NRtasfroms LEFT OUTER JOIN s INNER JOIN s ON (RRARRCtisouterRtonclause(RRReR!((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt visit_joins cCs/|idjodStt|i|SdS(NRs LOCK IN SHARE MODE(t for_updateRDRRtfor_update_clause(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRjscCsm|i|i}}||fdjodS|dj o&|djo d}nd||fSd|fSdS(NRls LIMIT %s, %ss LIMIT %s(NN(t_limitt_offsetR'(RRRtoffset((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt limit_clauses    c Cs|iiht|igd6t|_|i|}d|ii|iddi g}|D]+}|d|ii |d|dfqf~}|i o|d|i |i 7}n|i id d}|o|d |7}n|iid |S( NRtsUPDATE s SET s, s%s=%siis WHERE t mysql_limits LIMIT %si(tstackR|RRRCRt_get_colparamsRR>Rt format_columnt _whereclauseRAR!RR'R(Rt update_stmtt colparamsR(R)RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt visit_updates# c (RRRtDefaultCompilerRtcopyRt sql_operatorst concat_opRtmatch_opRt sql_functionstrandomt extract_mapR\R_RaRdRRhRjRnRv(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRRps(             tMySQLSchemaGeneratorcBseZedZdZRS(cCs8|ii||ii|iig}|i|}|dj o|id|n|i p|idn|i o|i oyg}|i i i D]<}|i o,t|itio|i o ||qq~id}||jo|idnWq+tj oq+Xndi|S(sBuilds column DDL.sDEFAULT sNOT NULLitAUTO_INCREMENTR%N(RRrRXRYR<R;tget_column_default_stringR'R|tnullablet primary_keyt autoincrementRR R>R7ROt foreign_keysRt IndexErrorR(RRDtfirst_pktcolspecR R(R)tfirst((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytget_column_specifications$   (  cCsg}xu|iD]j}|idoT|di}d}|d jo d}n|i|i||i|fqqWdi|S( s9Build table-level CREATE options like ENGINE and COLLATE.tmysql_it=t TABLESPACEsDEFAULT CHARACTER SETs CHARACTER SETtCOLLATER%(RsDEFAULT CHARACTER SETs CHARACTER SETR(R!RRcR|R(RRt table_optsR4topttjoiner((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytpost_create_tables   +(RRRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs tMySQLSchemaDroppercBseZdZdZRS(cCsU|id|ii|i|it|i|ii|if|idS(Ns DROP INDEX %s ON %s( R|Rtquotet_validate_identifierRRR>RR(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyt visit_index"s $cCs@|id|ii|i|ii|f|idS(Ns"ALTER TABLE %s DROP FOREIGN KEY %s(R|RR>Rtformat_constraintR(RRF((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pytdrop_foreignkey(s (RRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR!s RcBseZdZdZddZdZddZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZRS(s Parses SHOW CREATE TABLE output.cCs||_|idS(sConstruct a MySQLSchemaReflector. identifier_preparer An ANSIIdentifierPreparer type, used to determine the identifier quoting style in effect. N(Rt _prep_regexes(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR2s c Csygg}}|ot|}nx%tid|D]}|id|iio|i||||q7|ido|i||q7|djoq7|ido|i||q7|pq7|i |\} } | d jot i d|q7| djo|i | q7| djo|i | q7q7W|i||||i||||d S( s1Parse MySQL SHOW CREATE TABLE and fill in a ''Table''. show_create Unicode output of SHOW CREATE TABLE table A ''Table'', to be loaded with Columns, Indexes, etc. table.name will be set if not already charset FIXME, some constructed values (like column defaults) currently can't be Unicode. ''charset'' will convert them into the connection character set. only An optional sequence of column names. If provided, only these columns will be reflected, and any keys or constraints that include columns outside this set will also be omitted. That means that if ``only`` includes only one column in a 2 part primary key, the entire primary key will be omitted. s\r?\ns s) t)sCREATE sUnknown schema content: %rRRFN(RRRRRt initial_quotet _add_columnt _set_optionst _set_nametparse_constraintsR'RR+R|t _set_keyst_set_constraints( RRRt show_createRRRt constraintstlineR[R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR=s2     cCs*|idjo|i||_ndS(sOverride a Table name with the reflected name. table A ``Table`` line The first line of SHOW CREATE TABLE output. N(RR't parse_name(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRus cCsy|i|}|ptid|dS|dptid|n|d|d|d|df\}}}} |o/||jo"|iid|i|fdS|d jo|d jod }d}nyt|} Wn3tj o'tid ||ft i } nX|djp |d jo g} nl|ddjo'|ddjo|i i |} n4g} |i i |D]} | t| q~ } h}x/dD]'}|i|tot||/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRsl .    "3    c Csx|D]}|d}g}|dD]}||dq&~}|oXt|i| oA|djo d}n|iid|di|fqnt} |djoti} t } nv|djoti |d d t } nL|djoti |d } n(|iid |ti |d } x=g} |D]} | |i | qK~ D]} | i | qfW| o|i | qqWdS(sAdd ``Index`` and ``PrimaryKeyConstraint`` items to a ``Table``. Most of the information gets dropped here- more is reflected than the schema objects can currently represent. table A ``Table`` keys A sequence of key specifications produced by `constraints` only Optional `set` of column names. If provided, keys covering columns not in this set will be omitted. RXR iRs6Omitting %s KEY for (%s), key covers ommitted columns.s, tPRIMARYtUNIQUERRtFULLTEXTtSPATIALs-Converting unknown KEY type %s to a plain KEYN(NRR(RtissubsetR'RRRRRtPrimaryKeyConstraintRCtIndexR)Rtappend_constraint(RRRRRtflavorR(R7t col_namesRFRR*Rtcol((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs6 )          )c Cs+d}x|D]}|dd}t|ddjo|ddp|i}|pD|djo|ii|}n|i|jo |i}qn|d} |o;t| i| o$|iiddi | q nti ||} | |i i jo|i i | } n(ti ||i d|d td |} |d } |o7g} | D]}| d i |||gqc~ }n1g}| D]}|d i ||gq~}h}x3dD]+}|i|to||||/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR sD/      70cCsb|i|}xdD]}|i|dqWx+|iD]\}}||id|/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR0 s  cCsg|_g|_h|_|ii}ttd,g}|ii||ii|fD]}|t i |qV~}t d||ii |_ td||_td|_td|_td||_td ||_td ||_|i}d |d (?:%(esc_fq)s|[^%(fq)s])+)%(fq)s +\($sF(?:(?:%(iq)s((?:%(esc_fq)s|[^%(fq)s])+)%(fq)s)(?:\((\d+)\))?(?=\,|$))+s\x27(?:\x27\x27|[^\x27])*\x27s\d+s- %(iq)s(?P(?:%(esc_fq)s|[^%(fq)s])+)%(fq)s +(?P\w+)(?:\((?P(?:\d+|\d+,\d+|(?:\x27(?:\x27\x27|[^\x27])*\x27,?)+))\))?(?: +(?PUNSIGNED))?(?: +(?PZEROFILL))?(?: +CHARACTER SET +(?P\w+))?(?: +COLLATE +(P\w+))?(?: +(?PNOT NULL))?(?: +DEFAULT +(?P(?:NULL|\x27(?:\x27\x27|[^\x27])*\x27|\w+)(?:ON UPDATE \w+)?))?(?: +(?PAUTO_INCREMENT))?(?: +COMMENT +(P(?:\x27\x27|[^\x27])+))?(?: +COLUMN_FORMAT +(?P\w+))?(?: +STORAGE +(?P\w+))?(?: +(?P.*))?,?$s %(iq)s(?P(?:%(esc_fq)s|[^%(fq)s])+)%(fq)s +(?P\w+)(?:\((?P(?:\d+|\d+,\d+|\x27(?:\x27\x27|[^\x27])+\x27))\))?.*?(?PNOT NULL)?s (?:(?P\S+) )?KEY(?: +%(iq)s(?P(?:%(esc_fq)s|[^%(fq)s])+)%(fq)s)?(?: +USING +(?P\S+))? +\((?P.+?)\)(?: +USING +(?P\S+))?(?: +KEY_BLOCK_SIZE +(?P\S+))?(?: +WITH PARSER +(?P\S+))?,?$s#RESTRICT|CASCASDE|SET NULL|NOACTIONRs, CONSTRAINT +%(iq)s(?P(?:%(esc_fq)s|[^%(fq)s])+)%(fq)s +FOREIGN KEY +\((?P[^\)]+?)\) REFERENCES +(?P%(iq)s[^%(fq)s]+%(fq)s(?:\.%(iq)s[^%(fq)s]+%(fq)s)?) +\((?P[^\)]+?)\)(?: +(?PMATCH \w+))?(?: +ON DELETE (?P%(on)s))?(?: +ON UPDATE (?P%(on)s))?s (?:SUB)?PARTITIONtENGINEtTYPERtAVG_ROW_LENGTHs CHARACTER SETsDEFAULT CHARSETtCHECKSUMRtDELAY_KEY_WRITEt INSERT_METHODtMAX_ROWStMIN_ROWSt PACK_KEYSt ROW_FORMATtKEY_BLOCK_SIZEtCOMMENTtDATA_DIRECTORYtINDEX_DIRECTORYtPASSWORDt CONNECTIONtUNIONs \([^\)]+\)Rs.*? STORAGE DISKt RAID_TYPEs4\w+\s+RAID_CHUNKS\s*\=\s*\w+RAID_CHUNKSIZE\s*=\s*\w+s\s*=\s*$RN(RRR(RRsAUTO_INCREMENTRs CHARACTER SETsDEFAULT CHARSETRsCOLLATERRRRRRR(RRRRR(t _re_columnst _pr_optionst_re_options_utilRt final_quoteR*tzipRt_escape_identifierRtescapet _pr_compilet_unescape_identifiert_pr_namet _re_compilet _re_keyexprsRRt _re_columnt_re_column_looset_re_keyRxt_re_constraintt _re_partitiont_add_option_wordt_add_option_stringt_add_option_regex(Rt_finalR(R7tquotesRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRA sf      8         cCs3dti|}|iit|ddS(NsB(?P%s\s*(?:=\s*)?)(?:\x27.(?P.*?)\x27(?!\x27)\x27)cSs|iddS(s''Rx(R(RX((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR8 s(RRRR|R(Rt directivetregex((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR  s cCs-dti|}|iit|dS(Ns)(?P%s\s*(?:=\s*)?)(?P\w+)(RRRR|R(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR  scCs3dti||f}|iit|dS(Ns((?P%s\s*(?:=\s*)?)(?P%s)(RRRR|R(RRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR  scCs=|i\}}|i|}|pdS||idS(s\Extract the table name. line The first line of SHOW CREATE TABLE RN(RRR'Rw(RRRtcleanuptm((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s cCsl|ii|}|o|i}t|d<|S|ii|}|o|i}t|d<|SdS(sExtract column details. Falls back to a 'minimal support' variant if full parse fails. line Any column-bearing line from SHOW CREATE TABLE RN(RRt groupdictRCRRR'(RRRR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s     cCs+|ii|}|o.|i}|i|d|d/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s$   //  c Csh}| p |djo|S|id}x|iD]\}}|i|}|pq7n|id|id}}|id|i}|o||}n|||/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR$ s  c Csg}xf|D]^}g}dD]}|||q~\}}} } } dg} | i|ii|| i|| p| idn| od| joq=|id o.| id o| id | i| q=| d jo| id | i| q=| id | id | iddn| o| i| n|idi| q Wdid|ii|idi|dgS(sRe-format DESCRIBE output as a SHOW CREATE TABLE string. DESCRIBE is a much simpler reflection and is sufficient for reflecting views for runtime use. This method formats DDL for columns only- keys are omitted. `columns` is a sequence of DESCRIBE or SHOW COLUMNS 6-tuples. SHOW FULL COLUMNS FROM rows must be rearranged for use with this function. iiiiiR%sNOT NULLRRtCtDEFAULTRs'%s'Rxs''RsCREATE TABLE %s ( s, s ) (iiiii(R|RRRRRR( RRR RoRR(RYRRRR textraR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR> s8 4       !  cCs|ii|S(s8Unpack '"col"(2),"col" ASC'-ish strings into components.(RR(Rt identifiers((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRk sN(RRRRR'RRRRRRRR R R RRRRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR/s$ 8  N 0 /      $  -t_MySQLIdentifierPreparercBs&eZdZeZdZdZRS(s/MySQL-specific schema identifier configuration.cKstt|i||dS(N(RDRR(RR<R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRx scGs?tg}|D]'}|dj o||i|qq~S(s4Unilaterally identifier-quote any number of strings.N(R R'R(RtidsR(RY((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR{ s(RRRtRESERVED_WORDStreserved_wordsRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyRs s RcBs)eZdZdZdZdZRS(s;Traditional MySQL-specific schema identifier configuration.cCs tt|i|dddS(NRt`(RDRR(RR<((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR scCs|iddS(NR!s``(R(RR@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR scCs|iddS(Ns``R!(R(RR@((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s(RRRRRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s  R4cBseZdZRS(s2ANSI_QUOTES MySQL schema identifier configuration.(RRR(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR4 scCs.g}|iD]}|t||q~S(sEProxy result rows to smooth over MySQL-Python driver inconsistencies.(tfetchallRJ(RRR(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR scCst|i|S(sFProxy a result row to smooth over MySQL-Python driver inconsistencies.(RJtfetchone(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR. scCst||fS(s1Prepare a 2-tuple of compiled regex and callable.(R(RR((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR scCsti|titiBS(s)Compile a string to regex, I and UNICODE.(RRtIR#(R((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyR s(tRR^RWR+RRRRLt sqlalchemyRRRRRtsqlalchemy.sqlRRyRR|Rtsqlalchemy.engineR RGR R R7t__all__RRRR$R#RRtobjectRRR8R RRGRRIRRORR R R(t SmallintegerR"t TypeEngineRtDateTimeRtDateRtTimeR%RaR&R+ReR$R)RRRjR#RlRRRtBinaryRmR*RRR'RRRR!tBooleanRtNCHARRnRRtDefaultExecutionContextRRRRJRwRRtSchemaGeneratorRt SchemaDropperRRt class_loggertIdentifierPreparerRRR4R'RR.RRR<tstatement_compilertschemageneratort schemadroppertexecution_ctx_cls(((s>/usr/lib/python2.6/site-packages/sqlalchemy/databases/mysql.pyts\<(      8+'$# *"!!&m[                 !+C