简体   繁体   中英

How to change snowflake async query timeout in snowflake?

When I run an async query via snowflake python connector I get a result indicating the query will be aborted if it takes more than 300 seconds.

cursor_result = sf_conn.cursor().execute_async(
                  "select 1 as test_column", timeout=500)
'queryId':'01a00000-0404-bce3-0000-00013778eb6f'
'getResultUrl':'/queries/01a54712-0404-bce3-00c6-55013778eb6f/result'
'queryAbortsAfterSecs':300
'progressDesc':None

Passing timeout param doesn't seem to be helping and the value is still 300 seconds!

I want to know how to change this default behavior and to change the default value of 300 seconds?

Looking through the code here https://github.com/snowflakedb/snowflake-connector-python/blob/efeaeb15bdae7b7378b8a007bb9fe22e7f540669/src/snowflake/connector/cursor.py#L468-L470 , it looks like network timeout plays a role in deciding the query timeout.

    real_timeout = (
        timeout if timeout and timeout > 0 else self._connection.network_timeout
    )

    if real_timeout is not None:
        self._timebomb = Timer(real_timeout, self.__cancel_query, [query])
        self._timebomb.start()
        logger.debug("started timebomb in %ss", real_timeout)
    else:
        self._timebomb = None

What's your network connection timeout set to?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM