[New-bugs-announce] [issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

Tore Anderson report at bugs.python.org
Thu Mar 4 01:44:55 EST 2021


New submission from Tore Anderson <tore at fud.no>:

In https://docs.python.org/3/library/sqlite3.html, the following example code is found:

> # Do this instead
> t = ('RHAT',)
> c.execute('SELECT * FROM stocks WHERE symbol=?', t)
> print(c.fetchone())

However this fails as follows:

> Traceback (most recent call last):
>   File "./test.py", line 8, in <module>
>     print(c.fetchone())
> AttributeError: 'sqlite3.Connection' object has no attribute 'fetchone'

I believe the correct code should have been (at least it works for me):

> # Do this instead
> t = ('RHAT',)
> cursor = c.execute('SELECT * FROM stocks WHERE symbol=?', t)
> print(cursor.fetchone())

Tore

----------
assignee: docs at python
components: Documentation
messages: 388078
nosy: docs at python, toreanderson
priority: normal
severity: normal
status: open
title: Non-existent method sqlite3.Connection.fetchone() used in docs
versions: Python 3.9

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


More information about the New-bugs-announce mailing list