⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k
DuckDB 2.0 ドキュメント 全文検索
per page, with , order by , clip by
Results of 1 - 6 of about 6 for QueryContext (0.001 sec.)
Handle Results 12521
Overview DuckDB is columnar, and beyond reading a result set row by row through database/sql , the Go client can exchange whole results with Apache Arrow as a stream of record batches, and register an Arrow stream as a queryable view. Both ... record and schema types. Reading a Result as Arrow Wrap a raw DuckDB connection with duckdb.NewArrowFromConn() , then call QueryContext() to run a query and get back an array.RecordReader . Iterate it with Next() , reading one arrow.RecordBatch at a time, an ... atal(err) } defer conn.Close() ar, err := duckdb.NewArrowFromConn(conn) if err != nil { log.Fatal(err) } reader, err := ar.QueryContext(context.Background(), "SELECT * FROM generate_series(1, 10)") if err != nil { log.Fatal(err) } defer reader.Release() for ... ne record batch at a time. log.Printf("%d rows", record.NumRows()) } if err := reader.Err(); err != nil { log.Fatal(err) } QueryContext() accepts bound parameters as trailing arguments, the same as database/sql queries . Registering an Arrow Stream as a View ...
https://man.mtool.work/duckdb/2.0/clients/go/result_handling.html
Run Queries 10675
Overview Because the Go client implements database/sql , queries run through the standard methods: Exec and ExecContext send statements that do not return rows, such as INSERT or DDL, and report the number of affected rows. Query , QueryContext ... ts positional ( ? ) and numbered ( $1 , $2 ) placeholders; pass the values as trailing arguments in order: rows, err := db.QueryContext(ctx, ` SELECT name, age FROM users WHERE (name = ? OR name = ?) AND age > ?`, "macgyver", "marc", 30, ) For named placehol ... , 25)`); err != nil { tx.Rollback() log.Fatal(err) } if err := tx.Commit(); err != nil { log.Fatal(err) } Scanning Results QueryContext returns a *sql.Rows cursor. Advance it with Next() , read the current row's columns into pointers with Scan() , and always ... k Err() after the loop and close the cursor. Scan matches columns to the destination Go types by position: rows, err := db.QueryContext(ctx, `SELECT name, age FROM users WHERE age > ?`, 30) if err != nil { log.Fatal(err) } defer rows.Close() for rows.Next() ...
https://man.mtool.work/duckdb/2.0/clients/go/querying.html
Profile and Monitor 8042
Overview The Go client can observe query execution: it can retrieve per-operator profiling metrics after a query runs, and register a log storage that receives DuckDB's log messages. Both are described below. Profiling Profiling information ... ntext(context.Background(), `SET enable_profiling = 'no_output'`) check(err) // Run the query to profile. res, err := conn.QueryContext(context.Background(), `SELECT 42`) check(err) res.Close() // Retrieve the metrics collected for that query. info, err := d ...
https://man.mtool.work/duckdb/2.0/clients/go/profiling.html
Connect 7896
Overview The Go client works through the standard database/sql types: a *sql.DB is a pool of connections to a DuckDB database. This page covers opening in-memory and file-backed databases, passing DuckDB configuration options, running initi ... , _ := sql.Open("duckdb", "") defer db.Close() conn, _ := db.Conn(context.Background()) defer conn.Close() rows, _ := conn.QueryContext(context.Background(), "SELECT 42") defer rows.Close() // or drain the rows until Next() returns false connector, _ := duck ...
https://man.mtool.work/duckdb/2.0/clients/go/connecting.html
Import Data 7896
Overview The Go client offers two ways to load data into DuckDB in bulk: the high-performance Appender for inserting rows generated in Go, and reading directly from data files such as Parquet, CSV, and JSON. Both are described below. For in ... dled extensions , no extra installation is needed. Query a file in place with the matching table function: rows, err := db.QueryContext(ctx, `SELECT * FROM read_parquet('data.parquet')`) The same pattern reads CSV with read_csv() and JSON with read_json() . ...
https://man.mtool.work/duckdb/2.0/clients/go/data_import.html
Write User Defined Functions 7750
Overview The Go client can register user-defined functions written in Go: scalar functions that map input rows to a single output value, and table functions that produce a set of rows. It can also register a replacement scan that rewrites a ... duckdb.TypeInfo{t}}, BindArguments: bindTableUDF, } check(duckdb.RegisterTableUDF(conn, "increment", udf)) rows, err := db.QueryContext(context.Background(), `SELECT * FROM increment(100)`) check(err) defer rows.Close() } SELECT * FROM increment(100); For a ...
https://man.mtool.work/duckdb/2.0/clients/go/functions.html
PREV 1 NEXT
DuckDB 2.0 Documentation / man.mtool.work