0

How would I execute a query for best performance with PyMYSQL, since it's an external connection (between Denmark and Germany) there could be "code-blocking"s?

Isn't there a method called threading or something like that?

Basic query:

import pymysql
conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='mysql')
cur = conn.cursor()

cur.execute("SELECT names ,ages FROM id")

So to summerize: What is the best way of doing this?

If it's not possible with PyMYSQL, you're more than welcome to link other libaries where it's do-able.

4

1 回答 1

0

如果您使用的 postgreSQL 也支持 Sqlalchemy,请尝试aiopg 。

在内部使用asyncio使其异步。无需去穿线。

如果您使用的不是 postgreSQL,请尝试将 Asyncio 与 Sqlalchmey 一起使用。

于 2015-03-10T15:43:27.480 回答