async def run_querystring(self, querystring: QueryString, in_pool: bool = True): query, query_args = querystring.compile_string( engine_type=self.engine_type) # If running inside a transaction: connection = self.transaction_connection.get() if connection: return await connection.fetch(query, *query_args) elif in_pool and self.pool: return await self._run_in_pool(query, query_args) else: return await self._run_in_new_connection(query, query_args)
async def run_querystring(self, querystring: QueryString, in_pool: bool = False): """ Connection pools aren't currently supported - the argument is there for consistency with other engines. """ query, query_args = querystring.compile_string( engine_type=self.engine_type) # If running inside a transaction: connection = self.transaction_connection.get() if connection: return await self._run_in_existing_connection( connection=connection, query=query, args=query_args, query_type=querystring.query_type, ) return await self._run_in_new_connection( query=query, args=query_args, query_type=querystring.query_type)
def test_querystring_with_no_args(self): qs = QueryString("SELECT name FROM band") self.assertEqual(qs.compile_string(), ("SELECT name FROM band", []))