Are there Python ways to execute queries on PostgreSQL without getting data over?

David Raymond David.Raymond at tomtom.com
Mon Oct 19 09:26:42 EDT 2020


> Are there Python ways to execute queries on PostgreSQL without getting data over?
> 
> Are there ways just to fire off PostgreSQL queries and not get data into Python?
> 
> Regards,
> 
> David

What is your use case for this? Normally when you do basic things like an UPDATE/DELETE, etc all you get back is a row count of how many records the statement updated/deleted. Normally SELECT is the only thing to send a bunch of data back to you, and well, why would you run selects if you don't care about the output?

Without knowing what you're doing it for, the only other option I could suggest might be to use EXPLAIN ANALYZE. That would still send back the EXPLAIN ANALYZE output. But it will actually run the query, and if the output would have been thousands/millions of rows, then the explain output is going to be a lot smaller.


More information about the Python-list mailing list