Giter Club home page Giter Club logo

Comments (1)

dosubot avatar dosubot commented on June 28, 2024 2

@shuailingyi Hello there! I'm here to help you with any bugs, questions, or becoming a contributor. Let's squash those bugs together! 🤖

To resolve the sqlalchemy.exc.ArgumentError related to the "Dashboard.changed_by" relationship property when logging into Superset, ensure that the changed_by property is correctly defined in the Dashboard class. The changed_by property should be defined as a relationship to the User model.

Here is the relevant code snippet from the Dashboard class in superset/models/dashboard.py:

class Dashboard(AuditMixinNullable, ImportExportMixin, Model):
    """The dashboard object!"""

    __tablename__ = "dashboards"
    id = Column(Integer, primary_key=True)
    dashboard_title = Column(String(500))
    position_json = Column(utils.MediumText())
    description = Column(Text)
    css = Column(utils.MediumText())
    certified_by = Column(Text)
    certification_details = Column(Text)
    json_metadata = Column(utils.MediumText())
    slug = Column(String(255), unique=True)
    slices: list[Slice] = relationship(
        Slice, secondary=dashboard_slices, backref="dashboards"
    )
    owners = relationship(
        security_manager.user_model,
        secondary=dashboard_user,
        passive_deletes=True,
    )
    tags = relationship(
        "Tag",
        overlaps="objects,tag,tags",
        secondary="tagged_object",
        primaryjoin="and_(Dashboard.id == TaggedObject.object_id, "
        "TaggedObject.object_type == 'dashboard')",
        secondaryjoin="TaggedObject.tag_id == Tag.id",
        viewonly=True,  # cascading deletion already handled by superset.tags.models.ObjectUpdater.after_delete
    )
    published = Column(Boolean, default=False)
    is_managed_externally = Column(Boolean, nullable=False, default=False)
    external_url = Column(Text, nullable=True)
    roles = relationship(security_manager.role_model, secondary=DashboardRoles)
    embedded = relationship(
        "EmbeddedDashboard",
        back_populates="dashboard",
        cascade="all, delete-orphan",
    )
    export_fields = [
        "dashboard_title",
        "position_json",
        "json_metadata",
        "description",
        "css",
        "slug",
        "certified_by",
        "certification_details",
        "published",
    ]
    extra_import_fields = ["is_managed_externally", "external_url"]

    @property
    def changed_by_name(self) -> str:
        if not self.changed_by:
            return ""
        return str(self.changed_by)

Ensure that the changed_by property is correctly defined and linked to the User model. If the changed_by property is missing or incorrectly defined, it can cause the sqlalchemy.exc.ArgumentError [1].

To continue talking to Dosu, mention @dosu.

from superset.

shuailingyi avatar shuailingyi commented on June 28, 2024

The issue remains unresolved. Specifically, there are problems related to defining the relationship with the User model, as well as other issues involving query expressions that do not apply to relationship properties.
Regarding the relationship definition, the code attempts to establish a connection between the current model and the User model through the changed_by attribute. However, it seems there might be a mismatch or incorrect configuration that prevents this relationship from being properly established.

Additionally, the error messages "Query has only expression-based entities, which do not apply to relationship property 'SqlaTable.database'" and "Query has only expression-based entities, which do not apply to relationship property 'Slice.changed_by'" suggest that there are queries being executed that are not compatible with the relationship properties defined in the models.

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.