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/01/25 14:30:41 UTC

[GitHub] [airflow] XD-DENG commented on a change in pull request #13892: Make Smart Sensors DB Migration idempotent

XD-DENG commented on a change in pull request #13892:
URL: https://github.com/apache/airflow/pull/13892#discussion_r563764874



##########
File path: airflow/migrations/versions/e38be357a868_update_schema_for_smart_sensor.py
##########
@@ -50,6 +51,11 @@ def sa_timestamp():  # noqa: D103
 def upgrade():  # noqa: D103
 
     conn = op.get_bind()
+    inspector = Inspector.from_engine(conn)
+    tables = inspector.get_table_names()
+    if "sensor_instance" in tables:

Review comment:
       nit: good to use single quotes to keep consistent with the whole script? The same for the change in `downgrade()`




----------------------------------------------------------------
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.

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