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

fix: Change datatype of column type in BaseColumn to allow larger datatype names for complexed columns #17360

Merged
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ assists people when migrating to a new version.
- [17539](https://github.com/apache/superset/pull/17539): all Superset CLI commands
(init, load_examples and etc) require setting the FLASK_APP environment variable
(which is set by default when .flaskenv is loaded)
- [17360](https://github.com/apache/superset/pull/17360): changes the column type from `VARCHAR(32)` to `TEXT` in table `table_columns`, potentially requiring a table lock on MySQL dbs or taking some time to complete on large deployments.

### Deprecations

Expand Down
2 changes: 1 addition & 1 deletion superset/connectors/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class BaseColumn(AuditMixinNullable, ImportExportMixin):
column_name = Column(String(255), nullable=False)
verbose_name = Column(String(1024))
is_active = Column(Boolean, default=True)
type = Column(String(32))
type = Column(Text)
groupby = Column(Boolean, default=True)
filterable = Column(Boolean, default=True)
description = Column(Text)
Expand Down
2 changes: 1 addition & 1 deletion superset/datasets/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def validate_python_date_format(value: str) -> None:
class DatasetColumnsPutSchema(Schema):
id = fields.Integer()
column_name = fields.String(required=True, validate=Length(1, 255))
type = fields.String(validate=Length(1, 32))
type = fields.String(allow_none=True)
betodealmeida marked this conversation as resolved.
Show resolved Hide resolved
verbose_name = fields.String(allow_none=True, Length=(1, 1024))
description = fields.String(allow_none=True)
expression = fields.String(allow_none=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.
"""Change datatype of type in BaseColumn

Revision ID: 3ba29ecbaac5
Revises: abe27eaf93db
Create Date: 2021-11-02 17:44:51.792138

"""

# revision identifiers, used by Alembic.
revision = "3ba29ecbaac5"
down_revision = "abe27eaf93db"

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql


def upgrade():

with op.batch_alter_table("table_columns") as batch_op:
batch_op.alter_column(
"type", existing_type=sa.VARCHAR(length=32), type_=sa.TEXT()
)


def downgrade():
with op.batch_alter_table("table_columns") as batch_op:
batch_op.alter_column(
"type", existing_type=sa.TEXT(), type_=sa.VARCHAR(length=32)
)