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: SQLite dttm ISO format #22128

Closed

Conversation

michael-s-molina
Copy link
Member

SUMMARY

Fix SQLite dttm ISO format to use microseconds as the timespec. This resolves a bug when comparing dttm values with DATETIME and TIMESTAMP columns on SQLite.

TESTING INSTRUCTIONS

There's a unit test for this function. All tests should pass.

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

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Merging #22128 (d51b0b6) into master (6f6cb18) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #22128      +/-   ##
==========================================
- Coverage   66.98%   66.93%   -0.06%     
==========================================
  Files        1832     1832              
  Lines       69918    69918              
  Branches     7570     7570              
==========================================
- Hits        46838    46802      -36     
- Misses      21122    21158      +36     
  Partials     1958     1958              
Flag Coverage Δ
hive 52.60% <0.00%> (ø)
mysql ?
postgres 78.20% <0.00%> (-0.02%) ⬇️
presto 52.49% <0.00%> (ø)
python 81.27% <100.00%> (-0.11%) ⬇️
sqlite ?
unit 50.85% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/db_engine_specs/sqlite.py 89.28% <100.00%> (-7.15%) ⬇️
superset/common/utils/dataframe_utils.py 90.47% <0.00%> (-4.77%) ⬇️
superset/db_engine_specs/mysql.py 94.04% <0.00%> (-4.77%) ⬇️
superset/reports/commands/log_prune.py 85.71% <0.00%> (-3.58%) ⬇️
superset/utils/celery.py 86.20% <0.00%> (-3.45%) ⬇️
superset/connectors/sqla/utils.py 87.37% <0.00%> (-1.95%) ⬇️
superset/result_set.py 96.37% <0.00%> (-1.45%) ⬇️
superset/commands/importers/v1/utils.py 92.20% <0.00%> (-1.30%) ⬇️
superset/views/core.py 75.05% <0.00%> (-1.06%) ⬇️
... and 4 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -82,7 +82,7 @@ def convert_dttm(
utils.TemporalType.DATETIME,
utils.TemporalType.TIMESTAMP,
):
return f"""'{dttm.isoformat(sep=" ", timespec="seconds")}'"""
return f"""'{dttm.isoformat(sep=" ", timespec="microseconds")}'"""
Copy link
Member

Choose a reason for hiding this comment

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

I remember that this line was fixed by PR because the SQLite manual said that The datetime() function returns the date and time as text in their same formats: YYYY-MM-DD HH:MM:SS.(link)

So, please check out the previous PR and prevent introducing a regression. Thanks.

@michael-s-molina
Copy link
Member Author

Closing this in favor of #22170.

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

Successfully merging this pull request may close these issues.

2 participants