-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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(key_value): use longblob on mysql #19805
Conversation
I've confirmed it works. Thanks |
Codecov Report
@@ Coverage Diff @@
## master #19805 +/- ##
===========================================
- Coverage 66.54% 53.94% -12.61%
===========================================
Files 1692 1692
Lines 64807 64807
Branches 6661 6661
===========================================
- Hits 43129 34961 -8168
- Misses 19978 28146 +8168
Partials 1700 1700
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Should we add a new migration for users who already ran this migration? I'm also wondering whether it's worth creating a new type like MediumText and update key_value/models to point to this type as well. It's risky when the declarative model is out of sync with the actual db schema. |
@ktmud I was wondering the same, and I unfortunately don't have a good answer. @iercan who caught this and was kind enough to raise it already did a manual migration (see https://apache-superset.slack.com/archives/CH307T4JG/p1650463618742279?thread_ts=1650031133.456189&cid=CH307T4JG ), and I kinda feel like orgs that are running off of master might need a different process for these types of migration improvements. The problem is, if I make a new migration for this, it'll be hell cherrying it into all the various release branches. But I'm open to suggestions. |
Hmm... since the migration is not that complicated I guess it'd be okay to ask users to do it manually. For those who choose to deploy on That said, do you mind changing the solution to follow the same convention like |
It seems another solution to this is to specify a length for Would that be preferred? |
I think that's perfect 👍 I considered adding a I wrote the following test script: import sqlalchemy as sa
from sqlalchemy.schema import CreateTable
from sqlalchemy.types import LargeBinary
tbl = sa.Table('tbl', sa.MetaData(), sa.Column("value", sa.LargeBinary(length=2**31)))
mysql_engine = sa.create_engine('mysql://uid:pwd@localhost')
pg_engine = sa.create_engine('postgresql://uid:pwd@localhost')
print("-- MySQL:")
print(CreateTable(tbl).compile(pg_engine))
print("-- Postgres:")
print(CreateTable(tbl).compile(mysql_engine)) which results in this:
And when the MySQL one is executed, it results in |
0ddc75a
to
9c1a218
Compare
9c1a218
to
c190253
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* fix(key_value): use longblob on mysql * set length (cherry picked from commit a1bd5b2)
* fix(key_value): use longblob on mysql * set length
* fix(key_value): use longblob on mysql * set length
SUMMARY
On Postgres
LongBinary
equates toBYTEA
which can store 1 Gb values. However, it turns outLongBinary
without a specifiedlength
createsBLOB
on MySQL, which is limited to 64 kb. To make sure thevalue
column on thekey_value
table is as wide on MySQL as it is on Postgres, we specify the length to ensure that an appropriately sized column is created.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION