From f50528e1c7891b6b2b5f4e8bc3834f34d4108dc7 Mon Sep 17 00:00:00 2001 From: Andrey Anshin Date: Fri, 19 Apr 2024 18:07:53 +0400 Subject: [PATCH] Use `declarative_base` from `sqlalchemy.orm` instead of `sqlalchemy.ext.declarative` --- .../0054_1_10_10_add_dag_code_table.py | 2 +- ...063_2_0_0_set_conn_type_as_non_nullable.py | 2 +- docs/apache-airflow/img/airflow_erd.sha256 | 2 +- docs/apache-airflow/img/airflow_erd.svg | 140 +++++++++--------- pyproject.toml | 6 +- 5 files changed, 78 insertions(+), 74 deletions(-) diff --git a/airflow/migrations/versions/0054_1_10_10_add_dag_code_table.py b/airflow/migrations/versions/0054_1_10_10_add_dag_code_table.py index 4c25b867d22c2..42a8e9c7e5127 100644 --- a/airflow/migrations/versions/0054_1_10_10_add_dag_code_table.py +++ b/airflow/migrations/versions/0054_1_10_10_add_dag_code_table.py @@ -39,7 +39,7 @@ def upgrade(): """Create DagCode Table.""" - from sqlalchemy.ext.declarative import declarative_base + from sqlalchemy.orm import declarative_base Base = declarative_base() diff --git a/airflow/migrations/versions/0063_2_0_0_set_conn_type_as_non_nullable.py b/airflow/migrations/versions/0063_2_0_0_set_conn_type_as_non_nullable.py index 411a5785980e9..46cecc3e860d0 100644 --- a/airflow/migrations/versions/0063_2_0_0_set_conn_type_as_non_nullable.py +++ b/airflow/migrations/versions/0063_2_0_0_set_conn_type_as_non_nullable.py @@ -26,7 +26,7 @@ import sqlalchemy as sa from alembic import op -from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import declarative_base # revision identifiers, used by Alembic. revision = "8f966b9c467a" diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256 index d1514428254b4..8947b7e631598 100644 --- a/docs/apache-airflow/img/airflow_erd.sha256 +++ b/docs/apache-airflow/img/airflow_erd.sha256 @@ -1 +1 @@ -cccb1a4a3f22027e354cea27bb34996fd45146494cbe6893d938c02c2ddb1a61 \ No newline at end of file +072fb4b43a86ccb57765ec3f163350519773be83ab38b7ac747d25e1197233e8 \ No newline at end of file diff --git a/docs/apache-airflow/img/airflow_erd.svg b/docs/apache-airflow/img/airflow_erd.svg index b03fde478c825..bf4c6c94906a0 100644 --- a/docs/apache-airflow/img/airflow_erd.svg +++ b/docs/apache-airflow/img/airflow_erd.svg @@ -423,79 +423,79 @@ processor_subdir [VARCHAR(2000)] - - -import_error - -import_error - -id - [INTEGER] - NOT NULL - -filename - [VARCHAR(1024)] - -processor_subdir - [VARCHAR(2000)] - -stacktrace - [TEXT] - -timestamp - [TIMESTAMP] - - + sla_miss - -sla_miss - -dag_id - [VARCHAR(250)] - NOT NULL - -execution_date - [TIMESTAMP] - NOT NULL - -task_id - [VARCHAR(250)] - NOT NULL - -description - [TEXT] - -email_sent - [BOOLEAN] - -notification_sent - [BOOLEAN] - -timestamp - [TIMESTAMP] + +sla_miss + +dag_id + [VARCHAR(250)] + NOT NULL + +execution_date + [TIMESTAMP] + NOT NULL + +task_id + [VARCHAR(250)] + NOT NULL + +description + [TEXT] + +email_sent + [BOOLEAN] + +notification_sent + [BOOLEAN] + +timestamp + [TIMESTAMP] - + variable - -variable - -id - [INTEGER] - NOT NULL - -description - [TEXT] - -is_encrypted - [BOOLEAN] - -key - [VARCHAR(250)] - -val - [TEXT] + +variable + +id + [INTEGER] + NOT NULL + +description + [TEXT] + +is_encrypted + [BOOLEAN] + +key + [VARCHAR(250)] + +val + [TEXT] + + + +import_error + +import_error + +id + [INTEGER] + NOT NULL + +filename + [VARCHAR(1024)] + +processor_subdir + [VARCHAR(2000)] + +stacktrace + [TEXT] + +timestamp + [TIMESTAMP] @@ -1428,14 +1428,14 @@ task_instance--xcom -0..N +1 1 task_instance--xcom -1 +0..N 1 diff --git a/pyproject.toml b/pyproject.toml index 05971e7c4a6f7..eac3c81f8ef68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -469,7 +469,11 @@ banned-module-level-imports = ["numpy", "pandas"] "unittest.skipIf".msg = "Use `pytest.mark.skipif` instead: https://docs.pytest.org/en/stable/reference/reference.html#marks" "unittest.skipUnless".msg = "Use `pytest.mark.skipif` instead: https://docs.pytest.org/en/stable/reference/reference.html#marks" "unittest.expectedFailure".msg = "Use `pytest.mark.xfail` instead: https://docs.pytest.org/en/stable/reference/reference.html#marks" - +# Moved in SQLAlchemy 2.0 +"sqlalchemy.ext.declarative.declarative_base".msg = "Use `sqlalchemy.orm.declarative_base`. Moved in SQLAlchemy 2.0" +"sqlalchemy.ext.declarative.as_declarative".msg = "Use `sqlalchemy.orm.as_declarative`. Moved in SQLAlchemy 2.0" +"sqlalchemy.ext.declarative.has_inherited_table".msg = "Use `sqlalchemy.orm.has_inherited_table`. Moved in SQLAlchemy 2.0" +"sqlalchemy.ext.declarative.synonym_for".msg = "Use `sqlalchemy.orm.synonym_for`. Moved in SQLAlchemy 2.0" [tool.ruff.lint.flake8-type-checking] exempt-modules = ["typing", "typing_extensions"]