Open fgvieira opened 3 weeks ago
Hey there, @fgvieira! I'm here to assist you with any bugs, questions, or contributions you might have for the repository. Let me know how I can help you!
To resolve the warnings encountered when running superset db upgrade
after installing Superset using conda, you can follow the steps outlined in the migration script provided. The script ensures that any duplicates are removed and a unique constraint is created on the tagged_object
table.
Here is the relevant code from the migration script:
def upgrade():
bind = op.get_bind() # Get the database connection bind
# Reflect the current database state to get existing tables
metadata.reflect(bind=bind)
# Delete duplicates if any
min_id_subquery = (
select(
[
func.min(tagged_object_table.c.id).label("min_id"),
tagged_object_table.c.tag_id,
tagged_object_table.c.object_id,
tagged_object_table.c.object_type,
]
)
.group_by(
tagged_object_table.c.tag_id,
tagged_object_table.c.object_id,
tagged_object_table.c.object_type,
)
.alias("min_ids")
)
delete_query = tagged_object_table.delete().where(
tagged_object_table.c.id.notin_(select([min_id_subquery.c.min_id]))
)
bind.execute(delete_query)
# Create unique constraint
utils.create_unique_constraint(op, index_id, table_name, uix_columns)
This script performs the following actions:
tagged_object
table.tagged_object
table to prevent future duplicates.Ensure that you have the migration_utils
module available and properly configured, as it is used to create and drop the unique constraint.
Additionally, after running the migration script, you should follow the standard procedure for upgrading Superset's metadata database:
superset db upgrade
superset init
While upgrading Superset should not delete your charts and dashboards, it is recommended to backup your metadata database before upgrading. For production environments, consider upgrading in a staging environment first and then upgrading production during off-peak hours.
Refer to the UPDATING.md
file for any potential downtime or breaking changes that might affect your deployment. For example, adding an index to query.sql_editor_id
or updating database columns to use the MediumText
type might require some downtime on large deployments. Always review the latest updates and changes to ensure a smooth upgrade process [1][2][3].
To continue talking to Dosu, mention @dosu.
Bug description
Installed
superset
using conda and, while runningsuperset db upgrade
I get some warnings:How to reproduce the bug
micromamba env create --name superset -c conda-forge superset pillow psycopg2-binary
export FLASK_APP=superset
export SUPERSET_CONFIG_PATH=/var/superset/config.py
(the same as in here)superset db upgrade
Screenshots/recordings
No response
Superset version
4.0.1
Python version
3.11
Node version
I don't know
Browser
Firefox
Additional context
No response
Checklist