]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Document how SQL Server does MAX with VARCHAR, NVARCHAR
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 27 Jul 2016 14:04:52 +0000 (10:04 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 27 Jul 2016 14:04:52 +0000 (10:04 -0400)
Fixes #3760

Change-Id: I0613eb66bfdc9d7118688c74e29c8da322c3b4db

lib/sqlalchemy/dialects/mssql/base.py

index bc1ad5cdf3b1961928783ca533209aab2a199828..d1c7452a177db1c174470ba13ed6fc77053b2e28 100644 (file)
@@ -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
 -----------------