You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/21 08:12:15 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #17729: Automatically use utf8mb3_general_ci collation for mysql

uranusjr commented on a change in pull request #17729:
URL: https://github.com/apache/airflow/pull/17729#discussion_r693323408



##########
File path: airflow/models/base.py
##########
@@ -44,6 +44,19 @@ def get_id_collation_args():
     if collation:
         return {'collation': collation}
     else:
+        # Automatically use utf8mb3_general_ci collation for mysql
+        # This is backwards-compatible. All our IDS are ASCII anyway so even if
+        # we migrate from previously installed database with different collation and we end up mixture of
+        # COLLATIONS, it's not a problem whatsoever (and we keep it small enough so that our indexes
+        # for MYSQL will not exceed the maximum index size.
+        #
+        # See https://github.com/apache/airflow/pull/17603#issuecomment-901121618.
+        #
+        # We cannot use session/dialect as at this point we are trying to determine the right connection
+        # parameters, so we use the connection
+        conn = conf.get('core', 'sql_alchemy_conn', fallback='')
+        if conn.startswith('mysql'):

Review comment:
       Would `conn.dialect.name == "mysql"` be more robust?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org