duckdb

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine provides SQL query capabilities using DuckDB with Arrow integration

func NewEngine

func NewEngine(catalog *sqlite.Catalog) (*Engine, error)

NewEngine creates a new DuckDB engine instance with enterprise-grade features

func NewEngineWithConfig

func NewEngineWithConfig(catalog *sqlite.Catalog, config *EngineConfig) (*Engine, error)

NewEngineWithConfig creates a new DuckDB engine with custom configuration

func (*Engine) ClearTableCache

func (e *Engine) ClearTableCache()

ClearTableCache clears all cached table registrations

func (*Engine) Close

func (e *Engine) Close() error

Close closes the DuckDB connection and cleans up resources

func (*Engine) DescribeTable

func (e *Engine) DescribeTable(ctx context.Context, tableName string) (*QueryResult, error)

DescribeTable returns schema information for a table

func (*Engine) ExecuteQuery

func (e *Engine) ExecuteQuery(ctx context.Context, query string) (*QueryResult, error)

ExecuteQuery executes a SQL query and returns the results with enterprise-grade features

func (*Engine) GetMetrics

func (e *Engine) GetMetrics() *EngineMetrics

GetMetrics returns current engine performance metrics

func (*Engine) ListTables

func (e *Engine) ListTables(ctx context.Context) ([]string, error)

ListTables returns a list of all registered tables

func (*Engine) RegisterTable

func (e *Engine) RegisterTable(ctx context.Context, identifier table.Identifier, icebergTable *table.Table) error

RegisterTable registers an Iceberg table as a DuckDB view for querying with caching

func (*Engine) UnregisterTable

func (e *Engine) UnregisterTable(identifier table.Identifier) error

UnregisterTable removes a table from the cache and DuckDB

type EngineConfig

type EngineConfig struct {
	MaxMemoryMB        int
	QueryTimeoutSec    int
	EnableQueryLog     bool
	EnableOptimization bool
	CacheSize          int
}

EngineConfig holds configuration options for the engine

func DefaultEngineConfig

func DefaultEngineConfig() *EngineConfig

DefaultEngineConfig returns a default configuration for the engine

type EngineMetrics

type EngineMetrics struct {
	QueriesExecuted  int64
	TablesRegistered int64
	CacheHits        int64
	CacheMisses      int64
	TotalQueryTime   time.Duration
	ErrorCount       int64
	// contains filtered or unexported fields
}

EngineMetrics tracks engine performance metrics

type QueryResult

type QueryResult struct {
	Columns  []string
	Rows     [][]interface{}
	Schema   *arrow.Schema
	Table    arrow.Table
	RowCount int64
	Duration time.Duration
	QueryID  string
}

QueryResult represents the result of a SQL query

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL