shahar1 commented on code in PR #72474:
URL: https://github.com/apache/airflow/pull/72474#discussion_r4110721174


##########
airflow-core/src/airflow/models/errors.py:
##########
@@ -34,12 +35,17 @@ class ParseImportError(Base):
     id: Mapped[int] = mapped_column(Integer, primary_key=True)
     timestamp: Mapped[datetime | None] = mapped_column(UtcDateTime, 
nullable=True)
     filename: Mapped[str | None] = mapped_column(String(1024), nullable=True)
+    source_reference: Mapped[str | None] = mapped_column(String(2000), 
nullable=True)

Review Comment:
   `String(2000)` drifts from PR description (`String(1024)`)



##########
airflow-core/src/airflow/models/dagcode.py:
##########
@@ -66,6 +66,9 @@ class DagCode(Base):
     )
     source_code: Mapped[str] = mapped_column(Text().with_variant(MEDIUMTEXT(), 
"mysql"), nullable=False)
     source_code_hash: Mapped[str] = mapped_column(String(32), nullable=False)
+    language: Mapped[str] = mapped_column(
+        String(64), nullable=False, default="python", server_default="python"
+    )

Review Comment:
   `String(64)` drifts from PR description `String(50)`,
   `server_default` is `python` and not null



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/import_error.py:
##########
@@ -263,6 +264,7 @@ def get_import_errors(
             ParseImportError.id,
             ParseImportError.timestamp,
             ParseImportError.filename,
+            ParseImportError.source_reference,

Review Comment:
   Could you please make sure that it is tested?



##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/import_error.py:
##########
@@ -31,6 +31,7 @@ class ImportErrorResponse(BaseModel):
     id: int = Field(alias="import_error_id")
     timestamp: datetime
     filename: str
+    source_reference: str | None = None

Review Comment:
   Do we want to make `soruce_reference` a required nullable field like 
`bundle_name`?



##########
airflow-core/src/airflow/models/dagwarning.py:
##########
@@ -105,3 +108,25 @@ class DagWarningType(str, Enum):
     DUPLICATE_DAG_ID = "duplicate dag id"
     NONEXISTENT_POOL = "non-existent pool"
     RUNTIME_VARYING_VALUE = "runtime varying value"
+
+
+ImporterWarningType = Annotated[
+    str,
+    StringConstraints(pattern=r"^[a-z][a-z0-9_]*:[a-z0-9_.\-]+$", 
max_length=WARNING_TYPE_MAX_LENGTH),
+]
+"""Warning type reported by a Dag importer, prefixed with its namespace (e.g. 
``yaml:deprecated_field``)."""
+
+DagWarningTypeValue = DagWarningType | ImporterWarningType
+"""Any valid ``warning_type``: a built-in :class:`DagWarningType` or an 
:data:`ImporterWarningType`."""
+
+_warning_type_adapter: TypeAdapter[DagWarningType | str] = 
TypeAdapter(DagWarningTypeValue)

Review Comment:
   nit: Can we maybe annotate with the alias itself (i.e.,g 
`TypeAdapter[DagWarningTypeValue]`)



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