GlareDB / glaredb

GlareDB: An analytics DBMS for distributed data
https://glaredb.com
GNU Affero General Public License v3.0
650 stars 38 forks source link

improve out of the box psycopg2 support #2273

Open tychoish opened 9 months ago

tychoish commented 9 months ago

Presently, when attempting to connect to glaredb over the postgres protocol with the psycopg2 python module, unless connection.autocommit = True, psycopg2 will attempt to wrap all cursor operations in a transaction, sending BEGIN TRANSACTION queries to glaredb. As a result, queries throw an exception and users see the PGRES_EMPTY_QUERY error. Setting autocommit to true, disables the "wrap in a transaction" behavior.

The solution to this is somewhat difficult. We could (and should) improve the error message so users know that they were sending a transaction when they didn't mean to. It is (probably) correct to error early when we see a transaction that we shouldn't.

Uncovered by the testing in #2258.

universalmind303 commented 8 months ago

related to https://github.com/GlareDB/glaredb/issues/2402

tychoish commented 8 months ago

@scsmithr and I discussed this today and we decided:

Some further carve outs.