Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
1277 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Apr. 22
3779
1
März 22
3145
5
März 20
17865
2
Mai 17
10241
2
März 15
7547