You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/11/02 16:16:11 UTC

[GitHub] [superset] exemplary-citizen commented on a change in pull request #17323: fix: rename to schemas_allowed_for_file_upload in dbs.extra

exemplary-citizen commented on a change in pull request #17323:
URL: https://github.com/apache/superset/pull/17323#discussion_r741256000



##########
File path: superset/migrations/versions/b92d69a6643c_rename_csv_to_file.py
##########
@@ -15,23 +15,54 @@
 # specific language governing permissions and limitations
 # under the License.
 """rename_csv_to_file
-
 Revision ID: b92d69a6643c
 Revises: 32646df09c64
 Create Date: 2021-09-19 14:42:20.130368
-
 """
 
 # revision identifiers, used by Alembic.
 revision = "b92d69a6643c"
 down_revision = "32646df09c64"
 
-import sqlalchemy as sa
+import json
+import logging
+
 from alembic import op
+import sqlalchemy as sa
+from sqlalchemy import Column, Integer, Text
 from sqlalchemy.engine.reflection import Inspector
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
+
+Base = declarative_base()
+
+
+class Database(Base):
+
+    __tablename__ = "dbs"
+    id = Column(Integer, primary_key=True)
+    extra = Column(Text)
 
 
 def upgrade():
+    bind = op.get_bind()
+    session = db.Session(bind=bind)
+
+    for database in session.query(Database).all():
+        try:
+            extra = json.loads(database.extra)
+        except json.decoder.JSONDecodeError as ex:

Review comment:
       it could technically raise a TypeError if `database.extra` isn't one of str, bytes or bytearray




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org