ducklake

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentHash

func ContentHash(tables []DuckLakeTable) string

ContentHash computes a stable hash of the introspected schema for version tracking.

func ContentHashFull

func ContentHashFull(tables []DuckLakeTable, views []DuckLakeView) string

ContentHashFull computes a stable hash including both tables and views.

func GenerateSchemaDocument

func GenerateSchemaDocument(tables []DuckLakeTable) *ast.SchemaDocument

GenerateSchemaDocument generates a GraphQL AST schema document from introspected tables.

func GenerateSchemaDocumentFull

func GenerateSchemaDocumentFull(tables []DuckLakeTable, views []DuckLakeView) *ast.SchemaDocument

GenerateSchemaDocumentFull generates a GraphQL AST schema document from tables and views.

func SchemaVersion

func SchemaVersion(ctx context.Context, pool *db.Pool, prefix string) (int, error)

SchemaVersion returns the current schema version from DuckLake metadata.

Types

type DuckLakeColumn

type DuckLakeColumn struct {
	Name       string
	Type       string
	IsNullable bool
	IsPK       bool
}

DuckLakeColumn represents a column discovered from DuckLake metadata.

type DuckLakeTable

type DuckLakeTable struct {
	SchemaName string
	TableName  string
	Columns    []DuckLakeColumn
}

DuckLakeTable represents a table discovered from DuckLake metadata.

func IntrospectSchema

func IntrospectSchema(ctx context.Context, pool *db.Pool, prefix string) ([]DuckLakeTable, error)

IntrospectSchema queries DuckLake metadata tables and returns table/column definitions. The prefix is the DuckDB catalog name (from ATTACH AS prefix).

func IntrospectSchemaFiltered

func IntrospectSchemaFiltered(ctx context.Context, pool *db.Pool, prefix string, filter *IntrospectFilter) ([]DuckLakeTable, error)

IntrospectSchemaFiltered queries DuckLake metadata tables and returns table/column definitions, optionally filtering by schema/table name regexps.

type DuckLakeView

type DuckLakeView struct {
	SchemaName string
	ViewName   string
	Columns    []DuckLakeColumn
}

DuckLakeView represents a view discovered from DuckLake metadata.

type IntrospectFilter

type IntrospectFilter struct {
	SchemaFilter *regexp.Regexp // If set, only schemas matching this regexp are included
	TableFilter  *regexp.Regexp // If set, only tables matching this regexp are included
}

IntrospectFilter holds optional regexp filters for schema/table names.

func NewIntrospectFilter

func NewIntrospectFilter(schemaFilter, tableFilter string) (*IntrospectFilter, error)

NewIntrospectFilter compiles schema/table filter regexps. Empty strings mean no filter.

func (*IntrospectFilter) Match

func (f *IntrospectFilter) Match(schemaName, tableName string) bool

Match returns true if the schema/table name passes the filters.

type IntrospectResult

type IntrospectResult struct {
	Tables []DuckLakeTable
	Views  []DuckLakeView
}

IntrospectResult holds the results of schema introspection.

func IntrospectAll

func IntrospectAll(ctx context.Context, pool *db.Pool, prefix string, filter *IntrospectFilter) (*IntrospectResult, error)

IntrospectAll queries DuckLake metadata tables and returns both tables and views.

type SchemaChanges

type SchemaChanges struct {
	// Added contains tables that were created after fromSnapshot.
	Added []DuckLakeTable
	// Dropped contains tables (name only) that were dropped after fromSnapshot.
	Dropped []DuckLakeTable
	// Modified contains tables whose columns changed after fromSnapshot.
	// Each entry has the full current column set for the table.
	Modified []DuckLakeTable
}

SchemaChanges describes tables that changed between two schema versions.

func IntrospectChanges

func IntrospectChanges(ctx context.Context, pool *db.Pool, prefix string, fromSnapshot int) (*SchemaChanges, error)

IntrospectChanges queries DuckLake metadata for schema changes between fromSnapshot and the current state. Only touches tables/columns with begin_snapshot > fromSnapshot or end_snapshot > fromSnapshot. This is O(changed) instead of O(all) compared to full IntrospectSchema + DiffSchemas.

type Source

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

func New

func New(ds types.DataSource, attached bool) (*Source, error)

func (*Source) Attach

func (s *Source) Attach(ctx context.Context, pool *db.Pool) error

func (*Source) CatalogSource

func (s *Source) CatalogSource(ctx context.Context, pool *db.Pool) (cs.Catalog, error)

CatalogSource implements the SelfDescriber interface. It introspects DuckLake metadata tables and generates a GraphQL catalog.

func (*Source) Definition

func (s *Source) Definition() types.DataSource

func (*Source) Detach

func (s *Source) Detach(ctx context.Context, pool *db.Pool) error

func (*Source) Engine

func (s *Source) Engine() engines.Engine

func (*Source) IsAttached

func (s *Source) IsAttached() bool

func (*Source) Name

func (s *Source) Name() string

func (*Source) ReadOnly

func (s *Source) ReadOnly() bool

Jump to

Keyboard shortcuts

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