Paul
Paul

Reputation: 3081

sqlite's fetchall returns None instead of an empty list

According to the sqlite3 docs, fetchall() returns a list (empty if no rows meet the search criteria). On occasion, not repeatable, I am getting a return value None. What could None indicate, failed access to the DB? a missing table?

Upvotes: 1

Views: 2881

Answers (2)

Schalton
Schalton

Reputation: 3104

when fetchall() returns [] fetchone() returns None are you sure you weren't accidently using fetchone() ?

Upvotes: 0

Thomas Wouters
Thomas Wouters

Reputation: 133405

From a brief look at the source, it does not seem possible, barring memory corruption, for sqlite3's cursor's fetchall to return None. You must be doing something else that results in None.

Upvotes: 4

Related Questions