tanvn commented on code in PR #29999:
URL: https://github.com/apache/airflow/pull/29999#discussion_r1133257524


##########
airflow/utils/db_cleanup.py:
##########
@@ -150,18 +150,26 @@ def _do_delete(*, query, orm_model, skip_archive, 
session):
     timestamp_str = re.sub(r"[^\d]", "", datetime.utcnow().isoformat())[:14]
     target_table_name = 
f"{ARCHIVE_TABLE_PREFIX}{orm_model.name}__{timestamp_str}"
     print(f"Moving data to table {target_table_name}")
-    stmt = CreateTableAs(target_table_name, query.selectable)
-    logger.debug("ctas query:\n%s", stmt.compile())
-    session.execute(stmt)
+    bind = session.get_bind()
+    dialect_name = bind.dialect.name
+    if dialect_name == "mysql":
+        session.execute(f"CREATE TABLE {target_table_name} LIKE 
{orm_model.name}")

Review Comment:
   Thanks! I added the comment!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to