[issue34018] SQLite converters are documented to be sensitive to the case of type names, but they're not

Sergey Fedoseev report at bugs.python.org
Mon Jul 2 04:23:53 EDT 2018


New submission from Sergey Fedoseev <fedoseev.sergey at gmail.com>:

SQLite converters are documented to be sensitive to the case of type names, but they're not.

In [50]: import sqlite3
    ...: 
    ...: sqlite3.converters.clear()
    ...: sqlite3.register_converter('T', lambda x: 'UPPER')
    ...: sqlite3.register_converter('t', lambda x: 'lower')
    ...: 
    ...: con = sqlite3.connect(':memory:', detect_types=sqlite3.PARSE_DECLTYPES)
    ...: cur = con.cursor()
    ...: cur.execute('create table test(upper T, lower t)')
    ...: cur.execute('insert into test values (?, ?)', ('X', 'x'))
    ...: cur.execute('select * from test')
    ...: cur.fetchone()
    ...: 
Out[50]: ('lower', 'lower')

In [51]: sqlite3.converters
Out[51]: {'T': <function __main__.<lambda>>}

Original commit in pysqlite that makes converters case insensitive: https://github.com/ghaering/pysqlite/commit/1e8bd36be93b7d7425910642b72e4152c77b0dfd

----------
assignee: docs at python
components: Documentation
messages: 320855
nosy: docs at python, sir-sigurd
priority: normal
severity: normal
status: open
title: SQLite converters are documented to be sensitive to the case of type names, but they're not

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34018>
_______________________________________


More information about the Python-bugs-list mailing list