How to execute multi query from list at once time in Python?
<p>I'm using Tornado and Postgres, I have some queries (4 or 5) that I appended  to the list during program and now I want to execute all of them at once time! </p>

<p>when I tried to execute I got error that was: </p>

<pre><code>"DummyFuture does not support blocking for results" 
</code></pre>

<p>I executed this code: </p>

<pre><code> yield self.db.execute(''.join(queries)).result() 
</code></pre>

<p>"queries" is list of queries! </p>

<p>This is my connection pool and also Tonado setting:</p>

<pre><code>ioloop = IOLoop.instance()

application.db = momoko.Pool(
    dsn='dbname=xxx user=xxx password=xxxx host=x port=xxxx'
    size=xx,
    ioloop=ioloop,
)

# this is a one way to run ioloop in sync
future = application.db.connect()
ioloop.add_future(future, lambda f: ioloop.stop())
ioloop.start()
future.result()  # raises exception on connection error

http_server = HTTPServer(application)
http_server.listen(8888, 'localhost')
ioloop.start()
</code></pre>

<p>Don't call <code>result()</code> on a Future in a Tornado coroutine. Get results like this:</p>

<pre><code>@gen.coroutine
def method(self):
    result = yield self.db.execute('...')
</code></pre>

<p>Also, I don't think it will work to just join your queries as strings. The outcome won't be valid SQL. Instead:</p>

<pre><code>@gen.coroutine
def method(self):
    results = yield [self.db.execute(q) for q in queries]
</code></pre>

python postgresql tornado