Results of 1 - 10 of about 29 for context (0.004 sec.)
- Startup & Shutdown 15630
- To use DuckDB, you must first initialize a duckdb_database handle using duckdb_open() . duckdb_open() takes as parameter the database file to read and write from. The special value NULL ( nullptr ) can be used to create an in-memory databas
...ckdb_connection connection ); void duckdb_disconnect ( duckdb_connection * connection ); void duckdb_connection_get_client_context ( duckdb_connection connection , duckdb_client_context * out_context ); void duckdb_connection_get_arrow_options ( duckdb_...connection connection , duckdb_arrow_options * out_arrow_options ); idx_t duckdb_client_context_get_connection_id ( duckdb_client_context context ); void duckdb_destroy_client_context ( duckdb_client_context * context...sconnect ( duckdb_connection * connection ); Parameters connection : The connection to close. duckdb_connection_get_client_context Retrieves the client context of the connection. Syntax void duckdb_connection_get_client_context ( duckdb_connection conne... - https://man.mtool.work/duckdb/2.0/clients/c/connect.html
- Complete API 10376
- This page contains the reference for DuckDB's C API. The reference contains several deprecation notices. These concern methods whose long-term availability is not guaranteed as they may be removed in the future. That said, DuckDB's develope
...ckdb_connection connection ); void duckdb_disconnect ( duckdb_connection * connection ); void duckdb_connection_get_client_context ( duckdb_connection connection , duckdb_client_context * out_context ); void duckdb_connection_get_arrow_options ( duckdb_...connection connection , duckdb_arrow_options * out_arrow_options ); idx_t duckdb_client_context_get_connection_id ( duckdb_client_context context ); void duckdb_destroy_client_context ( duckdb_client_context * context...info ); void * duckdb_scalar_function_get_bind_data ( duckdb_function_info info ); void duckdb_scalar_function_get_client_context ( duckdb_bind_info info , duckdb_client_context * out_context ); void duckdb_scalar_function_set_error ( duckdb_function_i... - https://man.mtool.work/duckdb/2.0/clients/c/api.html
- Table Functions 9871
- The table function API can be used to define a table function that can then be called from within DuckDB in the FROM clause of a query. API Reference Overview duckdb_table_function duckdb_create_table_function (); void duckdb_destroy_table_
...); Table Function Bind void * duckdb_bind_get_extra_info ( duckdb_bind_info info ); void duckdb_table_function_get_client_context ( duckdb_bind_info info , duckdb_client_context * out_context ); void duckdb_bind_add_result_column ( duckdb_bind_info inf...( duckdb_bind_info info ); Parameters info : The info object Return Value The extra info duckdb_table_function_get_client_context Retrieves the client context of the bind info of a table function. Syntax void duckdb_table_function_get_client_context (...duckdb_bind_info info , duckdb_client_context * out_context ); Parameters info : The bind info object of the table function. out_context : The client context of the bin... - https://man.mtool.work/duckdb/2.0/clients/c/table_functions.html
- Profile and Monitor 9071
- 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
...result with duckdb.GetProfilingInfo() : db, err := sql.Open("duckdb", "") check(err) defer db.Close() conn, err := db.Conn(context.Background()) check(err) defer conn.Close() // Do not print profiling output to stdout after each query. _, err = conn.Exe...cContext(context.Background(), `SET enable_profiling = 'no_output'`) check(err) // Run the query to profile. res, err := conn.Query...Context(context.Background(), `SELECT 42`) check(err) res.Close() // Retrieve the metrics collected for that query. info, err := duckdb.Ge... - https://man.mtool.work/duckdb/2.0/clients/go/profiling.html
- Connect 8631
- 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
...is where boot queries belong: connector, err := duckdb.NewConnector("/path/to/foo.db?threads=4", func(execer driver.ExecerContext) error { bootQueries := []string{ "SET schema = 'main'", "SET search_path = 'main'", } for _, query := range bootQueries {...if _, err := execer.ExecContext(context.Background(), query, nil); err != nil { return err } } return nil }) if err != nil { log.Fatal(err) } defer connec...th db.Conn() , which returns a *sql.Conn that is not shared with other goroutines until it is closed: conn, err := db.Conn(context.Background()) if err != nil { log.Fatal(err) } defer conn.Close() The client also exposes two helpers that take a *sql.Con... - https://man.mtool.work/duckdb/2.0/clients/go/connecting.html
- Import Data 8631
- 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
...uckdb.NewConnector("test.db", nil) if err != nil { log.Fatal(err) } defer connector.Close() conn, err := connector.Connect(context.Background()) if err != nil { log.Fatal(err) } defer conn.Close() // The table must already exist. appender, err := duckdb...reates the table through a *sql.DB opened on the same connector, appends a row, then reads it back: package main import ( "context" "database/sql" "log" "github.com/duckdb/duckdb-go/v2" ) func main() { c, err := duckdb.NewConnector("", nil) if err != ni...l { log.Fatal(err) } defer c.Close() con, err := c.Connect(context.Background()) if err != nil { log.Fatal(err) } defer con.Close() db := sql.OpenDB(c) defer db.Close() if _, err := db.Exec... - https://man.mtool.work/duckdb/2.0/clients/go/data_import.html
- Handle Results 8631
- 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
...d 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...rr := duckdb.NewConnector("", nil) if err != nil { log.Fatal(err) } defer connector.Close() conn, err := connector.Connect(context.Background()) if err != nil { log.Fatal(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... - https://man.mtool.work/duckdb/2.0/clients/go/result_handling.html
- ADBC Client 8321
- Installation To use the DuckDB ADBC client, download the libduckdb archive for your platform and follow the instructions below . For Python, install the duckdb package instead, as described in the Python section . The latest stable version
...uses an in-memory DuckDB database to modify in-memory Arrow RecordBatches via SQL queries: package main import ( "bytes" "context" "fmt" "io" "github.com/apache/arrow-adbc/go/adbc" "github.com/apache/arrow-adbc/go/adbc/drivermgr" "github.com/apache/arr...s.Float64}}, nil) return array.NewRecord(schema, []arrow.Array{col}, int64(col.Len())) } type DuckDBSQLRunner struct { ctx context.Context conn adbc.Connection db adbc.Database } func NewDuckDBSQLRunner(ctx context.Context) (*DuckDBSQLRunner, error) { v...nn.Close() r.db.Close() } func main() { rec := _makeSampleArrowRecord() fmt.Println(rec) runner, err := NewDuckDBSQLRunner(context.Background()) if err != nil { panic(err) } defer runner.Close() resultRecords, err := runner.RunSQLOnRecord(rec, "SELECT c... - https://man.mtool.work/duckdb/2.0/clients/adbc.html
- Write User Defined Functions 8059
- 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
...0].(string))), nil }, } } func main() { db, err := sql.Open("duckdb", "") check(err) defer db.Close() conn, err := db.Conn(context.Background()) check(err) defer conn.Close() var udf *varcharLen check(duckdb.RegisterScalarUDF(conn, "my_length", udf)) va...gth", varcharUDF, listUDF)) For a callback that processes a whole data chunk at once rather than a row at a time, set ChunkContextExecutor in the executor instead of RowExecutor ; the scalar_udf example demonstrates both. Table Functions A table functio...ableSize), Exact: true} } func main() { db, err := sql.Open("duckdb", "") check(err) defer db.Close() conn, err := db.Conn(context.Background()) check(err) defer conn.Close() t, err := duckdb.NewTypeInfo(duckdb.TYPE_BIGINT) check(err) udf := duckdb.RowT... - https://man.mtool.work/duckdb/2.0/clients/go/functions.html
- Run Queries 8059
- 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
...text , QueryRow , and QueryRowContext run statements that return rows and hand back a *sql.Rows (or a single *sql.Row ) to scan into Go values. The Context vari...ants take a context.Context as their first argument, which is the recommended form because it lets a query be cancelled or time out. The secti...ansactions, and scanning results. For opening the database these run on, see Connect . Sending Statements Use Exec (or ExecContext ) for a statement that does not return rows, such as INSERT or UPDATE . It returns a sql.Result , from which RowsAffected(... - https://man.mtool.work/duckdb/2.0/clients/go/querying.html
DuckDB 2.0 Documentation / man.mtool.work