Class: Connection

Connection(database, numThreads)

new Connection(database, numThreads)

Initialize a new Connection object. Note that the initialization is done lazily, so the connection is not initialized until the first query is executed. To initialize the connection immediately, call the `init()` function on the returned object.
Parameters:
Name Type Default Description
database kuzu.Database the database object to connect to.
numThreads Number null the maximum number of threads to use for query execution.
Source:

Methods

(async) close()

Close the connection.
Source:

(async) execute(preparedStatement, params) → {kuzu.QueryResult}

Execute a prepared statement.
Parameters:
Name Type Description
preparedStatement kuzu.sync.PreparedStatement the prepared statement to execute.
params Object a plain object mapping parameter names to values.
Source:
Returns:
the query result.
Type
kuzu.QueryResult

(async) getMaxNumThreadForExec() → {Number}

Get the maximum number of threads to use for query execution.
Source:
Returns:
the maximum number of threads to use for query execution.
Type
Number

(async) init()

Initialize the connection. Calling this function is optional, as the connection is initialized automatically when the first query is executed.
Source:

(async) prepare(statement) → {kuzu.PreparedStatement}

Prepare a statement for execution.
Parameters:
Name Type Description
statement String the statement to prepare.
Source:
Returns:
the prepared statement.
Type
kuzu.PreparedStatement

(async) query(statement) → {kuzu.QueryResult}

Execute a query.
Parameters:
Name Type Description
statement String the statement to execute.
Source:
Returns:
the query result.
Type
kuzu.QueryResult

(async) setMaxNumThreadForExec(numThreads)

Set the maximum number of threads to use for query execution.
Parameters:
Name Type Description
numThreads Number the maximum number of threads to use for query execution.
Source:

(async) setQueryTimeout(timeout)

Set the query timeout in milliseconds.
Parameters:
Name Type Description
timeout Number the query timeout in milliseconds.
Source: