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

Date Columns Being Inferred as Strings in Script Editor Results #433

Open
UmakanthKaspa opened this issue Jan 24, 2025 · 0 comments
Open

Comments

@UmakanthKaspa
Copy link
Contributor

UmakanthKaspa commented Jan 24, 2025

Issue Description:

When using the Script Editor in Frappe Insights to create a query, columns with date values are being inferred as strings instead of the Date type. This creates discrepancies and limits the ability to perform date-related operations. Additionally, integer and other types are correctly inferred, which makes this behavior inconsistent.


Steps to Reproduce:

  1. Open the Script Editor in Frappe Insights.
  2. Use the following Python script to generate results:
results = [
    {
        "employee_id": 101,  # Integer
        "salary": '2023-01-23',  # String value (looks like a date but is a string)
        "join_date": frappe.utils.getdate(frappe.utils.today()),  # Actual date value
    }
]
  1. Execute the script and check the inferred types of the columns:
    • employee_id: Correctly inferred as Integer.
    • salary: Correctly inferred as String.
    • join_date: Incorrectly inferred as String instead of Date.

Expected Behavior:

  • Columns containing actual date values (e.g., join_date) should be inferred as Date or Datetime types, depending on their structure.

Observed Behavior:

  • The join_date column is inferred as a String type.

Screenshot:

Image

Image


@nextchamp-saqib

  • Is this a bug in Script Editor?
  • Should I explicitly cast the data type, or is there a recommended approach to handle this scenario?
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

1 participant