QAN doesn't display query from python script

Hello all,

For our business needs we realize some tasks with python scripts and we notice that several queries are not displayed in the QAN page inside PMM web interface.

After several tests we found a first hint but before here some details about the test environment :

  • OS : Ubuntu Server 22.04 LTS
  • Database server : MySQL community version 8.0.40
  • PMM server : 2.43.2 (docker version in another server under Ubuntu)
  • Python : 3.10.12
  • Connector : Python/Connector 9.1.0 provided by Oracle

Now we can reproduce the case

import mysql.connector
conn = mysql.connector.connect(host='127.0.0.1',user='test_user',password='test_password',database='test',port=3306)
cur = conn.cursor()
cur.execute("SELECT SLEEP(30)")
cur.fetchone()
cur.close()
conn.disconnect()

The query for this example is not the real business query but it’s easy to see it in QAN (this is a long query therefore QAN shows it as top query).
In this case there is no problem, the query is well displayed in QAN

Now a second example :

import mysql.connector
conn = mysql.connector.connect(host='127.0.0.1',user='test_user',password='test_password',database='test',port=3306)
cur = conn.cursor(prepared=True)
cur.execute("SELECT SLEEP(40)")
cur.fetchone()
cur.close()
conn.disconnect()

In this case Python code finishes without error but the query doesn’t appear in QAN. So it’s seems that the cursor option (prepared=True) has an impact.

From this point we are a little bit lost because we don’t know where to search.

Any help would be appreciated,
Thanks.

Hi, yes, currently prepared statements is missing part of QAN. it might appear with different name like EXEC PRST or something like that. We are researching the way to store this kind of queries without additional harm to DB server.

Hello @nurlan,

Thank you for your answer.
Do you know if you’re close to finding a solution ?