Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
42768 Lượt xem

Hi Guys, while importing data from csv file through a customized function, i am getting this error,

current transaction is aborted commands ignored until end of transaction block

I know this is due to some DB operation occuring in a Transaction(where previous operation had some issue in same transaction)

so i can keep and exception to handle this.

But i would like to have a better way to handle this exception or is there any particular exception handler to handle this kind of Exception.

any help would be appreciated.

Ảnh đại diện
Huỷ bỏ

You should also try looking at the PostgreSQL logs to check what's causing the exception

Câu trả lời hay nhất

ODOO use Psycopg for PostgreSQL connection .
You can  place your code inside the try catch block and

  Use psycopg2.Error  or psycopg2. IntregrityError   for exception handling .

Hope this may help in your case.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
2163
1
thg 7 25
704
1
thg 8 25
1150
0
thg 5 25
1245
2
thg 4 25
3404