mirror of
https://github.com/apache/superset.git
synced 2024-09-07 06:17:45 -04:00
feat(alerts): Column for select tabs to send (#17604)
* init * init * Modify migration * Modify migration * revert config, delete test file * Rename column, modify migration * rename a column * Make extra non-nullable * Fix typo
This commit is contained in:
parent
8ff95f1936
commit
1377465a7d
@ -0,0 +1,50 @@
|
||||
# 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.
|
||||
"""add_extra_config_column_to_alerts
|
||||
|
||||
Revision ID: abe27eaf93db
|
||||
Revises: aea15018d53b
|
||||
Create Date: 2021-12-02 12:03:20.691171
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "abe27eaf93db"
|
||||
down_revision = "aea15018d53b"
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy.sql import column, table
|
||||
|
||||
connection = op.get_bind()
|
||||
|
||||
report_schedule = table("report_schedule", column("extra", String))
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table("report_schedule") as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column("extra", sa.Text(), nullable=True, default="{}",),
|
||||
)
|
||||
connection.execute(report_schedule.update().values({"extra": "{}"}))
|
||||
with op.batch_alter_table("report_schedule") as batch_op:
|
||||
batch_op.alter_column("extra", existing_type=sa.Text(), nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column("report_schedule", "extra")
|
@ -126,7 +126,7 @@ class Alert(Model, AuditMixinNullable):
|
||||
|
||||
@property
|
||||
def pretty_config(self) -> str:
|
||||
""" String representing the comparison that will trigger a validator """
|
||||
"""String representing the comparison that will trigger a validator"""
|
||||
config = json.loads(self.validator_config)
|
||||
|
||||
if self.validator_type.lower() == "operator":
|
||||
|
@ -145,6 +145,9 @@ class ReportSchedule(Model, AuditMixinNullable):
|
||||
# (Alerts/Reports) Unlock a possible stalled working state
|
||||
working_timeout = Column(Integer, default=60 * 60 * 1)
|
||||
|
||||
# Store the selected dashboard tabs etc.
|
||||
extra = Column(Text, default="{}")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return str(self.name)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user