0 Results Found



I am inserting JSON data into a MySQL database

I am parsing the JSON and then inserting it into a MySQL db using the python connector

We would like to show you a description here but the site won’t allow us. =VLOOKUP(10248, A1:B6, 2, FALSE) Result: #N/A. If no exact match is found, #N/A is returned. Approximate Match. Use TRUE to find an approximate match: =VLOOKUP(10248, A1:B6, 2, TRUE) Result: 'Apples' If no match is found, it returns the next smaller value which in this case is 'Apples'. VLOOKUP from Another Sheet.

Through trial, I can see the error is associated with this piece of code

I have inserted higher level details and am now searching the database to associate this lower level information with its parent. The only way to find this unique value is to search via the origin and destination coordinates with the time_stamp. I believe the logic is sound and by printing the leg_no immediately after this section, I can see values which appear at first inspection to be correct

However, when added to the rest of the code, it causes subsequent sections where more data is inserted using the cursor to fail with this error –

0 Results Found

The issue seems similar to MySQL Unread Result with Python

Is the query too complex and needs splitting or is there another issue?

If the query is indeed too complex, can anyone advise how best to split this?

EDIT As per @Gord’s help, Ive tried to dump any unread results

But, I still get

scratches head

EDIT 2 – when I print the ie.msg, I get –

Answers:

All that was required was for buffered to be set to true!

Answers:

I was able to recreate your issue. MySQL Connector/Python apparently doesn’t like it if you retrieve multiple rows and don’t fetch them all before closing the cursor or using it to retrieve some other stuff. For example

0 Results Found One

If you only expect (or care about) one row then you can put a LIMIT on your query

or you can use fetchall() to get rid of any unread results after you have finished working with the rows you retrieved.

0 Results Found Meaning

Tags: mysql, python, sql





Comments are closed.