Map strings saved in database as binary to unicode strings in Python.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 27 Jun 2020 20:56:12 +0000 (22:56 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Mon, 29 Jun 2020 20:51:10 +0000 (22:51 +0200)
wrpylib/mwdb.py

index ea0bedf1575e6b9e04ed7ba237e547a08a4872dc..6dc60ebd54f64bcca1d694583aca12c82faedbb2 100644 (file)
@@ -35,7 +35,7 @@ def revision_table(metadata):
     Column("rev_text_id", types.Integer, nullable=False),
     Column("rev_comment", types.String(convert_unicode='force'), nullable=False), # tinyblob NOT NULL
     Column("rev_user", types.Integer, nullable=False),
-    Column("rev_user_text", types.Unicode(255), nullable=False),
+    Column("rev_user_text", types.String(255, convert_unicode='force'), nullable=False),
     Column("rev_timestamp", types.String(14, convert_unicode='force'), nullable=False),
     Column("rev_minor_edit", types.Integer, nullable=False),
     Column("rev_deleted", types.Integer, nullable=False),
@@ -61,12 +61,12 @@ def user_table(metadata):
     """
     return Table('user', metadata,
     Column("user_id", types.Integer, primary_key=True),
-    Column("user_name", types.Unicode(255), nullable=False),
-    Column("user_real_name", types.Unicode(255), nullable=False),
+    Column("user_name", types.String(255, convert_unicode='force'), nullable=False),
+    Column("user_real_name", types.String(255, convert_unicode='force'), nullable=False),
     Column("user_password", types.UnicodeText, nullable=False),
     # "user_newpassword"
     # "user_newpass_time"
-    Column("user_email", types.Unicode, nullable=False),
+    Column("user_email", types.String(convert_unicode='force'), nullable=False),
     # "user_touched"
     # "user_token"
     # "user_email_authenticated"
@@ -96,7 +96,7 @@ def categorylinks_table(metadata):
     """
     return Table("categorylinks", metadata,
     Column("cl_from", types.Integer, nullable=False, primary_key=True),
-    Column("cl_to", types.Unicode(255), nullable=False, primary_key=True),
-    Column("cl_sortkey", types.String(convert_unicode='force'), nullable=False),
+    Column("cl_to", types.String(255, convert_unicode='force'), nullable=False, primary_key=True),
+    Column("cl_sortkey", types.String(230, convert_unicode='force'), nullable=False),
     Column("cl_timestamp", types.DateTime, nullable=False),
     )