This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: SQLite returns "str" instead of "datetime.datetime" with aggregate queries.
Type: behavior Stage: resolved
Components: C API Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Dennis Sweeney, berker.peksag, eric.smith, miss-islington, ravi-misra, sblondon, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2020-09-05 06:23 by ravi-misra, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
reproducer.py Dennis Sweeney, 2020-09-05 21:58
Pull Requests
URL Status Linked Edit
PR 23855 merged sblondon, 2020-12-19 14:58
PR 23862 merged miss-islington, 2020-12-19 22:53
PR 23863 merged miss-islington, 2020-12-19 22:53
Messages (8)
msg376425 - (view) Author: Ravi Misra (ravi-misra) Date: 2020-09-05 06:23
I tested the timestamp column in SQLite with MAX/MIN queries. They return string values instead of datetime.datetime.
msg376435 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-09-05 17:59
[Adjusted title so that it displays correctly when not logged in. The text within less-than and greater-than was being dropped, probably because some piece of code didn't want to display unknown tags.]
msg376446 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2020-09-05 21:58
Here's a reproducer.
msg376447 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-09-05 22:39
PARSE_DECLTYPES does not work for generated fields. sqlite3_column_decltype() just returns NULL.

PARSE_COLNAMES works only when the column name contains the column type in square brackets. For generated fields sqlite3_column_name() returns the expression used to evaluate it, e.g. "max(d)". It does not contain needed information.

So we cannot do anything with this because SQLite just does not provide information needed to determine the type.

It would be worth to document this limitation.
msg383408 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-19 22:52
New changeset 09a36cdfb7c22f44df45b44e5561776206bcedfb by sblondon in branch 'master':
bpo-41724: Explain when the conversion is not possible with detect_types enabled (GH-23855)
https://github.com/python/cpython/commit/09a36cdfb7c22f44df45b44e5561776206bcedfb
msg383410 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-20 00:02
New changeset a34ab8188e0352e4066da4f79ed3cc24d1b61a63 by Miss Islington (bot) in branch '3.9':
bpo-41724: Explain when the conversion is not possible with detect_types enabled (GH-23855) (GH-23862)
https://github.com/python/cpython/commit/a34ab8188e0352e4066da4f79ed3cc24d1b61a63
msg383411 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-20 00:03
New changeset 24862b02dfd1e2843727f28fa2ba05828fdfa8de by Miss Islington (bot) in branch '3.8':
bpo-41724: Explain when the conversion is not possible with detect_types enabled (GH-23855) (GH-23863)
https://github.com/python/cpython/commit/24862b02dfd1e2843727f28fa2ba05828fdfa8de
msg383412 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-12-20 00:03
Thanks for the PR!
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85890
2020-12-20 00:03:47eric.smithsetstatus: open -> closed
resolution: fixed
messages: + msg383412

stage: patch review -> resolved
2020-12-20 00:03:02eric.smithsetmessages: + msg383411
2020-12-20 00:02:38eric.smithsetmessages: + msg383410
2020-12-19 22:53:26miss-islingtonsetpull_requests: + pull_request22725
2020-12-19 22:53:18miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22724
2020-12-19 22:52:52eric.smithsetmessages: + msg383408
2020-12-19 14:58:46sblondonsetkeywords: + patch
nosy: + sblondon

pull_requests: + pull_request22720
stage: patch review
2020-09-05 22:39:11serhiy.storchakasetnosy: + berker.peksag, serhiy.storchaka
messages: + msg376447
2020-09-05 21:58:38Dennis Sweeneysetfiles: + reproducer.py
nosy: + Dennis Sweeney
messages: + msg376446

2020-09-05 17:59:04eric.smithsetnosy: + eric.smith

messages: + msg376435
title: SQLite returns <str> instead of <datetime.datetime> with aggregate queries. -> SQLite returns "str" instead of "datetime.datetime" with aggregate queries.
2020-09-05 06:23:53ravi-misracreate