sushu0 commented on code in PR #45790: URL: https://github.com/apache/superset/pull/45790#discussion_r4397273608
########## superset/migrations/versions/2026-10-27_00-00_9670ab7f6bc6_normalize_metadata_cache_timeouts.py: ########## @@ -0,0 +1,96 @@ +# 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. +"""Normalize legacy database metadata cache timeouts. + +Older database forms stored metadata cache timeouts as strings. Convert only +recognized non-negative integer strings, preserving malformed configurations +and unrelated fields instead of guessing at their intended values. + +Revision ID: 9670ab7f6bc6 +Revises: 3740c7bcb2c6 +Create Date: 2026-10-27 00:00:00.000000 +""" + +from decimal import InvalidOperation + +# The shared JSON wrapper cannot decode decimals without losing stored precision. +import simplejson # noqa: TID251 +from alembic import op +from sqlalchemy import column, Integer, select, table, Text + +from superset.utils import json + +revision = "9670ab7f6bc6" +down_revision = "3740c7bcb2c6" Review Comment: Updated in 2cbe5915d405d324403c3b73a9fae35b580ca7e8 after an ordinary merge of master 1aceca35ed218288dcf2b20ed09dbc053c204a47 (merge commit 7c7f98a1fb8c0b5e9662c7fd09c163106b07e729). The actual `superset db heads` output after the merge showed `f72b6e9c104a` and `9670ab7f6bc6`. I changed only this migration's `Revises` and `down_revision` to `f72b6e9c104a`; its revision ID, upgrade/downgrade logic and existing tests are unchanged. The CLI now reports only `9670ab7f6bc6 (head)`. The migration, single-head and related cache tests passed (48 tests). Ruff, format checking and `py_compile` passed. Pre-commit's only local failure is the existing three native-Windows `signal.SIGALRM`/`signal.alarm` type errors in untouched `superset/utils/core.py`; the same mypy hook environment with `--platform linux --check-untyped-defs` passed both PR Python files. I did not rerun the historical timing sample or change release-branch ordering. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
