Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
1271 Weergaven

We have a dedicated Odoo.sh server.

It is configured to allow direct SQL access:

odoosh-sql-access init

 
We have been able to successfully connect but can't run any SQL, even a simple SELECT:

import psycopg2

connection = psycopg2.connect(database="db",
user="user",
password="password",
host="host",
port="5432",
sslmode="require")

cursor = connection.cursor() # ✅ this works ✅

cursor.execute("SELECT * FROM res_partner;") # ❌ this FAILS ❌

connection.close()



Avatar
Annuleer
Beste antwoord

Transactions are not supported with the direct access method.

You need to modify your psycopg2.connect call to add:

autocommit=True

Without this option, psycopg2 will implicitly start a transaction when calling execute which is not allowed by the server. 

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 22
3778
1
mrt. 22
3144
5
mrt. 20
17861
2
mei 17
10238
2
mrt. 15
7544