dosubot[bot] commented on issue #29292:
URL: https://github.com/apache/superset/issues/29292#issuecomment-2175852971

   <!-- Greeting -->
   @shuailingyi Hello there! I'm here to help you with any bugs, questions, or 
becoming a contributor. Let's squash those bugs together! 🤖
   
   <!-- Answer -->
   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`:
   
   ```python
   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` 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/models/dashboard.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]

Reply via email to