Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to Schedule Report , some issue in the latest release #26335

Closed
shafad1 opened this issue Dec 22, 2023 · 4 comments
Closed

Not able to Schedule Report , some issue in the latest release #26335

shafad1 opened this issue Dec 22, 2023 · 4 comments

Comments

@shafad1
Copy link

shafad1 commented Dec 22, 2023

A clear and concise description of what the bug is.

I have configured one report to send over mail, while scheduling getting the below error

image

Please help me to solve this , past two months i am trying to fix this as the same issue was faced in the version 3.0.1 as well

@sfirke
Copy link
Member

sfirke commented Dec 27, 2023

Did you try searching the GitHub repo for your error message? I searched "SQLite datetime" and found this issue where someone else was experiencing the same thing: #25969 It's better to post the error as text, not as an image, so that other people can find it via search.

They were using SQLite as a metadata db and they fixed the problem by switching to Postgres.

The Superset community voted to remove support for SQLite as a metadata database, this is scheduled to happen at the next major release (4.0)

So while someone could theoretically try to fix this problem, in practice people should be migrating away from SQLite and this would be a poor investment of developer energy. I'm going to close this as a duplicate of #25969 but please let us know if migrating to Postgres does not solve your problem.

EDIT in 2024 In subsequent community discussions, the Superset community discarded SIP-33 and thus decided to maintain support for SQLite as a backend.

@sfirke sfirke closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2023
@kha84
Copy link

kha84 commented May 1, 2024

Actually there's an easy way to restore it back to work with SQLite.
You just need to modify superset/reports/models.py like this:

$ diff ./reports/models.py ./reports/models.py.original
36d35
< from sqlalchemy.types import TypeDecorator
205,213d203
< class MyDateTime(TypeDecorator):
<     impl = DateTime
<
<     def process_bind_param(self, value, dialect):
<         from datetime import datetime
<         if type(value) is str:
<             return datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
<         return value
<
225,227c215,217
<     scheduled_dttm = Column(MyDateTime, nullable=False)
<     start_dttm = Column(MyDateTime)
<     end_dttm = Column(MyDateTime)
---
>     scheduled_dttm = Column(DateTime, nullable=False)
>     start_dttm = Column(DateTime)
>     end_dttm = Column(DateTime)

Or, elaborated:

  1. add this import somewhere to beginning:
from sqlalchemy.types import TypeDecorator
  1. to add this class:
class MyDateTime(TypeDecorator):
    impl = DateTime

    def process_bind_param(self, value, dialect):
        from datetime import datetime
        if type(value) is str:
            return datetime.strptime(value, '%Y-%m-%dT%H:%M:%S')
        return value
  1. to change ReportExecutionLog class to use MyDateTime like this:
class ReportExecutionLog(Model):  # pylint: disable=too-few-public-methods
    """
    Report Execution Log, hold the result of the report execution with timestamps,
    last observation and possible error messages
    """

    __tablename__ = "report_execution_log"
    id = Column(Integer, primary_key=True)
    uuid = Column(UUIDType(binary=True))

    # Timestamps
    scheduled_dttm = Column(MyDateTime, nullable=False)
    start_dttm = Column(MyDateTime)
    end_dttm = Column(MyDateTime)

    # (Alerts) Observed values
    value = Column(Float)
    value_row_json = Column(MediumText())

    state = Column(String(50), nullable=False)
    error_message = Column(Text)

    report_schedule_id = Column(
        Integer, ForeignKey("report_schedule.id"), nullable=False
    )
    report_schedule = relationship(
        ReportSchedule,
        backref=backref("logs", cascade="all,delete,delete-orphan"),
        foreign_keys=[report_schedule_id],
    )

    __table_args__ = (
        Index("ix_report_execution_log_report_schedule_id", report_schedule_id),
        Index("ix_report_execution_log_start_dttm", start_dttm),
    )

@shafad1
Copy link
Author

shafad1 commented May 1, 2024 via email

@sfirke
Copy link
Member

sfirke commented May 1, 2024

Hi @shafad1 that seems like a different problem. Please search for existing GitHub issues, I tried searching "jinja" "where" and found this which appears to be your issue but you can look further as many hits were returned: #23846 (comment)

In short, can you use dashboard filter scoping controls to stop that filter from applying on that chart?

Also Superset does not have "customers" as it is open-source free software. If you are able to contribute to improving it, whether to the code or documentation or helping others, please do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants