-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SpatiaLite provider changes timestamp format #30288
Comments
First insights, this is directly extracted from ogr. See e.g.
QGIS handles it as string field internally and not as date, whereas ogr handles it as date (see above) |
@anitagraser after the above insights, the problem to me seems to be that QGIS detects this as string even though ogr treats it as date. Reading your original message you seem to expect strings. I suppose was properly exposing these as DateTime in QGIS would also work for you? |
@m-kuhn What TimeManager needs is consistency. It was inferring the timestamp format from the value it received from p.minimumValue(timefield). Then it used this format to construct a subsetString filter. This failed because the two formats were different. As a workaround, TimeManager now uses the time field value of the first feature rather than the p.minimumValue(timefield) Yes, I think exposing these values as DateTime would work. I assume that's what the PostGIS provider does? |
Yes, that's what Postgres does. I'll have a look. Sqlite based formats are a bit more delicate unfortunately because sqlite doesn't know a native DateTime format, which means ogr/qgis abstracts this on top. Btw, the inconsistency also exists on pure ogr level, see below. But I'm confident by switching to "real" DateTime types we can make it more stable. Let's just hope we don't open a can of worms with timezones and all the other things that suddenly start to matter.
|
This seems to be more tricky than expected:
Like that it seems to be something that we can't fix without some changes (or hints) from ogr side @rouault any idea if there's something that can be done? |
Here's the DDL of this table
So it is expected that OGR reports a string for t_datetime as it is typed as VARCHAR. Regarding the behaviour with MIN(), this is a particular trick in the OGR SQLite driver: since there's no way (at least easy way) to recover the data type of the column passed to MIN(), the driver has a heuristics to try to recover it: |
@anitagraser so this means the easiest solution would be to change the datatype to @rouault do you see anything that can be done to get more stability here in the future? Like
|
I'm pretty sure we can close this issue here. The specific datetime filtering issue raised here isn't problem under the new temporal framework |
@anitagraser @nirvn can we then? |
The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". |
Describe the bug
I have a SpatiaLite (https://www.dropbox.com/s/4dtkpmlyhs741bn/geolife-beijing.sqlite?dl=0) with string fields that contain timestamps in %Y-%m-%d %H:%M:%S format. However, if I access the min or max values through the provider, the format changes to %Y/%m/%d %H:%M:%S
How to Reproduce
QGIS and OS versions
Tested with 3.4.8 on Win 10 and Ubuntu
Additional context
This behavior messed up TimeManager https://github.com/anitagraser/TimeManager/issues/218
The text was updated successfully, but these errors were encountered: