dstandish commented on code in PR #23317:
URL: https://github.com/apache/airflow/pull/23317#discussion_r899448817


##########
airflow/models/dagwarning.py:
##########
@@ -0,0 +1,93 @@
+#
+# 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 enum import Enum
+
+from sqlalchemy import Column, ForeignKeyConstraint, Integer, String, Text, 
false
+
+from airflow.models.base import ID_LEN, Base
+from airflow.utils import timezone
+from airflow.utils.session import NEW_SESSION, provide_session
+from airflow.utils.sqlalchemy import UtcDateTime
+
+
+class DagWarning(Base):
+    """
+    A table to store DAG warnings.
+
+    DAG warnings are problems that don't rise to the level of failing the DAG 
parse
+    but which users should nonetheless be warned about.  These warnings are 
recorded
+    when parsing DAG and displayed on the Webserver in a flash message.
+    """
+
+    id = Column(
+        Integer, autoincrement=True, server_default='id'
+    )  # this default just signals to SQLA to defer to server

Review Comment:
   The whole point of merge is you don't know whether the object is there.  And 
if it's a composite primary key, it's a pain to build out the query to check 
for its existence.  That's what's nice about merge.
   
   In any case, we don't really need the surrogate key here so I'll just chop 
it.  But this will likely come up again at some point.  And it seems this 
pattern, of using the logical key in ORM while having the surrogate key as the 
physical key is a good approach for this type of thing.



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