N
N
No_name4512021-10-01 15:49:40
Oracle
No_name451, 2021-10-01 15:49:40

Why does cx_Oracle lose some data when querying the database?

I use cx_Oracle (8.2.0/8.0.1), I make a request, but some of the data is lost.

Algorithm:
1. From the jang service I make a connection to the Oracle database through the manager:

with cx_Oracle.connect(*connection_data(kod_mo)) as connection:
   cursor = connection.cursor()
   ...

2. I make a request:
2.1 Through the procedure:
...
cursor.callproc(some_procedure, [some_args])
...

2.1 SQL of the procedure itself:
...
cursor.execute(sql, {"some_args": some_args})
...

3. I extract data from the request:
...
cursor.fetch(all/one/many)
...


Returns conditional 250 rows (what is the procedure, what is the SQL query).
BUT if I make a call from the manager ( pl/sql developer ), then the request returns conditional 300 rows. It turns out that conditional 50 lines
were lost somewhere . Tested on different databases: I. 300 conditional lines: The situation is as described above ( 50 conditional lines are lost ). Moreover, certain lines do not consistently come, and not different ones with each new request. II. There were 10 conditional rows: What is the procedure that raw sql in cx_Oracle returned all rows, no loss (10 conditional rows out of 10) .




The connection to the databases was carried out through the same user -> the data should come the same .

The conclusion suggests itself:
1. cx_Oracle can not cope with the load (which seems unlikely to me);
2. Something is wrong with DB I, where there are 300 conditional rows.

Please advise what I am doing wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
No_name451, 2021-11-04
@No_name451

Found an error. It consisted in a large number of connections using janga to different databases at the start of the project, something like:

for key, value in dict_databases.items():
    DATABASES[key] = {
        "ENGINE": "django.db.backends.oracle",
        "NAME": key_key_key_...,
        ...

After deleting these lines and making a connection through the cx_Oracle pool , everything works as it should.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question