[issue45677] [doc] improve sqlite3 docs

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

I think it would also be helpful to make the examples at the top simpler/more 
idiomatic, e.g. using a context manager for the connection and calling 
conn.execute directly instead of spawning a cursor.

I think the information about the isolation_level parameter should also be 
displayed more prominently as many people are surprised to find sqlite3 
automatically opening transactions.

--
nosy: +iafisher

___
Python tracker 
<https://bugs.python.org/issue45677>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

See bpo-45858 for a more limited proposal to only deprecate the default 
converters.

--

___
Python tracker 
<https://bugs.python.org/issue26651>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher


Ian Fisher  added the comment:

See also bpo-26651 for a related proposal to deprecate the converter/adapter 
infrastructure entirely.

The proposal in this bug is more limited: remove the default converters (though 
I think the default adapters should stay), but continue to allow users to 
define their own converters.

--

___
Python tracker 
<https://bugs.python.org/issue45858>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45858] Deprecate default converters in sqlite3

2021-11-21 Thread Ian Fisher


New submission from Ian Fisher :

Per discussion at 
https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/,
 the default converters in SQLite3 have several bugs and are probably not worth 
continuing to maintain, so I propose deprecating them and removing them in a 
later version of Python.

Since the converters are opt-in, this should not affect most users of SQLite3.

--
components: Library (Lib)
messages: 406727
nosy: erlendaasland, iafisher
priority: normal
severity: normal
status: open
title: Deprecate default converters in sqlite3
type: behavior

___
Python tracker 
<https://bugs.python.org/issue45858>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-24 Thread Ian Fisher


Change by Ian Fisher :


--
keywords: +patch
pull_requests: +27469
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29200

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19065] sqlite3 timestamp adapter chokes on timezones

2021-10-07 Thread Ian Fisher


Change by Ian Fisher :


--
nosy: +iafisher

___
Python tracker 
<https://bugs.python.org/issue19065>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-10-07 Thread Ian Fisher


Change by Ian Fisher :


--
nosy: +iafisher

___
Python tracker 
<https://bugs.python.org/issue26651>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher


Ian Fisher  added the comment:

Okay, I started a discussion here: 
https://discuss.python.org/t/fixing-sqlite-timestamp-converter-to-handle-utc-offsets/10985

--

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-05 Thread Ian Fisher


Ian Fisher  added the comment:

> Another option could be to deprecate the current behaviour and then change it 
> to being timezone aware in Python 3.13.

This sounds like the simplest option.

I'd be interested in working on this myself, if you think it's something that a 
new CPython contributor could handle.

--

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores UTC offset

2021-10-04 Thread Ian Fisher


Ian Fisher  added the comment:

Unfortunately fixing this will have to be considered a backwards-incompatible 
change, since Python doesn't allow naive and aware datetime objects to be 
compared, so if sqlite3 starts returning aware datetimes, existing code might 
break.

Alternatively, perhaps this could be fixed in conjunction with changing 
sqlite3's API to allow per-database converters and adapters. Then, the old 
global TIMESTAMP converter could be retained for compatibility with existing 
code, and new code could opt-in to a per-database TIMESTAMP converter with the 
correct behavior.

--
title: Default TIMESTAMP converter in sqlite3 ignores time zone -> Default 
TIMESTAMP converter in sqlite3 ignores UTC offset

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores time zone

2021-10-02 Thread Ian Fisher


Ian Fisher  added the comment:

Substitute "UTC offset" for "time zone" in my comment above.

I have attached a minimal Python program demonstrating data loss from this bug.

--
Added file: https://bugs.python.org/file50324/timestamp.py

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45335] Default TIMESTAMP converter in sqlite3 ignores time zone

2021-09-30 Thread Ian Fisher


New submission from Ian Fisher :

The SQLite converter that the sqlite3 library automatically registers for 
TIMESTAMP columns 
(https://github.com/python/cpython/blob/main/Lib/sqlite3/dbapi2.py#L66) ignores 
the time zone even if it is present and always returns a naive datetime object.

I think that the converter should return an aware object if the time zone is 
present in the database. As it is, round trips of TIMESTAMP values from the 
database to Python and back might erase the original time zone info.

Now that datetime.datetime.fromisoformat is in Python 3.7, this should be easy 
to implement.

--
components: Library (Lib)
messages: 402979
nosy: iafisher
priority: normal
severity: normal
status: open
title: Default TIMESTAMP converter in sqlite3 ignores time zone
type: enhancement

___
Python tracker 
<https://bugs.python.org/issue45335>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com