Procs
proc `$`(qresult: QueryResult): string {. ...raises: [ValueError, Exception, KeyError], tags: [ReadEnvEffect, RootEffect], forbids: [].}
-
Converts a query result to its string representation.
Provides a human-readable string representation of the query result Most used for debugging
proc chunkCount(qresult: QueryResult): int {.inline, ...deprecated: "This method is scheduled for removal in a future release", raises: [], tags: [], forbids: [].}
- Returns the number of chunks present in a the result object
proc columnCount(qresult: QueryResult): int {.inline, ...deprecated: "This method is scheduled for removal in a future release", raises: [], tags: [], forbids: [].}
- Returns the number of columns present in a the result object
proc df(qresult: QueryResult): DataFrame {. ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
-
Converts a query result to a DataFrame.
Creates a DataFrame object that provides a convinient way to plot the query result, mainly used for debugging
Warning: This materializes the entire result set in memory.
proc error(pqresult: PendingQueryResult): string {....raises: [], tags: [], forbids: [].}
-
Retrieves the error message from a pending query result.
If a pending query execution failed, this procedure returns the error message describing what went wrong during execution.
proc error(qresult: QueryResult): string {....raises: [], tags: [], forbids: [].}
-
Retrieves the error message from a query result.
If a query execution failed, this procedure returns the error message describing what went wrong during execution.
proc fetchAll(qresult: QueryResult): seq[Vector] {. ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
-
Fetches all data from a query result as column vectors. Warning: This materializes the entire result set in memory. Use with caution for large datasets.
Note: API is not yet finalized and may change in future versions
proc fetchAllNamed(qresult: QueryResult): OrderedTable[string, Vector] {. ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
-
Fetches all data from a query result as named column vectors. Example:
let data = qresult.fetchAllNamed() echo "User IDs: ", data["user_id"] echo "Names: ", data["name"]
Warning: This materializes the entire result set in memory. Use with caution for large datasets.
Note: API is not yet finalized and may change in future versions
proc fetchOne(qresult: QueryResult): seq[Value] {.inline, ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
- Fetches the first row from a query result. Note: API is not yet finalized and may change in future versions
proc fetchOneNamed(qresult: QueryResult): Table[string, Value] {. ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
- Fetches the first row from a query result as a named table. Note: API is not yet finalized and may change in future versions
proc isStreaming(qresult: QueryResult): bool {....raises: [], tags: [], forbids: [].}
-
Checks if a query result is in streaming mode.
Streaming mode allows processing of large result sets that don't fit in memory by fetching data in chunks rather than materializing the entire result set.
proc newColumn(idx: int; name: string; kind: DuckType): Column {....raises: [], tags: [], forbids: [].}
-
Creates a new Column with the specified index, name, and data type.
Columns represent the schema information for a single column in a result set, including its position, name, and data type.
Example:
let col = newColumn(0, "user_id", DuckType.Integer)
proc newPendingResult(statement: Statement): PendingQueryResult {. ...raises: [OperationError], tags: [], forbids: [].}
-
Executes the prepared statement with the given bound parameters, and returns a pending result.
The pending result represents an intermediate structure for a query that is not yet fully executed. The pending result can be used to incrementally execute a query, returning control to the client between tasks.
proc newPendingStreamingResult(statement: Statement): PendingQueryResult {. ...deprecated: "This method is scheduled for removal in a future release", raises: [OperationError], tags: [], forbids: [].}
-
Executes the prepared statement with the given bound parameters, and returns a pending result.
This pending result will create a streaming result when executed. The pending result represents an intermediate structure for a query that is not yet fully executed.
proc rowCount(qresult: QueryResult): int {.inline, ...deprecated: "This method is scheduled for removal in a future release", raises: [], tags: [], forbids: [].}
- Returns the number of rows present in a the result object
Iterators
iterator chunks(qresult: QueryResult): DataChunk {.inline, ...raises: [], tags: [], forbids: [].}
-
Iterates over data chunks in a query result.
The iterator fetches chunks sequentially, handling both streaming and materialized results. Each chunk contains a portion of the result set with all columns.
iterator columns(qresult: QueryResult): Column {....raises: [ValueError], tags: [], forbids: [].}
- Iterates over all columns in a query result.
iterator rows(qresult: QueryResult): seq[Value] {. ...raises: [ValueError, Exception, KeyError], tags: [RootEffect], forbids: [].}
-
Iterates over all rows in a query result.
Processes the result set row by row, yielding each row as a sequence of Values.