dosubot[bot] commented on issue #28509:
URL: https://github.com/apache/superset/issues/28509#issuecomment-2468599254
<!-- Answer -->
The issue you're facing is likely due to SQLite's limitations with column
renaming. SQLite does not support the `ALTER TABLE ... RENAME COLUMN ...`
syntax directly, which is why you're encountering this error.
A common workaround for renaming a column in SQLite involves creating a new
table with the desired schema, copying the data from the old table to the new
table, dropping the old table, and then renaming the new table to the original
table's name. Here's a general approach you can take:
1. Create a new table with the updated schema.
2. Copy data from the old table to the new table.
3. Drop the old table.
4. Rename the new table to the original table's name.
Here's a simplified example of how you might implement this in a migration
script:
```python
from alembic import op
import sqlalchemy as sa
# Create a new table with the updated schema
op.create_table(
'report_schedule_new',
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('extra_json', sa.Text, nullable=True),
# Add other columns as needed
)
# Copy data from the old table to the new table
op.execute('''
INSERT INTO report_schedule_new (id, extra_json)
SELECT id, extra FROM report_schedule
''')
# Drop the old table
op.drop_table('report_schedule')
# Rename the new table to the original table's name
op.rename_table('report_schedule_new', 'report_schedule')
```
This approach should help you bypass the limitations of SQLite regarding
column renaming. If you continue to face issues, consider migrating to a more
robust database system like PostgreSQL or MySQL for better support with
migrations
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/faq.mdx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</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]