@skipIf((PSYCOPG2_VERSION < (2, 7)), 'SQL string composition not available in psycopg2<2.7')
def test_composed_query(self):
    'Checks whether execution of composed SQL string is traced'
    query = SQL(' union all ').join([SQL('select {} as x').format(Literal('one')), SQL('select {} as x').format(Literal('two'))])
    db = self._get_conn()
    with db.cursor() as cur:
        cur.execute(query=query)
        rows = cur.fetchall()
        assert (len(rows) == 2), rows
        assert (rows[0][0] == 'one')
        assert (rows[1][0] == 'two')
    assert_is_measured(self.get_root_span())
    self.assert_structure(dict(name='postgres.query', resource=query.as_string(db)))
Checks whether execution of composed SQL string is traced
@skipIf((PSYCOPG2_VERSION < (2, 7)), 'SQL string composition not available in psycopg2<2.7')
def test_composed_query(self):
    
    query = SQL(' union all ').join([SQL('select {} as x').format(Literal('one')), SQL('select {} as x').format(Literal('two'))])
    db = self._get_conn()
    with db.cursor() as cur:
        cur.execute(query=query)
        rows = cur.fetchall()
        assert (len(rows) == 2), rows
        assert (rows[0][0] == 'one')
        assert (rows[1][0] == 'two')
    assert_is_measured(self.get_root_span())
    self.assert_structure(dict(name='postgres.query', resource=query.as_string(db)))