]> 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:06:16 +0000 (10:06 -0400)
Fixes #3760

Change-Id: I0613eb66bfdc9d7118688c74e29c8da322c3b4db
(cherry picked from commit 0d92f79fd86073203a2a956460140c311c85a396)

lib/sqlalchemy/dialects/mssql/base.py

index 927dceff74af55d26fc36f6ff9183786943a5663..af93cc1c3966377441efa3722f127221007dcd57 100644 (file)
@@ -216,6 +216,25 @@ to either True or False.
    the SQL Server dialect's legacy behavior with schema-qualified table
    names.  This flag will default to False in version 1.1.
 
+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
 -----------------