Skip to content
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: alembic's 'superset db migrate' fails with CompileError #27846

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Apr 1, 2024

When running on the latest master
running a simple superset db migrate within docker-compose exec superset bash to generate a new
database migration fails with error

sqlalchemy.exc.CompileError: PostgreSQL ENUM type requires a name.

This PR addresses the issue by giving a name to that particular enum.

From my understanding, this particular enum wasn't created in
a given migration script, so it may not be enforced at the database
level, probably by choice/design. Having the name here simply
allows for alembic's migrate subcommand to run.

When running on the latest `master`
running a simple `superset db migrate` to generate a new
database migration fails with error

```
sqlalchemy.exc.CompileError: PostgreSQL ENUM type requires a name.
```

This addresses the issue by giving a name to that particular enum.
From my understanding, this particular enum wasn't created in
a given migration script, so it may not be enforced at the database
level, probably by choice/design. Having the name here simply
allows for alembic's migrate subcommand to run.
Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.83%. Comparing base (ca47717) to head (fdbd644).
Report is 1295 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27846      +/-   ##
==========================================
+ Coverage   67.41%   69.83%   +2.42%     
==========================================
  Files        1920     1920              
  Lines       75242    75242              
  Branches     8423     8423              
==========================================
+ Hits        50724    52546    +1822     
+ Misses      22457    20635    -1822     
  Partials     2061     2061              
Flag Coverage Δ
hive 48.93% <ø> (?)
mysql 77.85% <ø> (-0.03%) ⬇️
postgres 77.99% <ø> (ø)
presto 53.63% <ø> (?)
python 83.15% <ø> (+5.01%) ⬆️
sqlite 77.43% <ø> (ø)
unit 56.78% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mistercrunch mistercrunch changed the title fix: alembic's 'superset db migate' fails with CompileError fix: alembic's 'superset db migrate' fails with CompileError Apr 2, 2024
Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum(
*[filter_type.value for filter_type in utils.RowLevelSecurityFilterType],
name="filter_type_enum",
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mistercrunch mistercrunch merged commit 3e147f8 into master Apr 2, 2024
41 of 43 checks passed
@john-bodley
Copy link
Member

@mistercrunch why is this an issue with Docker but not with global CI?

@mistercrunch
Copy link
Member Author

mistercrunch commented Apr 2, 2024

@john-bodley this was an issue with superset db migrate which auto-creates new migration. AFAIK this is done manually/locally when there's a need to create new migrations, never in CI.

Also note that auto-migrate has picks up the diff between the declared model and what's in the database post applying all migrations, and currently there are quite a bit of discrepancies that could be good to address.

jzhao62 pushed a commit to jzhao62/superset that referenced this pull request Apr 4, 2024
EandrewJones pushed a commit to UMD-ARLIS/superset that referenced this pull request Apr 5, 2024
EnxDev pushed a commit to EnxDev/superset that referenced this pull request Apr 12, 2024
@rusackas rusackas deleted the fix_db_migrate branch April 16, 2024 16:52
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 28, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset-io size/XS 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants