ephraimbuddy commented on code in PR #38358:
URL: https://github.com/apache/airflow/pull/38358#discussion_r1537428432


##########
airflow/migrations/versions/0138_2_9_0_encrypt_trigger_kwargs.py:
##########
@@ -0,0 +1,69 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""encrypt trigger kwargs
+
+Revision ID: 1949afb29106
+Revises: 8e1c784a4fc7
+Create Date: 2024-03-17 22:09:09.406395
+
+"""
+import sqlalchemy as sa
+from airflow.models.crypto import get_fernet
+
+from airflow.models.trigger import Trigger
+from alembic import op
+
+
+# revision identifiers, used by Alembic.
+revision = "1949afb29106"
+down_revision = "8e1c784a4fc7"
+branch_labels = None
+depends_on = None
+airflow_version = "2.9.0"
+
+
+def get_session() -> sa.orm.Session:
+    conn = op.get_bind()
+    sessionmaker = sa.orm.sessionmaker()
+    return sessionmaker(bind=conn)
+
+
+def upgrade():
+    """Apply encrypt trigger kwargs"""
+    session = get_session()
+    try:
+        for trigger in session.query(Trigger).all():
+            # convert dict to string and encrypt it
+            trigger.encrypted_kwargs = 
trigger._encrypt_kwargs(trigger.encrypted_kwargs)
+        session.commit()

Review Comment:
   This will likely break offline generation of sql scripts



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to