Help us shape the future of Go! Take the 2026 Go Developer Survey

duckdb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: Apache-2.0 Imports: 13 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 native Iceberg support

func NewEngine

func NewEngine(cat catalog.CatalogInterface) (*Engine, error)

NewEngine creates a new DuckDB engine instance with catalog-agnostic support

func NewEngineWithConfig

func NewEngineWithConfig(cat catalog.CatalogInterface, config *EngineConfig) (*Engine, error)

NewEngineWithConfig creates a new DuckDB engine with custom configuration

func (*Engine) ClearTableCache

func (e *Engine) ClearTableCache()

ClearTableCache clears any cached table information (no-op for this implementation)

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

func (*Engine) GetConfig added in v0.4.0

func (e *Engine) GetConfig() *EngineConfig

GetConfig returns the current engine configuration

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 for querying using DuckDB's native Iceberg support

type EngineConfig

type EngineConfig struct {
	MaxMemoryMB        int
	QueryTimeoutSec    int
	EnableQueryLog     bool
	EnableOptimization bool
	CacheSize          int
	IcebergCatalogName string // Name for the attached Iceberg catalog in DuckDB
	// Security settings
	EnableQueryValidation bool     // Enable SQL injection protection
	AllowedStatements     []string // Allowed SQL statement types (SELECT, SHOW, DESCRIBE, etc.)
	BlockedKeywords       []string // Blocked dangerous keywords
}

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
	BlockedQueries   int64 // Track blocked malicious queries
	// 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

type SecurityError added in v0.5.0

type SecurityError struct {
	Message string
	QueryID string
	Reason  string
}

SecurityError represents a security-related error

func (SecurityError) Error added in v0.5.0

func (e SecurityError) Error() string

Jump to

Keyboard shortcuts

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