Multiqueries with python/mysql -
i'm using mysqldb. provide way execute multiple select queries mysqli_multi_query does? if not, there python library allow that?
there executemany, that's not i'm looking for. i'm working sphinx , trying batch queries work.
i spent time dig in source code of mysqldb , answer yes can multiple queries it:
import mysqldb db = mysqldb.connect(user="username", db="dbname") cursor = db.cursor() batch_queries = ''' select * posts id=1; select * posts id=2; ''' cursor.execute(batch_queries) print cursor.fetchone() while cursor.nextset(): # iterate next result set if there print cursor.fetchone() cursor.close() tested in localhost. hope helps.
Comments
Post a Comment