Giter Club home page Giter Club logo

Comments (1)

dosubot avatar dosubot commented on July 3, 2024 2

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:

  1. Reflects the current database state to get existing tables.
  2. Deletes any duplicate entries in the tagged_object table.
  3. Creates a unique constraint on the 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.

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.