exemplary-citizen commented on a change in pull request #16756:
URL: https://github.com/apache/superset/pull/16756#discussion_r719927096
##########
File path: superset/views/database/forms.py
##########
@@ -239,54 +241,7 @@ def at_least_one_schema_is_allowed(database: Database) ->
bool:
)
-class ExcelToDatabaseForm(DynamicForm):
- # pylint: disable=E0211
- def excel_allowed_dbs() -> List[Database]: # type: ignore
- # TODO: change allow_csv_upload to allow_file_upload
Review comment:
This is a longstanding TODO so I do think we should go ahead with the db
migration.
##########
File path: superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py
##########
@@ -0,0 +1,57 @@
+# 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.
+"""rename_csv_to_file
+
+Revision ID: b92d69a6643c
+Revises: 3ebe0993c770
+Create Date: 2021-09-19 14:42:20.130368
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = "b92d69a6643c"
+down_revision = "3ebe0993c770"
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy.sql import expression
+
+
+def upgrade():
+ with op.batch_alter_table("dbs") as batch_op:
+ batch_op.add_column(
+ sa.Column(
+ "allow_file_upload",
+ sa.Boolean(),
+ nullable=False,
+ server_default=expression.true(),
+ )
+ )
+ batch_op.drop_column("allow_csv_upload")
Review comment:
Instead of adding and dropping the columns, I think we can go with this
renaming pattern instead:
```suggestion
def upgrade():
with op.batch_alter_table("dbs") as batch_op:
batch_op.alter_column("allow_csv_upload",
new_column_name="allow_file_upload")
```
--
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]