async def METHOD_NAME(sql_query, additional_elements=None, **kwargs):
    """
    Generate a CSV representation of a query result.
    Parameters
    ----------
    sql_query : str
        SQL query to stream output of
    additional_elements : dict
        Additional columns elements to include along with the query result
    Yields
    ------
    bytes
        Encoded csv lines
    """
    logger = current_app.flowapi_logger
    db_conn_pool = current_app.db_conn_pool
    logger.debug("Starting generator.", request_id=request.request_id)
    yield_header = True
    line = Line()
    writer = csv.writer(line)
    if additional_elements is None:
        additional_elements = {}
    async with db_conn_pool.acquire() as connection:
        # Configure asyncpg to encode/decode JSON values
        await connection.set_type_codec(
            "json", encoder=json.dumps, decoder=json.loads, schema="pg_catalog"
        )
        logger.debug("Connected.", request_id=request.request_id)
        async with connection.transaction():
            logger.debug("Got transaction.", request_id=request.request_id)
            logger.debug(f"Running {sql_query}", request_id=request.request_id)
            try:
                async for row in connection.cursor(sql_query):
                    if yield_header:
                        writer.writerow(chain(row.keys(), additional_elements.keys()))
                        yield line.read()
                        yield_header = False
                    writer.writerow(chain(row.values(), additional_elements.values()))
                    yield line.read()
                logger.debug("Finishing up.", request_id=request.request_id)
            except Exception as e:
                logger.error(e)