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 2022/08/01 16:47:13 UTC

[GitHub] [superset] ktmud opened a new pull request, #20936: chore(db): ensure query_context is MediumText before viz migration

ktmud opened a new pull request, #20936:
URL: https://github.com/apache/superset/pull/20936

   ### SUMMARY
   
   Since #20779 will just be an no-op if the columns are already MediumText, let's just do it again before the viz migration. This way, administrators don't have to remember to manually migrate the columns before running `superset db migration`.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A
   
   ### TESTING INSTRUCTIONS
   
   CI and tested locally via `superset db upgrade`.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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


[GitHub] [superset] ktmud merged pull request #20936: chore(db): ensure query_context is MediumText before viz migration

Posted by GitBox <gi...@apache.org>.
ktmud merged PR #20936:
URL: https://github.com/apache/superset/pull/20936


-- 
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


[GitHub] [superset] ktmud commented on a diff in pull request #20936: chore(db): ensure query_context is MediumText before viz migration

Posted by GitBox <gi...@apache.org>.
ktmud commented on code in PR #20936:
URL: https://github.com/apache/superset/pull/20936#discussion_r936086818


##########
superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py:
##########
@@ -29,6 +32,14 @@
 
 
 def upgrade():
+    # Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
+    # before migration, as the migration will save a duplicate form_data backup
+    # which may significantly increase the size of these fields.
+    if isinstance(op.get_bind().dialect, MySQLDialect):
+        # If the columns are already MEDIUMTEXT, this is a no-op
+        op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")

Review Comment:
   Because this is only for one dialect and raw SQL is easier to read. People can also copy the statement directly if they ever want to test it manually.



-- 
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


[GitHub] [superset] ktmud commented on a diff in pull request #20936: chore(db): ensure query_context is MediumText before viz migration

Posted by GitBox <gi...@apache.org>.
ktmud commented on code in PR #20936:
URL: https://github.com/apache/superset/pull/20936#discussion_r936086818


##########
superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py:
##########
@@ -29,6 +32,14 @@
 
 
 def upgrade():
+    # Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
+    # before migration, as the migration will save a duplicate form_data backup
+    # which may significantly increase the size of these fields.
+    if isinstance(op.get_bind().dialect, MySQLDialect):
+        # If the columns are already MEDIUMTEXT, this is a no-op
+        op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")

Review Comment:
   Because this is only for one dialect and raw SQL is easier to read. People can also copy the statement more easily if they ever one to test it manually.



##########
superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py:
##########
@@ -29,6 +32,14 @@
 
 
 def upgrade():
+    # Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
+    # before migration, as the migration will save a duplicate form_data backup
+    # which may significantly increase the size of these fields.
+    if isinstance(op.get_bind().dialect, MySQLDialect):
+        # If the columns are already MEDIUMTEXT, this is a no-op
+        op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")

Review Comment:
   Because this is only for one dialect and raw SQL is easier to read. People can also copy the statement directly if they ever one to test it manually.



-- 
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


[GitHub] [superset] ktmud commented on a diff in pull request #20936: chore(db): ensure query_context is MediumText before viz migration

Posted by GitBox <gi...@apache.org>.
ktmud commented on code in PR #20936:
URL: https://github.com/apache/superset/pull/20936#discussion_r936086818


##########
superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py:
##########
@@ -29,6 +32,14 @@
 
 
 def upgrade():
+    # Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
+    # before migration, as the migration will save a duplicate form_data backup
+    # which may significantly increase the size of these fields.
+    if isinstance(op.get_bind().dialect, MySQLDialect):
+        # If the columns are already MEDIUMTEXT, this is a no-op
+        op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")

Review Comment:
   Because this is only for one dialect and raw SQL is easier to read.



-- 
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


[GitHub] [superset] john-bodley commented on a diff in pull request #20936: chore(db): ensure query_context is MediumText before viz migration

Posted by GitBox <gi...@apache.org>.
john-bodley commented on code in PR #20936:
URL: https://github.com/apache/superset/pull/20936#discussion_r936059564


##########
superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py:
##########
@@ -29,6 +32,14 @@
 
 
 def upgrade():
+    # Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
+    # before migration, as the migration will save a duplicate form_data backup
+    # which may significantly increase the size of these fields.
+    if isinstance(op.get_bind().dialect, MySQLDialect):
+        # If the columns are already MEDIUMTEXT, this is a no-op
+        op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")

Review Comment:
   @ktmud why raw SQL here and not the Alembic [alter_column](https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations.Operations.alter_column) method?



-- 
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