@snapshot()
@skipIf((PSYCOPG2_VERSION < (2, 7)), 'SQL string composition not available in psycopg2<2.7')
def test_composed_query_encoding(self):
    'Checks whether execution of composed SQL string is traced'
    import logging
    logger = logging.getLogger()
    logger.level = logging.DEBUG
    query = SQL(' union all ').join([SQL("select 'one' as x"), SQL("select 'two' as x")])
    conn = psycopg2.connect(**POSTGRES_CONFIG)
    with conn.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')
Checks whether execution of composed SQL string is traced
@snapshot()
@skipIf((PSYCOPG2_VERSION < (2, 7)), 'SQL string composition not available in psycopg2<2.7')
def test_composed_query_encoding(self):
    
    import logging
    logger = logging.getLogger()
    logger.level = logging.DEBUG
    query = SQL(' union all ').join([SQL("select 'one' as x"), SQL("select 'two' as x")])
    conn = psycopg2.connect(**POSTGRES_CONFIG)
    with conn.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')