None result should be None (fetchrow and fetch)
See original GitHub issuequery = ... # some SA select query
row = await conn.fetchrow(query) # conn is SAConnection
When the underlying asyncpg connection returns None as the “empty” result, row
should become None as well.
Currently, row
is not None but row.row
is None.
This would confuse the users who expect the API semantics to be same to asyncpg.
The same applies to fetch
and execute
which returns a RecordGenerator
because it does not check None when instantiating Record
objects.
Q: What’s the purpose of having seem-to-be-redundant Record
and RecordGenerator
classes?
They look like a no-op proxy to asyncpg’s return objects.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Prepared_stmt.fetch() should explicitly either return None or ...
While fetchval and fetchrow both explicitly return None if __bind_execute does not return any data, it's not made clear what will be ...
Read more >Python cursor's fetchall, fetchmany(), fetchone() to ... - PYnative
To fetch a single row from a result set we can use cursor.fetchone() . This method returns a single tuple. It can return...
Read more >API Reference — asyncpg Documentation
Copy the results of a query to a file or file-like object. Parameters ... coroutine fetchrow(query, *args, timeout=None, record_class=None)[source]¶.
Read more >How to check if a result set is empty? - python - Stack Overflow
Just an empty list ( [] ) for cursor.fetchall() and None for cursor.fetchone() . For any other statement, e.g. INSERT or UPDATE , ......
Read more >How to use Python cursor's fetchall, fetchmany(), fetchone() to ...
To fetch a single row from a result set we can use cursor.fetchone() . This method returns a single tuple. It can return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rbcarson Good catch. This is fixed in 0.8.2. RecordGenerator will now be falsey on an empty list.
Ya, thats valid. I’ll leave this open until I do something about it.