]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix some inaccuracies in with_variant doc
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Aug 2022 13:49:25 +0000 (09:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Aug 2022 13:51:56 +0000 (09:51 -0400)
* the table wont create on mysql/mariadb b.c. user_name had
  no length
* "utf-8" is not recognized by mysql/mariadb, use "utf8"
* mysql or mariadb name match is determined by the URL, not the
  actual DB that is detected (I know I made it work that way but
  I forgot)
* for the 1.4 backport only, will remove the "mariadb" part
  as we dont support that API, #8408

Fixes: #8408
Change-Id: I5b0a58a3f94a3450631e2405bd07d0a77599ae26

doc/build/core/type_basics.rst

index 2f69cc649fd26fa6cf9cda423ab93aa1dbace0b5..e6925c40297ccb8fd2acf5f101f086118eabde86 100644 (file)
@@ -151,16 +151,17 @@ to make use of the :paramref:`_mysql.VARCHAR.charset` parameter of
     user = Table(
         "user",
         metadata_obj,
-        Column("user_name", String, primary_key=True),
+        Column("user_name", String(100), primary_key=True),
         Column(
             "bio",
-            String(255).with_variant(VARCHAR(255, charset="utf-8"), "mysql", "mariadb"),
+            String(255).with_variant(VARCHAR(255, charset="utf8"), "mysql", "mariadb"),
         ),
     )
 
 In the above table definition, the ``"bio"`` column will have string-behaviors
-on all backends.  On most backends it will render in DDL as ``VARCHAR``.
-However on MySQL and MariaDB, it will render as ``VARCHAR(255) CHARACTER SET utf-8``.
+on all backends. On most backends it will render in DDL as ``VARCHAR``. However
+on MySQL and MariaDB (indicated by database URLs that start with ``mysql`` or
+``mariadb``), it will render as ``VARCHAR(255) CHARACTER SET utf8``.
 
 .. seealso::