jason810496 commented on code in PR #61155:
URL: https://github.com/apache/airflow/pull/61155#discussion_r2745088665
##########
providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py:
##########
@@ -108,9 +108,11 @@ def start(self, session: Session = NEW_SESSION):
with create_global_lock(session=session, lock=DBLocks.MIGRATIONS):
engine = session.get_bind().engine
self._check_db_schema(engine)
- EdgeJobModel.metadata.create_all(engine)
- EdgeLogsModel.metadata.create_all(engine)
- EdgeWorkerModel.metadata.create_all(engine)
+ EdgeJobModel.metadata.create_all(
+ engine,
+ tables=[EdgeJobModel.__table__, EdgeLogsModel.__table__,
EdgeWorkerModel.__table__],
+ checkfirst=True,
+ )
Review Comment:
How about switching to `EdgeDBManager.create_db_from_orm`?
##########
providers/edge3/src/airflow/providers/edge3/models/db.py:
##########
@@ -0,0 +1,86 @@
+# 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.
+from __future__ import annotations
+
+from pathlib import Path
+
+from sqlalchemy import MetaData, inspect
+
+from airflow.models.base import Base
+from airflow.providers.edge3.models.edge_job import EdgeJobModel
+from airflow.providers.edge3.models.edge_logs import EdgeLogsModel
+from airflow.providers.edge3.models.edge_worker import EdgeWorkerModel
+from airflow.utils.db_manager import BaseDBManager
+
+PACKAGE_DIR = Path(__file__).parents[1]
+
+_REVISION_HEADS_MAP: dict[str, str] = {}
Review Comment:
Do we need to add prek static check for updating the revision?
e.g. https://github.com/apache/airflow/pull/42382/files
--
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]