Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a mysql thread id from sqlalchemy Session

I'm used to creating connections using MySQLdb directly so I'm not sure this is at all possible using sqlalchemy, but is there a way to get the mysql connection thread id from a mysql Session a la MySQLdb.connection.thread_id()? I've been digging through and can't seem to find a way to access it. I'm not creating a connection from the Engine directly, and would like to avoid doing so.

For reference this is a single-thread application, I just need to get the mysql thread id for other purposes.

like image 816
beans Avatar asked Dec 12 '25 10:12

beans


1 Answers

session.connection().connection.thread_id()

like image 105
beans Avatar answered Dec 14 '25 01:12

beans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!