def create_engine(url, con=None, header=True, show_progress=5.0, clear_progress=True):
    '''Create a handler for query engine based on a URL.

    The following environment variables are used for default connection:

      TD_API_KEY     API key
      TD_API_SERVER  API server (default: api.treasuredata.com)
      HTTP_PROXY     HTTP proxy (optional)

    Parameters
    ----------
    url : string
        Engine descriptor in the form "type://apikey@host/database?params..."
        Use shorthand notation "type:database?params..." for the default connection.
    con : Connection, optional
        Handler returned by connect. If not given, default connection is used.
    header : string or boolean, default True
        Prepend comment strings, in the form "-- comment", as a header of queries.
        Set False to disable header.
    show_progress : double or boolean, default 5.0
        Number of seconds to wait before printing progress.
        Set False to disable progress entirely.
    clear_progress : boolean, default True
        If True, clear progress when query completed.

    Returns
    -------
    QueryEngine
    '''
    url = urlparse(url)
    engine_type = url.scheme if url.scheme else 'presto'
    if con is None:
        if url.netloc:
            # create connection
            apikey, host = url.netloc.split('@')
            con = Connection(apikey=apikey, endpoint="https://{0}/".format(host))
        else:
            # default connection
            con = Connection()
    database = url.path[1:] if url.path.startswith('/') else url.path
    params = {
        'type': engine_type,
    }
    params.update(parse_qsl(url.query))
    return QueryEngine(con, database, params,
                       header=header,
                       show_progress=show_progress,
                       clear_progress=clear_progress)
Create a handler for query engine based on a URL.

    The following environment variables are used for default connection:

      TD_API_KEY     API key
      TD_API_SERVER  API server (default: api.treasuredata.com)
      HTTP_PROXY     HTTP proxy (optional)

    Parameters
    ----------
    url : string
        Engine descriptor in the form "type://apikey@host/database?params..."
        Use shorthand notation "type:database?params..." for the default connection.
    con : Connection, optional
        Handler returned by connect. If not given, default connection is used.
    header : string or boolean, default True
        Prepend comment strings, in the form "-- comment", as a header of queries.
        Set False to disable header.
    show_progress : double or boolean, default 5.0
        Number of seconds to wait before printing progress.
        Set False to disable progress entirely.
    clear_progress : boolean, default True
        If True, clear progress when query completed.

    Returns
    -------
    QueryEngine