summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:19:47 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 18:23:11 -0500
commit1e278de4cc9a4181e0747640a960e80efcea1ca9 (patch)
tree13d0c035807613bfa07e734acad79b9c843cb8b0 /lib/sqlalchemy/dialects/mssql/base.py
parent1e1a38e7801f410f244e4bbb44ec795ae152e04e (diff)
downloadsqlalchemy-1e278de4cc9a4181e0747640a960e80efcea1ca9.tar.gz
Post black reformatting
Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py81
1 files changed, 43 insertions, 38 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 161297015..ac427b5fd 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -4,7 +4,6 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-
"""
.. dialect:: mssql
:name: Microsoft SQL Server
@@ -331,9 +330,10 @@ for these types will be issued as DATETIME.
Large Text/Binary Type Deprecation
----------------------------------
-Per `SQL Server 2012/2014 Documentation <http://technet.microsoft.com/en-us/library/ms187993.aspx>`_,
-the ``NTEXT``, ``TEXT`` and ``IMAGE`` datatypes are to be removed from SQL Server
-in a future release. SQLAlchemy normally relates these types to the
+Per
+`SQL Server 2012/2014 Documentation <http://technet.microsoft.com/en-us/library/ms187993.aspx>`_,
+the ``NTEXT``, ``TEXT`` and ``IMAGE`` datatypes are to be removed from SQL
+Server in a future release. SQLAlchemy normally relates these types to the
:class:`.UnicodeText`, :class:`.Text` and :class:`.LargeBinary` datatypes.
In order to accommodate this change, a new flag ``deprecate_large_types``
@@ -355,9 +355,9 @@ behavior of this flag is as follows:
established. If the dialect is used to render DDL without the flag being
set, it is interpreted the same as ``False``.
-* On first connection, the dialect detects if SQL Server version 2012 or greater
- is in use; if the flag is still at ``None``, it sets it to ``True`` or
- ``False`` based on whether 2012 or greater is detected.
+* On first connection, the dialect detects if SQL Server version 2012 or
+ greater is in use; if the flag is still at ``None``, it sets it to ``True``
+ or ``False`` based on whether 2012 or greater is detected.
* The flag can be set to either ``True`` or ``False`` when the dialect
is created, typically via :func:`.create_engine`::
@@ -368,8 +368,8 @@ behavior of this flag is as follows:
* Complete control over whether the "old" or "new" types are rendered is
available in all SQLAlchemy versions by using the UPPERCASE type objects
instead: :class:`.NVARCHAR`, :class:`.VARCHAR`, :class:`.types.VARBINARY`,
- :class:`.TEXT`, :class:`.mssql.NTEXT`, :class:`.mssql.IMAGE` will always remain
- fixed and always output exactly that type.
+ :class:`.TEXT`, :class:`.mssql.NTEXT`, :class:`.mssql.IMAGE` will always
+ remain fixed and always output exactly that type.
.. versionadded:: 1.0.0
@@ -643,38 +643,42 @@ following ALTER DATABASE commands executed at the SQL prompt::
Background on SQL Server snapshot isolation is available at
http://msdn.microsoft.com/en-us/library/ms175095.aspx.
+""" # noqa
-"""
import codecs
import datetime
import operator
import re
-from ... import sql, schema as sa_schema, exc, util
-from ...sql import compiler, expression, util as sql_util, quoted_name
+from . import information_schema as ischema
from ... import engine
-from ...engine import reflection, default
+from ... import exc
+from ... import schema as sa_schema
+from ... import sql
from ... import types as sqltypes
-from ...types import (
- INTEGER,
- BIGINT,
- SMALLINT,
- DECIMAL,
- NUMERIC,
- FLOAT,
- DATETIME,
- DATE,
- BINARY,
- TEXT,
- VARCHAR,
- NVARCHAR,
- CHAR,
- NCHAR,
-)
-
-
+from ... import util
+from ...engine import default
+from ...engine import reflection
+from ...sql import compiler
+from ...sql import expression
+from ...sql import quoted_name
+from ...sql import util as sql_util
+from ...types import BIGINT
+from ...types import BINARY
+from ...types import CHAR
+from ...types import DATE
+from ...types import DATETIME
+from ...types import DECIMAL
+from ...types import FLOAT
+from ...types import INTEGER
+from ...types import NCHAR
+from ...types import NUMERIC
+from ...types import NVARCHAR
+from ...types import SMALLINT
+from ...types import TEXT
+from ...types import VARCHAR
from ...util import update_wrapper
-from . import information_schema as ischema
+
# http://sqlserverbuilds.blogspot.com/
MS_2016_VERSION = (13,)
@@ -1357,9 +1361,9 @@ class MSExecutionContext(default.DefaultExecutionContext):
insert_has_sequence = seq_column is not None
if insert_has_sequence:
- self._enable_identity_insert = seq_column.key in self.compiled_parameters[
- 0
- ] or (
+ self._enable_identity_insert = (
+ seq_column.key in self.compiled_parameters[0]
+ ) or (
self.compiled.statement.parameters
and (
(
@@ -2462,7 +2466,7 @@ class MSDialect(default.DefaultDialect):
break
(
name,
- type,
+ type_,
nullable,
charlen,
numericprec,
@@ -2479,7 +2483,7 @@ class MSDialect(default.DefaultDialect):
row[columns.c.column_default],
row[columns.c.collation_name],
)
- coltype = self.ischema_names.get(type, None)
+ coltype = self.ischema_names.get(type_, None)
kwargs = {}
if coltype in (
@@ -2501,7 +2505,8 @@ class MSDialect(default.DefaultDialect):
if coltype is None:
util.warn(
- "Did not recognize type '%s' of column '%s'" % (type, name)
+ "Did not recognize type '%s' of column '%s'"
+ % (type_, name)
)
coltype = sqltypes.NULLTYPE
else: