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

fix: Date format when importing international timestamps #25113

Merged

Conversation

michael-s-molina
Copy link
Member

SUMMARY

This PR fixes a problem when importing CSV data that contains international timestamps (days come before months). We use Pandas read_csv to handle this operation and this PR exposes the dayfirst configuration to address the issue.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: using the following CSV, we can see that the dates are not parsed correctly.

Date Time,Group,Team
01-08-2023 02:01:00,A,2
02-08-2023 02:01:00,A,2
03-08-2023 02:01:00,A,2
04-08-2023 02:01:00,A,2
05-08-2023 02:01:00,A,2
06-08-2023 02:01:00,B,1
07-08-2023 02:01:00,B,1
08-08-2023 02:01:00,B,1
09-08-2023 02:01:00,B,1
10-08-2023 02:01:00,B,1
11-08-2023 02:01:00,B,3
12-08-2023 02:01:00,B,3
13-08-2023 02:01:00,B,3
14-08-2023 02:01:00,A,4
15-08-2023 02:01:00,C,4
16-08-2023 02:01:00,C,4
17-08-2023 02:01:00,C,4
18-08-2023 02:01:00,C,4
19-08-2023 02:01:00,C,4
20-08-2023 02:01:00,C,4
21-08-2023 02:01:00,C,4
263803409-7206acb8-36a5-4e93-a1ee-a296ae52061d


After: We provide the Day First configuration for international formats.

Screenshot 2023-08-29 at 13 36 11 Screenshot 2023-08-29 at 13 23 21

TESTING INSTRUCTIONS

1 - Import the example CSV
2 - Check the Day First configuration
3 - Make sure data is imported correctly

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Comment on lines +75 to +78
<tr>
{{ lib.render_field(form.day_first, begin_sep_label, end_sep_label,
begin_sep_field, end_sep_field) }}
</tr>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the relevant change. The rest is just formatting.

@john-bodley john-bodley added the review:checkpoint Last PR reviewed during the daily review standup label Aug 29, 2023
@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Aug 29, 2023
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@michael-s-molina michael-s-molina merged commit 00550d7 into apache:master Aug 30, 2023
30 checks passed
michael-s-molina added a commit that referenced this pull request Aug 30, 2023
@john-bodley john-bodley removed the review:checkpoint Last PR reviewed during the daily review standup label Aug 30, 2023
darwinsubramaniam pushed a commit to darwinsubramaniam/superset that referenced this pull request Sep 7, 2023
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 🍒 3.0.1 🍒 3.0.2 🍒 3.0.3 🍒 3.0.4 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants