diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-07-27 10:04:52 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-07-27 10:04:52 -0400 |
commit | 0d92f79fd86073203a2a956460140c311c85a396 (patch) | |
tree | 2d724cab556f52c9b6684c62259fbb2101e884a8 | |
parent | 360b4e0565dc1ecdcef0625b23256268361e2c9d (diff) | |
download | sqlalchemy-0d92f79fd86073203a2a956460140c311c85a396.tar.gz |
- Document how SQL Server does MAX with VARCHAR, NVARCHAR
Fixes #3760
Change-Id: I0613eb66bfdc9d7118688c74e29c8da322c3b4db
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index bc1ad5cdf..d1c7452a1 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -166,6 +166,26 @@ how SQLAlchemy handles this: This is an auxilliary use case suitable for testing and bulk insert scenarios. +MAX on VARCHAR / NVARCHAR +------------------------- + +SQL Server supports the special string "MAX" within the +:class:`.sqltypes.VARCHAR` and :class:`.sqltypes.NVARCHAR` datatypes, +to indicate "maximum length possible". The dialect currently handles this as +a length of "None" in the base type, rather than supplying a +dialect-specific version of these types, so that a base type +specified such as ``VARCHAR(None)`` can assume "unlengthed" behavior on +more than one backend without using dialect-specific types. + +To build a SQL Server VARCHAR or NVARCHAR with MAX length, use None:: + + my_table = Table( + 'my_table', metadata, + Column('my_data', VARCHAR(None)), + Column('my_n_data', NVARCHAR(None)) + ) + + Collation Support ----------------- |