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 2018/08/13 21:53:01 UTC

[GitHub] john-bodley closed pull request #5618: [dashboards] Increasing position_json to MEDIUMTEXT for MySQL

john-bodley closed pull request #5618: [dashboards] Increasing position_json to MEDIUMTEXT for MySQL
URL: https://github.com/apache/incubator-superset/pull/5618
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/migrations/versions/1a1d627ebd8e_position_json.py b/superset/migrations/versions/1a1d627ebd8e_position_json.py
new file mode 100644
index 0000000000..e344740b16
--- /dev/null
+++ b/superset/migrations/versions/1a1d627ebd8e_position_json.py
@@ -0,0 +1,36 @@
+"""position_json
+
+Revision ID: 1a1d627ebd8e
+Revises: 0c5070e96b57
+Create Date: 2018-08-13 11:30:07.101702
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '1a1d627ebd8e'
+down_revision = '0c5070e96b57'
+
+from alembic import op
+import sqlalchemy as sa
+
+from superset.utils import MediumText
+
+
+def upgrade():
+    with op.batch_alter_table('dashboards') as batch_op:
+        batch_op.alter_column(
+            'position_json',
+            existing_type=sa.Text(),
+            type_=MediumText(),
+            existing_nullable=True,
+        )
+
+
+def downgrade():
+    with op.batch_alter_table('dashboards') as batch_op:
+        batch_op.alter_column(
+            'position_json',
+            existing_type=MediumText(),
+            type_=sa.Text(),
+            existing_nullable=True,
+        )
diff --git a/superset/models/core.py b/superset/models/core.py
index f3b18f8d31..05db09f650 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -41,6 +41,7 @@
 from superset.legacy import update_time_range
 from superset.models.helpers import AuditMixinNullable, ImportMixin, set_perm
 from superset.models.user_attributes import UserAttribute
+from superset.utils import MediumText
 from superset.viz import viz_types
 install_aliases()
 from urllib import parse  # noqa
@@ -364,7 +365,7 @@ class Dashboard(Model, AuditMixinNullable, ImportMixin):
     __tablename__ = 'dashboards'
     id = Column(Integer, primary_key=True)
     dashboard_title = Column(String(500))
-    position_json = Column(Text)
+    position_json = Column(MediumText())
     description = Column(Text)
     css = Column(Text)
     json_metadata = Column(Text)
diff --git a/superset/utils.py b/superset/utils.py
index 81fb4a1815..ca28a5a2c6 100644
--- a/superset/utils.py
+++ b/superset/utils.py
@@ -39,7 +39,8 @@
 from pydruid.utils.having import Having
 import pytz
 import sqlalchemy as sa
-from sqlalchemy import event, exc, select
+from sqlalchemy import event, exc, select, Text
+from sqlalchemy.dialects.mysql import MEDIUMTEXT
 from sqlalchemy.types import TEXT, TypeDecorator
 
 from superset.exceptions import SupersetException, SupersetTimeoutException
@@ -1011,3 +1012,7 @@ def get_username():
         return g.user.username
     except Exception:
         pass
+
+
+def MediumText():
+    return Text().with_variant(MEDIUMTEXT(), 'mysql')


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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