summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/base.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Prevent SQL server isolation level from failingMike Bayer2017-05-221-15/+30
| | | | | | | | | | | | Fixed bug where SQL Server transaction isolation must be fetched from a different view when using Azure data warehouse, the query is now attempted against both views and then a NotImplemented is raised unconditionally if failure continues to provide the best resiliency against future arbitrary API changes in new SQL Server versions. Change-Id: I621b5089febe8ace136428fa133fde1a7e21cda4 Fixes: #3994
* Recognize brackets, quoted_name in SQL Server schemaMike Bayer2017-04-041-3/+100
| | | | | | | | | | | | | The SQL Server dialect now allows for a database and/or owner name with a dot inside of it, using brackets explicitly in the string around the owner and optionally the database name as well. In addition, sending the :class:`.quoted_name` construct for the schema name will not split on the dot and will deliver the full string as the "owner". :class:`.quoted_name` is also now available from the ``sqlalchemy.sql`` import space. Change-Id: I77491d63ce47638bd23787d903ccde2f35a9d43d Fixes: #2626
* Don't check isolation level prior to SQL Server 2005Mike Bayer2017-01-261-0/+4
| | | | | | | | | | Added a version check to the "get_isolation_level" feature, which is invoked upon first connect, so that it skips for SQL Server version 2000, as the necessary system view is not available prior to SQL Server 2005. Change-Id: If4f860513f0aae6625803f449714aedfc5075f57 Fixes: #3898
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Don't select lastrowid for inline=TrueMike Bayer2016-12-211-1/+2
| | | | | | | | | | | - Fixed bug where SQL Server dialects would attempt to select the last row identity for an INSERT from SELECT, failing in the case when the SELECT has no rows. For such a statement, the inline flag is set to True indicating no last primary key should be fetched. Change-Id: Ic40d56d9eadadc3024a4d71245f9eed4c420024a Fixes: #3876
* Use schema_name() for SQL Server default schemaMike Bayer2016-10-041-10/+6
| | | | | | | | | | | | Changed the query used to get "default schema name", from one that queries the database principals table to using the "schema_name()" function, as issues have been reported that the former system was unavailable on the Azure Data Warehouse edition. It is hoped that this will finally work across all SQL Server versions and authentication styles. Change-Id: Ic11bd4162c0d6a60432ae44876e86512703c1f81 Fixes: #3810
* Use SQL Server SERVERPROPERTY for version info w/ pyodbcMike Bayer2016-10-041-11/+4
| | | | | | | | | Updated the server version info scheme for pyodbc to use SQL Server SERVERPROPERTY(), rather than relying upon pyodbc.SQL_DBMS_VER, which continues to be unreliable particularly with FreeTDS. Change-Id: I4ff49ae13c8ff51bd764980131d41c18d73d87ce Fixes: #3814
* Spelling fixespr/299Ville Skyttä2016-08-081-1/+1
|
* - Document how SQL Server does MAX with VARCHAR, NVARCHARMike Bayer2016-07-271-0/+20
| | | | | | Fixes #3760 Change-Id: I0613eb66bfdc9d7118688c74e29c8da322c3b4db
* Allow creating explicit non-clustered keys and indexes MS SQL.Saulius Žemaitaitis2016-06-061-12/+39
| | | | | | | | | | mssql_clustered=False on Index, UniqueConstraint, PrimaryKeyConstraint now renders NONCLUSTERED. The default of mssql_clustered is now None. Co-Authored-By: mike bayer <mike_mp@zzzcomputing.com> Change-Id: Id6b8d840e355be8f8fa72360cb4b6d2617ba72cf Pull-request: https://github.com/zzzeek/sqlalchemy/pull/252
* Fix label referencing in SQL Server OFFSET logicMike Bayer2016-05-101-1/+5
| | | | | | | | | | Fixed bug where by ROW_NUMBER OVER clause applied for OFFSET selects in SQL Server would inappropriately substitute a plain column from the local statement that overlaps with a label name used by the ORDER BY criteria of the statement. Change-Id: Ic2500c886cbfc83a1ad5a2681783f008b9f23838 Fixes: #3711
* ReST fix: missing backtickpr/251Marius Gedminas2016-03-211-1/+1
| | | Fixes a misrendering at http://docs.sqlalchemy.org/en/latest/dialects/mssql.html#nullability:
* - Added basic isolation level support to the SQL Server dialectsMike Bayer2016-03-151-0/+86
| | | | | | via :paramref:`.create_engine.isolation_level` and :paramref:`.Connection.execution_options.isolation_level` parameters. fixes #3534
* - add notes for pyodbc limitations with rowcount fixes #3675Mike Bayer2016-03-151-0/+34
|
* - happy new yearMike Bayer2016-01-291-1/+1
|
* Remove quote on first DATEPART paramaterGuillaume DOUMENC2016-01-121-1/+1
|
* - A descriptive ValueError is now raised in the event that SQL serverMike Bayer2015-11-301-2/+10
| | | | | | | returns an invalid date or time format from a DATE or TIME column, rather than failing with a NoneType error. Pull request courtesy Ed Avis. pullreq github:206
* - extend pullreq github:213 to also include DATETIMEOFFSET and TIME,Mike Bayer2015-11-141-2/+2
| | | | | | which also accept zero precision - extend test case here to include a backend-agnostic suite - changelog for MSSQL date fix
* Pass precision value to mssql.DATETIME2 when it is 0pr/213Jacobo de Vera2015-11-131-1/+1
| | | | | The simple check on the precision results in DATETIME2(0) generating a DATETIME2 column, with default precision, which is 7.
* Update base.pypr/208Peter Demin2015-10-071-1/+1
| | | Docstring typo keysowrds => keywords
* - The ``legacy_schema_aliasing`` flag, introduced in version 1.0.5Mike Bayer2015-09-191-67/+37
| | | | | | | as part of :ticket:`3424` to allow disabling of the MSSQL dialect's attempts to create aliases for schema-qualified tables, now defaults to False; the old behavior is now disabled unless explicitly turned on. fixes #3434
* - Fixed issue where the SQL Server dialect would reflect a string-Mike Bayer2015-07-301-1/+1
| | | | | | | | | | | | or other variable-length column type with unbounded length by assigning the token ``"max"`` to the length attribute of the string. While using the ``"max"`` token explicitly is supported by the SQL Server dialect, it isn't part of the normal contract of the base string types, and instead the length should just be left as None. The dialect now assigns the length to None on reflection of the type so that the type behaves normally in other contexts. fixes #3504
* Update to correct TDS version; FreeTDS only supports up to 7.3. 8.0 is not a ↵pr/176Allen, Timothy2015-05-281-2/+6
| | | | valid version (Microsoft released the spec late).
* - Fixed bug where known boolean values used byMike Bayer2015-05-261-0/+4
| | | | | | | | :func:`.engine_from_config` were not being parsed correctly; these included ``pool_threadlocal`` and the psycopg2 argument ``use_native_unicode``. fixes #3435 - add legacy_schema_aliasing config parsing for mssql - move use_native_unicode config arg to the psycopg2 dialect
* - Added a new dialect flag to the MSSQL dialectMike Bayer2015-05-241-28/+107
| | | | | | | | | | | | | | | | | | | | | | | ``legacy_schema_aliasing`` which when set to False will disable a very old and obsolete behavior, that of the compiler's attempt to turn all schema-qualified table names into alias names, to work around old and no longer locatable issues where SQL server could not parse a multi-part identifier name in all circumstances. The behavior prevented more sophisticated statements from working correctly, including those which use hints, as well as CRUD statements that embed correlated SELECT statements. Rather than continue to repair the feature to work with more complex statements, it's better to just disable it as it should no longer be needed for any modern SQL server version. The flag defaults to True for the 1.0.x series, leaving current behavior unchanged for this version series. In the 1.1 series, it will default to False. For the 1.0 series, when not set to either value explicitly, a warning is emitted when a schema-qualified table is first used in a statement, which suggests that the flag be set to False for all modern SQL Server versions. fixes #3424 fixes #3430
* - Fixed a regression that was incorrectly fixed in 1.0.0b4Mike Bayer2015-04-241-1/+0
| | | | | | | | | | | | | | | | | | (hence becoming two regressions); reports that SELECT statements would GROUP BY a label name and fail was misconstrued that certain backends such as SQL Server should not be emitting ORDER BY or GROUP BY on a simple label name at all; when in fact, we had forgotten that 0.9 was already emitting ORDER BY on a simple label name for all backends, as described in :ref:`migration_1068`, as 1.0 had rewritten this logic as part of :ticket:`2992`. In 1.0.2, the bug is fixed both that SQL Server, Firebird and others will again emit ORDER BY on a simple label name when passed a :class:`.Label` construct that is expressed in the columns clause, and no backend will emit GROUP BY on a simple label name in this case, as even Postgresql can't reliably do GROUP BY on a simple name in every case. fixes #3338, fixes #3385
* - Fixed support for "literal_binds" mode when using limit/offsetMike Bayer2015-04-231-2/+3
| | | | | | with Firebird, so that the values are again rendered inline when this is selected. Related to :ticket:`3034`. fixes #3381
* - Turned off the "simple order by" flag on the MSSQL dialect; thisMike Bayer2015-03-241-0/+1
| | | | | | | | | | | is the flag that per :ticket:`2992` causes an order by or group by an expression that's also in the columns clause to be copied by label, even if referenced as the expression object. The behavior for MSSQL is now the old behavior that copies the whole expression in by default, as MSSQL can be picky on these particularly in GROUP BY expressions. fixes #3338 - Add a test that includes a composed label in a GROUP BY
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - rename _select_wrapsMike Bayer2015-03-081-1/+1
| | | | | - replace force_result_map with a mini-API for nested result sets, add coverage
* - the change for #918 was of course not nearly that simple.Mike Bayer2015-03-071-1/+2
| | | | | | | | | | | | | | | | | | The "wrapping" employed by the mssql and oracle dialects using the "iswrapper" argument was not being used intelligently by the compiler, and the result map was being written incorrectly, using *more* columns in the result map than were actually returned by the statement, due to "row number" columns that are inside the subquery. The compiler now writes out result map on the "top level" select in all cases fully, and for the mssql/oracle wrapping case extracts out the "proxied" columns in a second step, which only includes those columns that are proxied outwards to the top level. This change might have implications for 3rd party dialects that might be imitating oracle's approach. They can safely continue to use the "iswrapper" kw which is now ignored, but they may need to also add the _select_wraps argument as well.
* - Custom dialects that implement :class:`.GenericTypeCompiler` canMike Bayer2015-01-161-40/+42
| | | | | | | | | | | | | | now be constructed such that the visit methods receive an indication of the owning expression object, if any. Any visit method that accepts keyword arguments (e.g. ``**kw``) will in most cases receive a keyword argument ``type_expression``, referring to the expression object that the type is contained within. For columns in DDL, the dialect's compiler class may need to alter its ``get_column_specification()`` method to support this as well. The ``UserDefinedType.get_col_spec()`` method will also receive ``type_expression`` if it provides ``**kw`` in its argument signature. fixes #3074
* - SQL Server 2012 now recommends VARCHAR(max), NVARCHAR(max),Mike Bayer2014-12-061-9/+96
| | | | | | | VARBINARY(max) for large text/binary types. The MSSQL dialect will now respect this based on version detection, as well as the new ``deprecate_large_types`` flag. fixes #3039
* cleanup exception handling - use new exception hierarchy (since python 2.5)pr/140ndparker2014-10-021-3/+1
|
* improve exception vs. exit handlingndparker2014-09-231-0/+2
|
* - ensure literal_binds works with LIMIT clause, FOR UPDATEMike Bayer2014-09-031-1/+1
|
* - update some SQL server tests, supportMike Bayer2014-07-221-1/+17
| | | | - add support for IDENTITY INSERT setting for INSERT with inline VALUES
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-192/+223
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - Fixed a regression from 0.9.5 caused by :ticket:`3025` where theMike Bayer2014-07-141-0/+3
| | | | | | | query used to determine "default schema" is invalid in SQL Server 2000. For SQL Server 2000 we go back to defaulting to the "schema name" parameter of the dialect, which is configurable but defaults to 'dbo'. fixes #3025
* - Added statement encoding to the "SET IDENTITY_INSERT"Mike Bayer2014-07-141-6/+12
| | | | | | | | | statements which operate when an explicit INSERT is being interjected into an IDENTITY column, to support non-ascii table identifiers on drivers such as pyodbc + unix + py2k that don't support unicode statements. ref #3091 as this fix is also in that issue's patch, but is a different issue.
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* Merge pull request #98 from abbec/mssql2008-multivalues-insertmike bayer2014-07-061-0/+2
|\ | | | | Fixed support for multivalue inserts for MS SQL 2008
| * - Fixed support for multivalue inserts for MS SQL 2008 since it is actually ↵pr/98Albert Cervin2014-06-161-0/+2
| | | | | | | | supported.
* | - write some really complete docs on MSSQL autoincrement, fixes #3094Mike Bayer2014-06-241-10/+132
|/
* - more tests, including backend testsMike Bayer2014-05-161-17/+34
| | | | - implement for SQL server, use window functions when simple limit/offset not available
* Use _offset_clause and _limit_clause, which are always Visitable and usually ↵Dobes Vandermeer2014-04-251-3/+4
| | | | a BindParameter, instead of _offset and _limit in GenerativeSelect.
* - Revised the query used to determine the current default schema nameMike Bayer2014-04-171-14/+8
| | | | | | | to use the ``database_principal_id()`` function in conjunction with the ``sys.database_principals`` view so that we can determine the default schema independently of the type of login in progress (e.g., SQL Server, Windows, etc). fixes #3025
* - implement kwarg validation and type system for dialect-specificMike Bayer2014-01-181-7/+18
| | | | | arguments; [ticket:2866] - add dialect specific kwarg functionality to ForeignKeyConstraint, ForeignKey
* - changelog for pullreq:11Mike Bayer2014-01-181-1/+1
| | | | - be specific about version 0.9.2
* Bug Fix: Stop generating bad sql if an empty UniqueConstraint() is givendonkopotamus2014-01-171-0/+2
|