Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant dag_id index on log table #42376

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions airflow/migrations/versions/0033_3_0_0_remove_redundant_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# 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.

"""
Remove redundant index

Revision ID: 16cbcb1c8c36
Revises: 522625f6d606
Create Date: 2024-09-20 09:32:48.707545

"""

from __future__ import annotations

from alembic import op

# revision identifiers, used by Alembic.
revision = "16cbcb1c8c36"
down_revision = "522625f6d606"
branch_labels = None
depends_on = None
airflow_version = "3.0.0"


def upgrade():
"""Apply Remove redundant index"""
# ### commands auto generated by Alembic - please adjust! ###
dstandish marked this conversation as resolved.
Show resolved Hide resolved
with op.batch_alter_table("log", schema=None) as batch_op:
batch_op.drop_index("idx_log_dag")

# ### end Alembic commands ###


def downgrade():
"""Unapply Remove redundant index"""
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("log", schema=None) as batch_op:
batch_op.create_index("idx_log_dag", ["dag_id"], unique=False)

# ### end Alembic commands ###
1 change: 0 additions & 1 deletion airflow/models/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Log(Base):
try_number = Column(Integer)

__table_args__ = (
Index("idx_log_dag", dag_id),
Index("idx_log_dttm", dttm),
Index("idx_log_event", event),
Index("idx_log_task_instance", dag_id, task_id, run_id, map_index, try_number),
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MappedClassProtocol(Protocol):
"2.9.0": "1949afb29106",
"2.9.2": "686269002441",
"2.10.0": "22ed7efa9da2",
"3.0.0": "522625f6d606",
"3.0.0": "16cbcb1c8c36",
}


Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d58a76011bd215ac7a0c42146986ad0eead5f4a9c8ffd7932b1aa1eb61e6e4af
b937654c9ed767d8086d74e155d5bfc29ca6f44f8fcd8e3496fa603f37527cd9
Loading
Loading