使用 Denodo 驱动程序更改超时 jaydebeapi

changing timeout jaydebeapi with Denodo driver

我正在使用非常标准的语法连接到数据库。

这里如何更改默认超时值?

需要在驱动端设置还是在jdbc级别设置?

jaydebeapi 文档没有提及。

jaydebeapi 的来源-connection.py

https://community.denodo.com/kb/view/document/How%20to%20connect%20to%20Denodo%20from%20Python%20-%20a%20starter%20for%20Data%20Scientists?category=Northbound+Connections

   ## script name: jaydebeapi-connection.py

## Importing the main library used to connect to Denodo via JDBC
import jaydebeapi as dbdriver

## Importing the gethostname function from socket to
## put the hostname in the useragent variable
from socket import gethostname


# Connection parameters of the Denodo Server that we are connecting to
denodoserver_name = "denodoserver"

# This is the standard port for jdbc connections
denodoserver_jdbc_port = "9999"

denodoserver_database = "distributed_tpcds"

denodoserver_uid = "tpcds_usr"

denodoserver_pwd = "tpcds_usr"

denododriver_path = "/opt/denodo/8.0/tools/client-drivers/jdbc/denodo-vdp-jdbcdriver.jar"

## Create the useragent as the concatenation of
## the client hostname and the python library used
client_hostname = gethostname()
useragent = "%s-%s" % (dbdriver.__name__,client_hostname)

## Creating a variable with the connection uri. We add here the UserAgent
## so the query can be better identified on the server. To append parameters you
## can use the syntax <param_name>=<param_value> and separate them with '&'.
## The full list of accepted parameters is available here
## https://community.denodo.com/docs/html/browse/7.0/vdp/developer/
##        access_through_jdbc/parameters_of_the_jdbc_connection_url/
##        parameters_of_the_jdbc_connection_url
conn_uri = "jdbc:vdb://%s:%s/%s?userAgent=%s" % (denodoserver_name,
                                                            denodoserver_jdbc_port,                                                                         denodoserver_database,
                                                            useragent)
                                                                                           
cnxn = dbdriver.connect( "com.denodo.vdp.jdbc.Driver",
                              conn_uri,
                              driver_args = {"user": denodoserver_uid,
                                             "password": denodoserver_pwd},
                              jars = denododriver_path
                              )

## Query to be sent to the Denodo VDP Server
query = "select * from bv_store_returns"

## Define a cursor and execute the results
cur = cnxn.cursor()
cur.execute(query)

## Finally fetch the results. `results` is a list of tuples,
## If you don't want to load all the records in memory,
## you may want to use cur.fetchone() or cur.fetchmany()
results = cur.fetchall()

# >> len(results)
# 287514
# >> type(results)
# list
# >> type(results[0])
# tuple
# >> results[0]
# (2451794, 40096, 1, 7157, 910283, 6421, 37312, ...)

您实际上可以通过更改 JDBC 驱动程序配置(添加驱动程序参数 'queryTimeout')或通过查询本身的 CONTEXT 子句 (https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/queries_select_statement/context_clause/context_clause)