Change by Robert Pollak :
--
nosy: +jondo
___
Python tracker
<https://bugs.python.org/issue43547>
___
___
Python-bugs-list mailing list
Unsubscribe:
Robert Pollak added the comment:
Sorry for not providing a pull request yet.
By the way, the "DB Browser for SQLite" (https://sqlitebrowser.org/) also
interprets DATETIME fields correctly.
(Could someone please change the "Stage" of this issue to "needs patc
Robert Pollak added the comment:
So my workaround is of course
```
table = pd.read_sql_query('select * from table', con)
column_type = pd.read_sql_query('PRAGMA table_info("table")', con)['type']
datetimes = table.columns[column_type == 'D
Change by Robert Pollak :
--
title: sqlite3: "select *" should optionally sniff and autoconvert TEXT
datetime fields -> sqlite3: optionally autoconvert table_info's DATETIME fields
___
Python tracker
<https://bugs.
Robert Pollak added the comment:
Here is now a reduced version of my real use case: 2017v2-reduced.db. The file
was originally created with "Oracle DBConvert". This file contains a table
without rows.
I was wrong in my last comment: There's also no sniffing needed here, see
Robert Pollak added the comment:
Paul, the sniffing would be only active for people who explicitly add a
connect() argument like detect_types=DETECT_DATETIME, which can have the
appropriate warning in the docs. You can also extend the sniffing to all
values, not just the first non-missing
Robert Pollak added the comment:
I have created the attached sqlite database file (with SQLiteStudio) for
testing. I contains a table `t` with a TEXT column `x` and a DATETIME
(according to SQLiteStudio) column `y`. The table contains a single row with
the value `2018-11-05 12:20:30` for
Robert Pollak added the comment:
Stéphane, your example does not match my use case with unknown table structure.
Does everyone agree that such a sniffing is out of scope for sqlite3?
That's not what I'd call "batteries included" :-(
--
title: sqlite3: "se
Change by Robert Pollak :
--
title: sqlite3: "select *" should autoconvert datetime fields -> sqlite3:
"select *" should optionally autoconvert TEXT datetime fields
___
Python tracker
<https://
Robert Pollak added the comment:
Thank you, Paul, for your hints on sniffing. I have now asked at SqliteStudio
for confirmation that they also do content sniffing to detect datetime text
fields: https://github.com/pawelsalawa/sqlitestudio/issues/3449 .
So in this issue I am suggesting to
Robert Pollak added the comment:
(In fact, I am currently taking the first non-missing entry of each text column
and trying to dateutil.parser.parse it. If that works, I use pandas.to_datetime
on the column.)
--
___
Python tracker
<ht
New submission from Robert Pollak :
Currently, fields are converted to datetime as described in
https://docs.python.org/3/library/sqlite3.html#sqlite3.PARSE_COLNAMES :
'select x as "x [datetime]" from table'
In my use case I don't know the names and locations
12 matches
Mail list logo