diff options
| author | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-20 00:47:31 -0500 |
|---|---|---|
| committer | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-20 00:47:31 -0500 |
| commit | ead37e4ec0dd5750769226befea043d9527f869e (patch) | |
| tree | 4edd39d12a4b8d1825ed3e1f4764941dcd813ef1 /lib/sqlalchemy/dialects/mysql | |
| parent | 63a953e59dbd3389f96c2ab39aa149dc0ba063e4 (diff) | |
| download | sqlalchemy-ead37e4ec0dd5750769226befea043d9527f869e.tar.gz | |
kill me now, pep8 pass, so close
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 34 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/gaerdbms.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/oursql.py | 76 | ||||
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/pymysql.py | 3 |
4 files changed, 60 insertions, 55 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index f8981fc96..dc2ae7515 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -339,10 +339,10 @@ RESERVED_WORDS = set( 'union', 'unique', 'unlock', 'unsigned', 'update', 'usage', 'use', 'using', 'utc_date', 'utc_time', 'utc_timestamp', 'values', 'varbinary', 'varchar', 'varcharacter', 'varying', 'when', 'where', 'while', 'with', - 'write', 'x509', 'xor', 'year_month', 'zerofill', # 5.0 - 'columns', 'fields', 'privileges', 'soname', 'tables', # 4.1 + 'write', 'x509', 'xor', 'year_month', 'zerofill', # 5.0 + 'columns', 'fields', 'privileges', 'soname', 'tables', # 4.1 'accessible', 'linear', 'master_ssl_verify_server_cert', 'range', - 'read_only', 'read_write', # 5.1 + 'read_only', 'read_write', # 5.1 ]) AUTOCOMMIT_RE = re.compile( @@ -708,6 +708,7 @@ class TIME(sqltypes.TIME): def result_processor(self, dialect, coltype): time = datetime.time + def process(value): # convert from a timedelta value if value is not None: @@ -1093,6 +1094,7 @@ class ENUM(sqltypes.Enum, _StringType): def bind_processor(self, dialect): super_convert = super(ENUM, self).bind_processor(dialect) + def process(value): if self.strict and value is not None and value not in self.enums: raise exc.InvalidRequestError('"%s" not a valid value for ' @@ -1180,6 +1182,7 @@ class SET(_StringType): def bind_processor(self, dialect): super_convert = super(SET, self).bind_processor(dialect) + def process(value): if value is None or isinstance(value, (int, long, basestring)): pass @@ -1285,9 +1288,7 @@ class MySQLCompiler(compiler.SQLCompiler): """Overridden from base SQLCompiler value""" extract_map = compiler.SQLCompiler.extract_map.copy() - extract_map.update ({ - 'milliseconds': 'millisecond', - }) + extract_map.update({'milliseconds': 'millisecond'}) def visit_random_func(self, fn, **kw): return "rand%s" % self.function_argspec(fn) @@ -1650,7 +1651,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler): else: return self._extend_numeric(type_, "NUMERIC(%(precision)s, %(scale)s)" % - {'precision': type_.precision, 'scale' : type_.scale}) + {'precision': type_.precision, 'scale': type_.scale}) def visit_DECIMAL(self, type_): if type_.precision is None: @@ -1662,13 +1663,13 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler): else: return self._extend_numeric(type_, "DECIMAL(%(precision)s, %(scale)s)" % - {'precision': type_.precision, 'scale' : type_.scale}) + {'precision': type_.precision, 'scale': type_.scale}) def visit_DOUBLE(self, type_): if type_.precision is not None and type_.scale is not None: return self._extend_numeric(type_, "DOUBLE(%(precision)s, %(scale)s)" % {'precision': type_.precision, - 'scale' : type_.scale}) + 'scale': type_.scale}) else: return self._extend_numeric(type_, 'DOUBLE') @@ -1676,7 +1677,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler): if type_.precision is not None and type_.scale is not None: return self._extend_numeric(type_, "REAL(%(precision)s, %(scale)s)" % {'precision': type_.precision, - 'scale' : type_.scale}) + 'scale': type_.scale}) else: return self._extend_numeric(type_, 'REAL') @@ -2150,12 +2151,12 @@ class MySQLDialect(default.DefaultDialect): con_kw[opt] = spec[opt] fkey_d = { - 'name' : spec['name'], - 'constrained_columns' : loc_names, - 'referred_schema' : ref_schema, - 'referred_table' : ref_name, - 'referred_columns' : ref_names, - 'options' : con_kw + 'name': spec['name'], + 'constrained_columns': loc_names, + 'referred_schema': ref_schema, + 'referred_table': ref_name, + 'referred_columns': ref_names, + 'options': con_kw } fkeys.append(fkey_d) return fkeys @@ -2818,4 +2819,3 @@ def _re_compile(regex): """Compile a string to regex, I and UNICODE.""" return re.compile(regex, re.I | re.UNICODE) - diff --git a/lib/sqlalchemy/dialects/mysql/gaerdbms.py b/lib/sqlalchemy/dialects/mysql/gaerdbms.py index 66180e233..25201fee6 100644 --- a/lib/sqlalchemy/dialects/mysql/gaerdbms.py +++ b/lib/sqlalchemy/dialects/mysql/gaerdbms.py @@ -52,4 +52,4 @@ class MySQLDialect_gaerdbms(MySQLDialect_mysqldb): if code: return int(code) -dialect = MySQLDialect_gaerdbms
\ No newline at end of file +dialect = MySQLDialect_gaerdbms diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py index 8e4fe2383..ca4986d62 100644 --- a/lib/sqlalchemy/dialects/mysql/oursql.py +++ b/lib/sqlalchemy/dialects/mysql/oursql.py @@ -126,63 +126,67 @@ class MySQLDialect_oursql(MySQLDialect): # Q: why didn't we need all these "plain_query" overrides earlier ? # am i on a newer/older version of OurSQL ? def has_table(self, connection, table_name, schema=None): - return MySQLDialect.has_table(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - table_name, schema) + return MySQLDialect.has_table( + self, + connection.connect().execution_options(_oursql_plain_query=True), + table_name, + schema + ) def get_table_options(self, connection, table_name, schema=None, **kw): - return MySQLDialect.get_table_options(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - table_name, - schema = schema, - **kw + return MySQLDialect.get_table_options( + self, + connection.connect().execution_options(_oursql_plain_query=True), + table_name, + schema=schema, + **kw ) def get_columns(self, connection, table_name, schema=None, **kw): - return MySQLDialect.get_columns(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - table_name, - schema=schema, - **kw + return MySQLDialect.get_columns( + self, + connection.connect().execution_options(_oursql_plain_query=True), + table_name, + schema=schema, + **kw ) def get_view_names(self, connection, schema=None, **kw): - return MySQLDialect.get_view_names(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - schema=schema, - **kw + return MySQLDialect.get_view_names( + self, + connection.connect().execution_options(_oursql_plain_query=True), + schema=schema, + **kw ) def get_table_names(self, connection, schema=None, **kw): - return MySQLDialect.get_table_names(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - schema + return MySQLDialect.get_table_names( + self, + connection.connect().execution_options(_oursql_plain_query=True), + schema ) def get_schema_names(self, connection, **kw): - return MySQLDialect.get_schema_names(self, - connection.connect().\ - execution_options(_oursql_plain_query=True), - **kw + return MySQLDialect.get_schema_names( + self, + connection.connect().execution_options(_oursql_plain_query=True), + **kw ) def initialize(self, connection): return MySQLDialect.initialize( - self, - connection.execution_options(_oursql_plain_query=True) - ) + self, + connection.execution_options(_oursql_plain_query=True) + ) def _show_create_table(self, connection, table, charset=None, full_name=None): - return MySQLDialect._show_create_table(self, - connection.contextual_connect(close_with_result=True). - execution_options(_oursql_plain_query=True), - table, charset, full_name) + return MySQLDialect._show_create_table( + self, + connection.contextual_connect(close_with_result=True). + execution_options(_oursql_plain_query=True), + table, charset, full_name + ) def is_disconnect(self, e, connection, cursor): if isinstance(e, self.dbapi.ProgrammingError): diff --git a/lib/sqlalchemy/dialects/mysql/pymysql.py b/lib/sqlalchemy/dialects/mysql/pymysql.py index 818bb7e3b..3989d037c 100644 --- a/lib/sqlalchemy/dialects/mysql/pymysql.py +++ b/lib/sqlalchemy/dialects/mysql/pymysql.py @@ -28,8 +28,9 @@ class MySQLDialect_pymysql(MySQLDialect_mysqldb): driver = 'pymysql' description_encoding = None + @classmethod def dbapi(cls): return __import__('pymysql') -dialect = MySQLDialect_pymysql
\ No newline at end of file +dialect = MySQLDialect_pymysql |
