dosubot[bot] commented on issue #31144:
URL: https://github.com/apache/superset/issues/31144#issuecomment-2497967594
<!-- Greeting -->
Hey @Jockxtar, I'm here to help you with any bugs, questions, or
contributions you have in mind. Let's work together to solve this issue!
<!-- Answer -->
To resolve the "duplicate column name: catalog_perm" error during the
upgrade, you should check if the `catalog_perm` column already exists in your
database schema. This error occurs when the migration script tries to add a
column that is already present.
Here's how you can address this issue:
1. **Check Existing Columns**: Manually inspect your database to see if the
`catalog_perm` column is already present in the `tables` or `slices` tables.
2. **Modify the Migration Script**: If the column exists, you can modify the
migration script to add the column only if it does not already exist. Here's an
example modification:
```python
from sqlalchemy.engine import reflection
def upgrade():
conn = op.get_bind()
inspector = reflection.Inspector.from_engine(conn)
# Check if 'catalog_perm' column exists in 'tables'
columns = [col['name'] for col in inspector.get_columns('tables')]
if 'catalog_perm' not in columns:
op.add_column(
"tables",
sa.Column("catalog_perm", sa.String(length=1000),
nullable=True),
)
# Check if 'catalog_perm' column exists in 'slices'
columns = [col['name'] for col in inspector.get_columns('slices')]
if 'catalog_perm' not in columns:
op.add_column(
"slices",
sa.Column("catalog_perm", sa.String(length=1000),
nullable=True),
)
upgrade_catalog_perms(engines={"postgresql"})
```
This modification ensures that the column is only added if it does not
already exist, preventing the duplicate column error
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/migrations/versions/2024-05-01_10-52_58d051681a3b_add_catalog_perm_to_tables.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]