Documentation
¶
Overview ¶
Package driverbase provides a framework for implementing ADBC drivers in Go. It intends to reduce boilerplate for common functionality and managing state transitions.
Index ¶
- Constants
- Variables
- func BuildGetObjectsRecordReader(mem memory.Allocator, in <-chan GetObjectsInfo, errCh <-chan error) (array.RecordReader, error)
- func BuildGetStatisticNamesReader(alloc memory.Allocator, statistics []StatisticNameKey) (array.RecordReader, error)
- func BuildGetStatisticsReader(alloc memory.Allocator, catalogOrder []string, schemaOrder map[string][]string, ...) (array.RecordReader, error)
- func DebugAssert(cond bool, msg any)
- func EmptyGetStatisticsReader() (array.RecordReader, error)
- func EndSpan(span trace.Span, err error, options ...trace.SpanEndOption)
- func NewRotatingFileWriter(options ...rotatingFileWriterOption) (*rotatingFileWriterImpl, error)
- func NewStatement(impl StatementImpl) adbc.StatementWithContext
- func NullInt16ToPtr(i sql.NullInt16) *int16
- func NullInt32ToPtr(i sql.NullInt32) *int32
- func NullStringToPtr(s sql.NullString) *string
- func Nullable[T any](val T) *T
- func PatternToNamedArg(name string, pattern *string) sql.NamedArg
- func PatternToRegexp(pattern *string) (*regexp.Regexp, error)
- func RequiredList[T any](vals []T) requiredList[T]
- func SetOTelDriverInfoAttributes(driverInfo *DriverInfo, span trace.Span)
- func StartSpan(ctx context.Context, spanName string, tracing adbc.OTelTracing, ...) (context.Context, trace.Span)
- func ToPtr[T any](i T) *T
- func ValueOrZero[T any](val *T) T
- func WithFileCountMax(fileCountMax int) rotatingFileWriterOption
- func WithFileSizeMaxKb(fileSizeMaxKb int64) rotatingFileWriterOption
- func WithLogNamePrefix(logNamePrefix string) rotatingFileWriterOption
- func WithShared[T, R any](sh *Shared[T], closure func(*T) (R, error)) (R, error)
- func WithTracingFolderPath(tracingFolderPath string) rotatingFileWriterOption
- type AutocommitSetter
- type BaseRecordReader
- func (rr *BaseRecordReader) Close()
- func (rr *BaseRecordReader) Err() error
- func (rr *BaseRecordReader) Init(ctx context.Context, alloc memory.Allocator, logger *slog.Logger, ...) (err error)
- func (rr *BaseRecordReader) Next() bool
- func (rr *BaseRecordReader) Record() arrow.RecordBatch
- func (rr *BaseRecordReader) RecordBatch() arrow.RecordBatch
- func (rr *BaseRecordReader) Release()
- func (rr *BaseRecordReader) Retain()
- func (rr *BaseRecordReader) Schema() *arrow.Schema
- type BaseRecordReaderOptions
- type BufferBulkIngestSink
- type BulkIngestFileImpl
- type BulkIngestImpl
- type BulkIngestInitFinalizeImpl
- type BulkIngestManager
- type BulkIngestOptions
- type BulkIngestPendingCopy
- type BulkIngestPendingUpload
- type BulkIngestSink
- type BulkIngestTableExistsBehavior
- type BulkIngestTableMissingBehavior
- type BulkIngestTransformImpl
- type ColumnInfo
- type Connection
- type ConnectionBuilder
- func (b *ConnectionBuilder) Connection() Connection
- func (b *ConnectionBuilder) WithAutocommitSetter(helper AutocommitSetter) *ConnectionBuilder
- func (b *ConnectionBuilder) WithConcurrency(concurrency int) *ConnectionBuilder
- func (b *ConnectionBuilder) WithCurrentNamespacer(helper CurrentNamespacer) *ConnectionBuilder
- func (b *ConnectionBuilder) WithDbObjectsEnumerator(helper DbObjectsEnumerator) *ConnectionBuilder
- func (b *ConnectionBuilder) WithDbObjectsEnumeratorFactory(helper DbObjectsEnumeratorFactory) *ConnectionBuilder
- func (b *ConnectionBuilder) WithDriverInfoPreparer(helper DriverInfoPreparer) *ConnectionBuilder
- func (b *ConnectionBuilder) WithTableTypeLister(helper TableTypeLister) *ConnectionBuilder
- type ConnectionImpl
- type ConnectionImplBase
- func (base *ConnectionImplBase) Base() *ConnectionImplBase
- func (base *ConnectionImplBase) Close(ctx context.Context) error
- func (base *ConnectionImplBase) Commit(ctx context.Context) error
- func (base *ConnectionImplBase) GetInfo(ctx context.Context, infoCodes []adbc.InfoCode) (reader array.RecordReader, err error)
- func (cnxn *ConnectionImplBase) GetInitialSpanAttributes() []attribute.KeyValue
- func (base *ConnectionImplBase) GetObjects(ctx context.Context, depth adbc.ObjectDepth, catalog *string, dbSchema *string, ...) (array.RecordReader, error)
- func (base *ConnectionImplBase) GetOption(ctx context.Context, key string) (string, error)
- func (base *ConnectionImplBase) GetOptionBytes(ctx context.Context, key string) ([]byte, error)
- func (base *ConnectionImplBase) GetOptionDouble(ctx context.Context, key string) (float64, error)
- func (base *ConnectionImplBase) GetOptionInt(ctx context.Context, key string) (int64, error)
- func (base *ConnectionImplBase) GetTableSchema(ctx context.Context, catalog *string, dbSchema *string, tableName string) (*arrow.Schema, error)
- func (base *ConnectionImplBase) GetTableTypes(context.Context) (array.RecordReader, error)
- func (cnxn *ConnectionImplBase) GetTraceParent() string
- func (base *ConnectionImplBase) NewStatement(ctx context.Context) (adbc.StatementWithContext, error)
- func (base *ConnectionImplBase) ReadPartition(ctx context.Context, serializedPartition []byte) (array.RecordReader, error)
- func (base *ConnectionImplBase) Rollback(context.Context) error
- func (base *ConnectionImplBase) SetOption(ctx context.Context, key string, val string) error
- func (base *ConnectionImplBase) SetOptionBytes(ctx context.Context, key string, val []byte) error
- func (base *ConnectionImplBase) SetOptionDouble(ctx context.Context, key string, val float64) error
- func (base *ConnectionImplBase) SetOptionInt(ctx context.Context, key string, val int64) error
- func (cnxn *ConnectionImplBase) SetTraceParent(traceParent string)
- func (cnxn *ConnectionImplBase) StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- type ConstraintColumnUsage
- type ConstraintInfo
- type CurrentNamespacer
- type DBSchemaInfo
- type DataDependentMetadata
- type Database
- type DatabaseImpl
- type DatabaseImplBase
- func (base *DatabaseImplBase) Base() *DatabaseImplBase
- func (base *DatabaseImplBase) Close(ctx context.Context) (err error)
- func (d *DatabaseImplBase) GetInitialSpanAttributes() []attribute.KeyValue
- func (base *DatabaseImplBase) GetOption(ctx context.Context, key string) (string, error)
- func (base *DatabaseImplBase) GetOptionBytes(ctx context.Context, key string) ([]byte, error)
- func (base *DatabaseImplBase) GetOptionDouble(ctx context.Context, key string) (float64, error)
- func (base *DatabaseImplBase) GetOptionInt(ctx context.Context, key string) (int64, error)
- func (d *DatabaseImplBase) GetTraceParent() (traceParent string)
- func (base *DatabaseImplBase) InitTracing(ctx context.Context, driverName string, driverVersion string) (err error)
- func (base *DatabaseImplBase) Open(ctx context.Context) (adbc.ConnectionWithContext, error)
- func (base *DatabaseImplBase) SetOption(ctx context.Context, key string, val string) error
- func (base *DatabaseImplBase) SetOptionBytes(ctx context.Context, key string, val []byte) error
- func (base *DatabaseImplBase) SetOptionDouble(ctx context.Context, key string, val float64) error
- func (base *DatabaseImplBase) SetOptionInt(ctx context.Context, key string, val int64) error
- func (base *DatabaseImplBase) SetOptions(ctx context.Context, options map[string]string) error
- func (d *DatabaseImplBase) SetTraceParent(traceParent string)
- func (d *DatabaseImplBase) StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- type DbObjectsEnumerator
- type DbObjectsEnumeratorFactory
- type Driver
- type DriverImpl
- type DriverImplBase
- type DriverInfo
- func (di *DriverInfo) GetInfoForInfoCode(code adbc.InfoCode) (any, bool)
- func (di *DriverInfo) GetName() string
- func (di *DriverInfo) InfoSupportedCodes() []adbc.InfoCode
- func (di *DriverInfo) MustRegister(codes map[adbc.InfoCode]any)
- func (di *DriverInfo) RegisterInfoCode(code adbc.InfoCode, value any) error
- type DriverInfoPreparer
- type DriverWithContext
- type ErrorHelper
- func (helper *ErrorHelper) AlreadyExists(message string, format ...any) error
- func (helper *ErrorHelper) Cancelled(message string, format ...any) error
- func (helper *ErrorHelper) Errorf(code adbc.Status, message string, format ...any) error
- func (helper *ErrorHelper) IO(message string, format ...any) error
- func (helper *ErrorHelper) Integrity(message string, format ...any) error
- func (helper *ErrorHelper) Internal(message string, format ...any) error
- func (helper *ErrorHelper) InvalidArgument(message string, format ...any) error
- func (helper *ErrorHelper) InvalidData(message string, format ...any) error
- func (helper *ErrorHelper) InvalidState(message string, format ...any) error
- func (helper *ErrorHelper) NotFound(message string, format ...any) error
- func (helper *ErrorHelper) NotImplemented(message string, format ...any) error
- func (helper *ErrorHelper) Timeout(message string, format ...any) error
- func (helper *ErrorHelper) Unauthenticated(message string, format ...any) error
- func (helper *ErrorHelper) Unauthorized(message string, format ...any) error
- func (helper *ErrorHelper) Unknown(message string, format ...any) error
- func (helper *ErrorHelper) WrapAlreadyExists(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapCancelled(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapIO(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapIntegrity(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapInternal(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapInvalidArgument(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapInvalidData(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapInvalidState(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapNotFound(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapNotImplemented(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapTimeout(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapUnauthenticated(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapUnauthorized(err error, format string, args ...any) error
- func (helper *ErrorHelper) WrapUnknown(err error, format string, args ...any) error
- type ErrorInspector
- type GetObjectsInfo
- type ParquetIngestImpl
- type RecordReaderImpl
- type Shared
- type SharedHandle
- type Statement
- type StatementImpl
- type StatementImplBase
- func (st *StatementImplBase) Base() *StatementImplBase
- func (st *StatementImplBase) Bind(ctx context.Context, values arrow.RecordBatch) error
- func (st *StatementImplBase) BindStream(ctx context.Context, stream array.RecordReader) error
- func (st *StatementImplBase) Close(ctx context.Context) error
- func (st *StatementImplBase) ExecutePartitions(ctx context.Context) (*arrow.Schema, adbc.Partitions, int64, error)
- func (st *StatementImplBase) ExecuteQuery(ctx context.Context) (array.RecordReader, int64, error)
- func (st *StatementImplBase) ExecuteSchema(context.Context) (*arrow.Schema, error)
- func (st *StatementImplBase) ExecuteUpdate(ctx context.Context) (int64, error)
- func (st *StatementImplBase) GetInitialSpanAttributes() []attribute.KeyValue
- func (st *StatementImplBase) GetOption(ctx context.Context, key string) (string, error)
- func (st *StatementImplBase) GetOptionBytes(ctx context.Context, key string) ([]byte, error)
- func (st *StatementImplBase) GetOptionDouble(ctx context.Context, key string) (float64, error)
- func (st *StatementImplBase) GetOptionInt(ctx context.Context, key string) (int64, error)
- func (st *StatementImplBase) GetParameterSchema(ctx context.Context) (*arrow.Schema, error)
- func (st *StatementImplBase) GetTraceParent() string
- func (st *StatementImplBase) Prepare(ctx context.Context) error
- func (st *StatementImplBase) SetOption(ctx context.Context, key, value string) error
- func (st *StatementImplBase) SetOptionBytes(ctx context.Context, key string, value []byte) error
- func (st *StatementImplBase) SetOptionDouble(ctx context.Context, key string, value float64) error
- func (st *StatementImplBase) SetOptionInt(ctx context.Context, key string, value int64) error
- func (st *StatementImplBase) SetSqlQuery(ctx context.Context, query string) error
- func (st *StatementImplBase) SetSubstraitPlan(ctx context.Context, plan []byte) error
- func (st *StatementImplBase) SetTraceParent(traceParent string)
- func (st *StatementImplBase) StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- type Statistic
- func NewBinaryStat(table string, column *string, key int16, value []byte, approx bool) Statistic
- func NewFloat64Stat(table string, column *string, key int16, value float64, approx bool) Statistic
- func NewInt64Stat(table string, column *string, key int16, value int64, approx bool) Statistic
- func NewUint64Stat(table string, column *string, key int16, value uint64, approx bool) Statistic
- type StatisticNameKey
- type SynchronousCancel
- type TableInfo
- type TableTypeLister
- type WriterProps
- type XdbcDataType
Constants ¶
const ( // OptionKeyIngestBatchSize controls rows per INSERT during batched bulk ingest // Value of 0 means driver default applies. OptionKeyIngestBatchSize = "adbc.statement.ingest.batch_size" // OptionKeyIngestMaxQuerySizeBytes controls maximum SQL query size in bytes for batched bulk ingest // When set, the batch size is calculated to keep the generated INSERT query under this limit. // Value of 0 means driver default applies. OptionKeyIngestMaxQuerySizeBytes = "adbc.statement.ingest.max_query_size_bytes" )
const ( ConnectionMessageOptionUnknown = "Unknown connection option" ConnectionMessageOptionUnsupported = "Unsupported connection option" ConnectionMessageCannotCommit = "Cannot commit when autocommit is enabled" ConnectionMessageCannotRollback = "Cannot rollback when autocommit is enabled" ConnectionMessageTraceParentIncorrectFormat = "Incorrect or unsupported trace parent format" )
const ( TraceExporterNone traceExporterType = iota TraceExporterOtlp TraceExporterConsole TraceExporterAdbcFile )
const ( DatabaseMessageOptionUnknown = "Unknown database option" DatabaseMessageOtelTracesExporterOptionUnknown = "Unknown " + otelTracesExporter + " option" DatabaseMessageNoOtelTracesExporters = "No trace exporters added" )
const ( UnknownVersion = "(unknown or development build)" DefaultInfoDriverADBCVersion = adbc.AdbcVersion1_1_0 )
const ( Check = "CHECK" ForeignKey = "FOREIGN KEY" PrimaryKey = "PRIMARY KEY" Unique = "UNIQUE" )
Constants for names of constraint types
const ( COLUMN_NAME = "COLUMN_NAME" ORDINAL_POSITION = "ORDINAL_POSITION" REMARKS = "REMARKS" XDBC_DATA_TYPE = "XDBC_DATA_TYPE" XDBC_TYPE_NAME = "XDBC_TYPE_NAME" XDBC_COLUMN_SIZE = "XDBC_COLUMN_SIZE" XDBC_DECIMAL_DIGITS = "XDBC_DECIMAL_DIGITS" XDBC_NUM_PREC_RADIX = "XDBC_NUM_PREC_RADIX" XDBC_NULLABLE = "XDBC_NULLABLE" XDBC_COLUMN_DEF = "XDBC_COLUMN_DEF" XDBC_SQL_DATA_TYPE = "XDBC_SQL_DATA_TYPE" XDBC_DATETIME_SUB = "XDBC_DATETIME_SUB" XDBC_CHAR_OCTET_LENGTH = "XDBC_CHAR_OCTET_LENGTH" XDBC_IS_NULLABLE = "XDBC_IS_NULLABLE" XDBC_SCOPE_CATALOG = "XDBC_SCOPE_CATALOG" XDBC_SCOPE_SCHEMA = "XDBC_SCOPE_SCHEMA" XDBC_SCOPE_TABLE = "XDBC_SCOPE_TABLE" XDBC_IS_AUTOINCREMENT = "XDBC_IS_AUTOINCREMENT" XDBC_IS_AUTOGENERATEDCOLUMN = "XDBC_IS_AUTOGENERATEDCOLUMN" )
const ( StatementMessageOptionUnknown = "Unknown statement option" StatementMessageOptionUnsupported = "Unsupported statement option" StatementMessageTraceParentIncorrectFormat = "Incorrect or unsupported trace parent format" )
const ( XdbcDataTypeArray int16 = 2003 XdbcDataTypeBigint int16 = -5 XdbcDataTypeBinary int16 = -2 XdbcDataTypeBit int16 = -7 XdbcDataTypeBlob int16 = 2004 XdbcDataTypeBoolean int16 = 16 XdbcDataTypeChar int16 = 1 XdbcDataTypeClob int16 = 2005 XdbcDataTypeDatalink int16 = 70 XdbcDataTypeDate int16 = 91 XdbcDataTypeDecimal int16 = 3 XdbcDataTypeDistinct int16 = 2001 XdbcDataTypeDouble int16 = 8 XdbcDataTypeFloat int16 = 6 XdbcDataTypeInteger int16 = 4 XdbcDataTypeJavaObject int16 = 2000 XdbcDataTypeLongNVarChar int16 = -16 XdbcDataTypeLongVarBinary int16 = -4 XdbcDataTypeLongVarChar int16 = -1 XdbcDataTypeNChar int16 = -15 XdbcDataTypeNClob int16 = 2011 XdbcDataTypeNull int16 = 0 XdbcDataTypeNumeric int16 = 2 XdbcDataTypeNVarChar int16 = -9 XdbcDataTypeOther int16 = 1111 XdbcDataTypeReal int16 = 7 XdbcDataTypeRef int16 = 2006 XdbcDataTypeRefCursor int16 = 2012 XdbcDataTypeRowId int16 = -8 XdbcDataTypeSmallint int16 = 5 XdbcDataTypeSqlXml int16 = 2009 XdbcDataTypeStruct int16 = 2002 XdbcDataTypeTime int16 = 92 XdbcDataTypeTimeWithTimezone int16 = 2013 XdbcDataTypeTimestamp int16 = 93 XdbcDataTypeTimestampWithTimezone int16 = 2014 XdbcDataTypeTinyint int16 = -6 XdbcDataTypeVarBinary int16 = -3 XdbcDataTypeVarChar int16 = 12 )
const ( XdbcColumnNoNulls int16 = 0 XdbcColumnNullable int16 = 1 XdbcColumnNullableUnknown int16 = 2 )
const UnionTypeBinary arrow.UnionTypeCode = 3
UnionTypeBinary is the dense union type code for binary statistic values.
const UnionTypeFloat64 arrow.UnionTypeCode = 2
UnionTypeFloat64 is the dense union type code for float64 statistic values.
const UnionTypeInt64 arrow.UnionTypeCode = 0
UnionTypeInt64 is the dense union type code for int64 statistic values.
const UnionTypeUint64 arrow.UnionTypeCode = 1
UnionTypeUint64 is the dense union type code for uint64 statistic values.
Variables ¶
var (
AcceptAll = regexp.MustCompile(".*")
)
var ErrOverflow = errors.New("driverbase: value overflow")
Functions ¶
func BuildGetObjectsRecordReader ¶
func BuildGetObjectsRecordReader(mem memory.Allocator, in <-chan GetObjectsInfo, errCh <-chan error) (array.RecordReader, error)
BuildGetObjectsRecordReader constructs a RecordReader for the GetObjects ADBC method. It accepts a channel of GetObjectsInfo to allow concurrent retrieval of metadata and serialization to Arrow record.
func BuildGetStatisticNamesReader ¶
func BuildGetStatisticNamesReader( alloc memory.Allocator, statistics []StatisticNameKey, ) (array.RecordReader, error)
BuildGetStatisticNamesReader constructs an Arrow RecordReader for GetStatisticNames. Returns driver-specific statistics (keys >= 1024) in name/key pairs.
func BuildGetStatisticsReader ¶
func BuildGetStatisticsReader( alloc memory.Allocator, catalogOrder []string, schemaOrder map[string][]string, statsByCatalog map[string]map[string][]Statistic, ) (array.RecordReader, error)
BuildGetStatisticsReader constructs an Arrow RecordReader from pre-computed statistics. This function handles the complex nested Arrow structure required by ADBC GetStatistics.
Parameters:
- alloc: Memory allocator for Arrow builders
- catalogOrder: List of catalog names in order
- schemaOrder: Map of catalog name to ordered list of schema names
- statsByCatalog: Map of catalog -> schema -> statistics list
The function builds the nested structure:
catalog_name: string
catalog_db_schemas: list<struct{
db_schema_name: string
db_schema_statistics: list<struct{
table_name: string
column_name: string (nullable)
statistic_key: int16
statistic_value: dense_union<int64, uint64, float64, binary>
statistic_is_approximate: bool
}>
}>
func DebugAssert ¶
func EmptyGetStatisticsReader ¶
func EmptyGetStatisticsReader() (array.RecordReader, error)
EmptyGetStatisticsReader returns an empty GetStatistics result. This is useful when no statistics are available for the requested filters.
func EndSpan ¶
func EndSpan(span trace.Span, err error, options ...trace.SpanEndOption)
Ends the given span. If err is not nil, then the error is recorded and the status is set appropriately. Otherwise, the status is set to Ok.
func NewRotatingFileWriter ¶
func NewRotatingFileWriter(options ...rotatingFileWriterOption) (*rotatingFileWriterImpl, error)
Creates a new RotatingFileWriter from the given options
func NewStatement ¶
func NewStatement(impl StatementImpl) adbc.StatementWithContext
func NullInt16ToPtr ¶
NullInt16ToPtr converts a sql.NullInt16 to a *int16.
func NullInt32ToPtr ¶
NullInt32ToPtr converts a sql.NullInt32 to a *int32.
func NullStringToPtr ¶
func NullStringToPtr(s sql.NullString) *string
NullStringToPtr converts a sql.NullString to a *string.
func Nullable ¶
func Nullable[T any](val T) *T
Nullable wraps a value and returns a pointer to the value, which is how nullable values are represented for purposes of JSON serialization.
func PatternToRegexp ¶
Helper function that compiles a SQL-style pattern (%, _) to a regex
func RequiredList ¶
func RequiredList[T any](vals []T) requiredList[T]
RequiredList is a wrapper for a slice of values that is not considered "nullable" for serialization purposes. When marshaling JSON, the empty value is serialized as "[]" instead of "null".
func SetOTelDriverInfoAttributes ¶
func SetOTelDriverInfoAttributes(driverInfo *DriverInfo, span trace.Span)
func StartSpan ¶
func StartSpan(ctx context.Context, spanName string, tracing adbc.OTelTracing, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Starts a trace.Span with the given spanName for the tracing object with the given ctx context.
func ValueOrZero ¶
func ValueOrZero[T any](val *T) T
ValueOrZero safely dereferences a pointer, returning the zero-value of the underlying type in the case of a nil pointer.
func WithFileCountMax ¶
func WithFileCountMax(fileCountMax int) rotatingFileWriterOption
Adds the FileCountMax option
func WithFileSizeMaxKb ¶
func WithFileSizeMaxKb(fileSizeMaxKb int64) rotatingFileWriterOption
Adds the FileSizeMaxKb option
func WithLogNamePrefix ¶
func WithLogNamePrefix(logNamePrefix string) rotatingFileWriterOption
Adds the LogNamePrefix option
func WithTracingFolderPath ¶
func WithTracingFolderPath(tracingFolderPath string) rotatingFileWriterOption
Adds the TracingFolderPath option
Types ¶
type AutocommitSetter ¶
AutocommitSetter is an interface that drivers may implement to simplify the implementation of autocommit state management. There is no need to implement this for backends that do not support autocommit, as this is already the default behavior. SetAutocommit should only attempt to update the autocommit state in the backend. Local driver state is automatically updated if the result of this call does not produce an error. (Get/Set)Options implementations are provided automatically as well/
type BaseRecordReader ¶
type BaseRecordReader struct {
// contains filtered or unexported fields
}
BaseRecordReader is an array.RecordReader based on a row-wise interface. It manages ADBC requirements like re-issuing queries multiple times for each row of a bind parameter set.
func (*BaseRecordReader) Close ¶
func (rr *BaseRecordReader) Close()
func (*BaseRecordReader) Err ¶
func (rr *BaseRecordReader) Err() error
func (*BaseRecordReader) Init ¶
func (rr *BaseRecordReader) Init(ctx context.Context, alloc memory.Allocator, logger *slog.Logger, params array.RecordReader, options BaseRecordReaderOptions, impl RecordReaderImpl) (err error)
Init initializes the state for the record reader.
func (*BaseRecordReader) Next ¶
func (rr *BaseRecordReader) Next() bool
func (*BaseRecordReader) Record ¶
func (rr *BaseRecordReader) Record() arrow.RecordBatch
func (*BaseRecordReader) RecordBatch ¶
func (rr *BaseRecordReader) RecordBatch() arrow.RecordBatch
func (*BaseRecordReader) Release ¶
func (rr *BaseRecordReader) Release()
func (*BaseRecordReader) Retain ¶
func (rr *BaseRecordReader) Retain()
func (*BaseRecordReader) Schema ¶
func (rr *BaseRecordReader) Schema() *arrow.Schema
type BaseRecordReaderOptions ¶
type BufferBulkIngestSink ¶
BufferBulkIngestSink is an in-memory BulkIngestSink.
func (*BufferBulkIngestSink) Close ¶
func (*BufferBulkIngestSink) Close() error
func (*BufferBulkIngestSink) Sink ¶
func (sink *BufferBulkIngestSink) Sink() io.Writer
type BulkIngestFileImpl ¶
type BulkIngestFileImpl interface {
// Upload serialized data to the staging area, if needed.
Upload(ctx context.Context, chunk BulkIngestPendingUpload) (BulkIngestPendingCopy, error)
// Delete serialized data from the staging area, if needed.
Delete(ctx context.Context, chunk BulkIngestPendingCopy) error
}
BulkIngestFileImpl is an optional interface to implement in addition to BulkIngestImpl for drivers to add an additional upload-to-staging-area step. For example, the target database may only be able to ingest data from Parquet files on S3; this interface gives the driver a chance to upload the serialized files, and then delete them.
type BulkIngestImpl ¶
type BulkIngestImpl interface {
// CreateTable is the first step, and should create the table to ingest into.
CreateTable(ctx context.Context, schema *arrow.Schema, ifTableExists BulkIngestTableExistsBehavior, ifTableMissing BulkIngestTableMissingBehavior) error
// CreateSink is called repeatedly to allocate a sink to write serialized data
// into, if needed. Return BufferBulkIngestSink to use an in-memory staging area.
CreateSink(ctx context.Context, options *BulkIngestOptions) (BulkIngestSink, error)
// Serialize writes Arrow data into the sink, pulling from the stream of
// batches. Returns (rows, bytes) written.
Serialize(ctx context.Context, writerProps *WriterProps, schema *arrow.Schema, batches chan arrow.RecordBatch, sink BulkIngestSink) (int64, int64, error)
// Copy actually uploads the given serialized data into the target table.
Copy(ctx context.Context, chunk BulkIngestPendingCopy) error
}
BulkIngestImpl is driver-specific behavior for bulk ingest, under the assumption that the target database accepts a stream of serialized data (which may be Arrow, Parquet, or something else).
type BulkIngestInitFinalizeImpl ¶
type BulkIngestInitFinalizeImpl interface {
// Init is called prior to any other methods.
Init(ctx context.Context) error
// Finalize ends the bulk ingest. It is always called.
Finalize(ctx context.Context, success bool) error
}
BulkIngestInitFinalizeImpl is an optional interface to implement in addition to BulkIngestImpl for drivers to perform setup/teardown.
type BulkIngestManager ¶
type BulkIngestManager struct {
Impl BulkIngestImpl
ErrorHelper *ErrorHelper
Logger *slog.Logger
Alloc memory.Allocator
Ctx context.Context
Options BulkIngestOptions
Data array.RecordReader
// contains filtered or unexported fields
}
BulkIngestManager actually implements bulk ingest given an implementation of BulkIngestImpl and other interfaces.
func (*BulkIngestManager) Close ¶
func (bi *BulkIngestManager) Close()
func (*BulkIngestManager) ExecuteIngest ¶
func (bi *BulkIngestManager) ExecuteIngest() (int64, error)
ExecuteIngest actually uploads data.
func (*BulkIngestManager) Init ¶
func (bi *BulkIngestManager) Init() error
Init checks preconditions. This must be called before ExecuteIngest.
type BulkIngestOptions ¶
type BulkIngestOptions struct {
// The table to ingest data into.
TableName string
SchemaName string
CatalogName string
// If true, use a temporary table. The catalog/schema, if specified, will likely
// be ignored (as temporary tables generally get implemented via a special
// catalog/schema).
Temporary bool
// The ingest mode.
Mode string
// How far to read ahead on the data source
ReadDepth int
// How many parallel writers to use
WriterParallelism int
// How many parallel uploaders to use
UploaderParallelism int
// How many buffers to queue at once
MaxPendingBuffers int
// Format-specific options.
WriterProps WriterProps
// IngestBatchSize controls rows per INSERT during batched ingestion (0 means driver default)
IngestBatchSize int
// MaxQuerySizeBytes controls maximum SQL query size in bytes (0 means driver default)
MaxQuerySizeBytes int
}
Common options for bulk ingestion.
func NewBulkIngestOptions ¶
func NewBulkIngestOptions() BulkIngestOptions
func (*BulkIngestOptions) Clear ¶
func (options *BulkIngestOptions) Clear()
Clear resets the destination options.
func (*BulkIngestOptions) IsSet ¶
func (options *BulkIngestOptions) IsSet() bool
IsSet returns true if the user has set a table name to ingest into.
func (*BulkIngestOptions) SetOption ¶
func (options *BulkIngestOptions) SetOption(eh *ErrorHelper, key, val string) (bool, error)
type BulkIngestPendingCopy ¶
BulkIngestPendingCopy is a file that was uploaded to the staging area and is ready to be copied into the target table.
type BulkIngestPendingUpload ¶
type BulkIngestPendingUpload struct {
Data BulkIngestSink
Rows int64
}
BulkIngestPendingUpload is a set of serialized rows, ready to be uploaded or written to the staging area.
func (*BulkIngestPendingUpload) NumRows ¶
func (bpu *BulkIngestPendingUpload) NumRows() int64
func (*BulkIngestPendingUpload) String ¶
func (bpu *BulkIngestPendingUpload) String() string
type BulkIngestSink ¶
BulkIngestSink is a buffer, ready for Parquet data to be written to it. It can be an in-memory buffer, or it could be an open file handle.
type BulkIngestTableExistsBehavior ¶
type BulkIngestTableExistsBehavior int
What a driver should do when creating the target table, if the table exists.
const ( BulkIngestTableExistsError BulkIngestTableExistsBehavior = iota BulkIngestTableExistsIgnore BulkIngestTableExistsDrop )
type BulkIngestTableMissingBehavior ¶
type BulkIngestTableMissingBehavior int
What a driver should do when creating the target table, if the table does not exist.
const ( BulkIngestTableMissingError BulkIngestTableMissingBehavior = iota BulkIngestTableMissingCreate )
type BulkIngestTransformImpl ¶
type BulkIngestTransformImpl interface {
TransformedSchema() *arrow.Schema
TransformBatch(ctx context.Context, batch arrow.RecordBatch) (arrow.RecordBatch, error)
}
Optionally implement this if the data has to be transformed (e.g. cast view types to 'normal' types). The benefit of using this interface is that the transformation can be parallelized (vs just transforming the input stream).
type ColumnInfo ¶
type ColumnInfo struct {
ColumnName string `json:"column_name"`
OrdinalPosition *int32 `json:"ordinal_position,omitempty"`
Remarks *string `json:"remarks,omitempty"`
XdbcDataType *int16 `json:"xdbc_data_type,omitempty"`
XdbcTypeName *string `json:"xdbc_type_name,omitempty"`
XdbcColumnSize *int32 `json:"xdbc_column_size,omitempty"`
XdbcDecimalDigits *int16 `json:"xdbc_decimal_digits,omitempty"`
XdbcNumPrecRadix *int16 `json:"xdbc_num_prec_radix,omitempty"`
XdbcNullable *int16 `json:"xdbc_nullable,omitempty"`
XdbcColumnDef *string `json:"xdbc_column_def,omitempty"`
XdbcSqlDataType *int16 `json:"xdbc_sql_data_type,omitempty"`
XdbcDatetimeSub *int16 `json:"xdbc_datetime_sub,omitempty"`
XdbcCharOctetLength *int32 `json:"xdbc_char_octet_length,omitempty"`
XdbcIsNullable *string `json:"xdbc_is_nullable,omitempty"`
XdbcScopeCatalog *string `json:"xdbc_scope_catalog,omitempty"`
XdbcScopeSchema *string `json:"xdbc_scope_schema,omitempty"`
XdbcScopeTable *string `json:"xdbc_scope_table,omitempty"`
XdbcIsAutoincrement *bool `json:"xdbc_is_autoincrement,omitempty"`
XdbcIsGeneratedcolumn *bool `json:"xdbc_is_generatedcolumn,omitempty"`
}
ColumnInfo is a structured representation of adbc.ColumnSchema
type Connection ¶
type Connection interface {
adbc.ConnectionWithContext
adbc.GetSetOptionsWithContext
}
Connection is the interface satisfied by the result of the NewConnection constructor, given that an input is provided satisfying the ConnectionImpl interface.
type ConnectionBuilder ¶
type ConnectionBuilder struct {
// contains filtered or unexported fields
}
func NewConnectionBuilder ¶
func NewConnectionBuilder(impl ConnectionImpl) *ConnectionBuilder
func (*ConnectionBuilder) Connection ¶
func (b *ConnectionBuilder) Connection() Connection
func (*ConnectionBuilder) WithAutocommitSetter ¶
func (b *ConnectionBuilder) WithAutocommitSetter(helper AutocommitSetter) *ConnectionBuilder
func (*ConnectionBuilder) WithConcurrency ¶
func (b *ConnectionBuilder) WithConcurrency(concurrency int) *ConnectionBuilder
func (*ConnectionBuilder) WithCurrentNamespacer ¶
func (b *ConnectionBuilder) WithCurrentNamespacer(helper CurrentNamespacer) *ConnectionBuilder
func (*ConnectionBuilder) WithDbObjectsEnumerator ¶
func (b *ConnectionBuilder) WithDbObjectsEnumerator(helper DbObjectsEnumerator) *ConnectionBuilder
func (*ConnectionBuilder) WithDbObjectsEnumeratorFactory ¶
func (b *ConnectionBuilder) WithDbObjectsEnumeratorFactory(helper DbObjectsEnumeratorFactory) *ConnectionBuilder
func (*ConnectionBuilder) WithDriverInfoPreparer ¶
func (b *ConnectionBuilder) WithDriverInfoPreparer(helper DriverInfoPreparer) *ConnectionBuilder
func (*ConnectionBuilder) WithTableTypeLister ¶
func (b *ConnectionBuilder) WithTableTypeLister(helper TableTypeLister) *ConnectionBuilder
type ConnectionImpl ¶
type ConnectionImpl interface {
adbc.ConnectionWithContext
adbc.GetSetOptionsWithContext
adbc.OTelTracing
Base() *ConnectionImplBase
}
ConnectionImpl is an interface that drivers implement to provide vendor-specific functionality.
type ConnectionImplBase ¶
type ConnectionImplBase struct {
Alloc memory.Allocator
ErrorHelper ErrorHelper
DriverInfo *DriverInfo
Logger *slog.Logger
Tracer trace.Tracer
Autocommit bool
Closed bool
// contains filtered or unexported fields
}
ConnectionImplBase is a struct that provides default implementations of the ConnectionImpl interface. It is meant to be used as a composite struct for a driver's ConnectionImpl implementation.
func NewConnectionImplBase ¶
func NewConnectionImplBase(database *DatabaseImplBase) ConnectionImplBase
NewConnectionImplBase instantiates ConnectionImplBase.
- database is a DatabaseImplBase containing the common resources from the parent database, allowing the Arrow allocator, error handler, and logger to be reused.
func (*ConnectionImplBase) Base ¶
func (base *ConnectionImplBase) Base() *ConnectionImplBase
func (*ConnectionImplBase) Commit ¶
func (base *ConnectionImplBase) Commit(ctx context.Context) error
func (*ConnectionImplBase) GetInfo ¶
func (base *ConnectionImplBase) GetInfo(ctx context.Context, infoCodes []adbc.InfoCode) (reader array.RecordReader, err error)
func (*ConnectionImplBase) GetInitialSpanAttributes ¶
func (cnxn *ConnectionImplBase) GetInitialSpanAttributes() []attribute.KeyValue
func (*ConnectionImplBase) GetObjects ¶
func (base *ConnectionImplBase) GetObjects(ctx context.Context, depth adbc.ObjectDepth, catalog *string, dbSchema *string, tableName *string, columnName *string, tableType []string) (array.RecordReader, error)
func (*ConnectionImplBase) GetOptionBytes ¶
func (*ConnectionImplBase) GetOptionDouble ¶
func (*ConnectionImplBase) GetOptionInt ¶
func (*ConnectionImplBase) GetTableSchema ¶
func (*ConnectionImplBase) GetTableTypes ¶
func (base *ConnectionImplBase) GetTableTypes(context.Context) (array.RecordReader, error)
func (*ConnectionImplBase) GetTraceParent ¶
func (cnxn *ConnectionImplBase) GetTraceParent() string
func (*ConnectionImplBase) NewStatement ¶
func (base *ConnectionImplBase) NewStatement(ctx context.Context) (adbc.StatementWithContext, error)
func (*ConnectionImplBase) ReadPartition ¶
func (base *ConnectionImplBase) ReadPartition(ctx context.Context, serializedPartition []byte) (array.RecordReader, error)
func (*ConnectionImplBase) Rollback ¶
func (base *ConnectionImplBase) Rollback(context.Context) error
func (*ConnectionImplBase) SetOptionBytes ¶
func (*ConnectionImplBase) SetOptionDouble ¶
func (*ConnectionImplBase) SetOptionInt ¶
func (*ConnectionImplBase) SetTraceParent ¶
func (cnxn *ConnectionImplBase) SetTraceParent(traceParent string)
type ConstraintColumnUsage ¶
type ConstraintColumnUsage struct {
ForeignKeyCatalog *string `json:"fk_catalog,omitempty"`
ForeignKeyDbSchema *string `json:"fk_db_schema,omitempty"`
ForeignKeyTable string `json:"fk_table"`
ForeignKeyColumn string `json:"fk_column_name"`
}
ConstraintColumnUsage is a structured representation of adbc.UsageSchema
type ConstraintInfo ¶
type ConstraintInfo struct {
ConstraintName *string `json:"constraint_name,omitempty"`
ConstraintType string `json:"constraint_type"`
ConstraintColumnNames requiredList[string] `json:"constraint_column_names"`
ConstraintColumnUsage []ConstraintColumnUsage `json:"constraint_column_usage,omitempty"`
}
ConstraintInfo is a structured representation of adbc.ConstraintSchema
type CurrentNamespacer ¶
type CurrentNamespacer interface {
GetCurrentCatalog(context.Context) (string, error)
GetCurrentDbSchema(context.Context) (string, error)
SetCurrentCatalog(context.Context, string) error
SetCurrentDbSchema(context.Context, string) error
}
CurrentNamespacer is an interface that drivers may implement to delegate stateful namespacing with DB catalogs and schemas. The appropriate (Get/Set)Options implementations will be provided using the results of these methods.
type DBSchemaInfo ¶
type DBSchemaInfo struct {
DbSchemaName *string `json:"db_schema_name,omitempty"`
DbSchemaTables []TableInfo `json:"db_schema_tables"`
}
DBSchemaInfo is a structured representation of adbc.DBSchemaSchema
type DataDependentMetadata ¶
type DataDependentMetadata interface {
// Called after BeginAppending. Return nil if no changes are needed.
UpdateSchema(ctx context.Context, oldSchema *arrow.Schema, firstBatch arrow.RecordBatch) (*arrow.Schema, error)
}
DataDependentMetadata is an extension for databases where some type metadata must be inferred from the data itself. This allows updating the schema after scanning the first batch of data but before emitting it.
type Database ¶
type Database interface {
adbc.DatabaseWithContext
adbc.GetSetOptionsWithContext
adbc.DatabaseLogging
adbc.OTelTracingInit
}
Database is the interface satisfied by the result of the NewDatabase constructor, given an input is provided satisfying the DatabaseImpl interface.
func NewDatabase ¶
func NewDatabase(impl DatabaseImpl) Database
NewDatabase wraps a DatabaseImpl to create an adbc.Database.
type DatabaseImpl ¶
type DatabaseImpl interface {
adbc.DatabaseWithContext
adbc.GetSetOptionsWithContext
Base() *DatabaseImplBase
}
DatabaseImpl is an interface that drivers implement to provide vendor-specific functionality.
type DatabaseImplBase ¶
type DatabaseImplBase struct {
Alloc memory.Allocator
ErrorHelper ErrorHelper
DriverInfo *DriverInfo
Logger *slog.Logger
Tracer trace.Tracer
// contains filtered or unexported fields
}
DatabaseImplBase is a struct that provides default implementations of the DatabaseImpl interface. It is meant to be used as a composite struct for a driver's DatabaseImpl implementation.
func NewDatabaseImplBase ¶
func NewDatabaseImplBase(ctx context.Context, driver *DriverImplBase) (DatabaseImplBase, error)
NewDatabaseImplBase instantiates DatabaseImplBase.
- driver is a DriverImplBase containing the common resources from the parent driver, allowing the Arrow allocator and error handler to be reused.
func (*DatabaseImplBase) Base ¶
func (base *DatabaseImplBase) Base() *DatabaseImplBase
func (*DatabaseImplBase) Close ¶
func (base *DatabaseImplBase) Close(ctx context.Context) (err error)
func (*DatabaseImplBase) GetInitialSpanAttributes ¶
func (d *DatabaseImplBase) GetInitialSpanAttributes() []attribute.KeyValue
func (*DatabaseImplBase) GetOptionBytes ¶
func (*DatabaseImplBase) GetOptionDouble ¶
func (*DatabaseImplBase) GetOptionInt ¶
func (*DatabaseImplBase) GetTraceParent ¶
func (d *DatabaseImplBase) GetTraceParent() (traceParent string)
func (*DatabaseImplBase) InitTracing ¶
func (*DatabaseImplBase) Open ¶
func (base *DatabaseImplBase) Open(ctx context.Context) (adbc.ConnectionWithContext, error)
func (*DatabaseImplBase) SetOptionBytes ¶
func (*DatabaseImplBase) SetOptionDouble ¶
func (*DatabaseImplBase) SetOptionInt ¶
func (*DatabaseImplBase) SetOptions ¶
func (*DatabaseImplBase) SetTraceParent ¶
func (d *DatabaseImplBase) SetTraceParent(traceParent string)
type DbObjectsEnumerator ¶
type DbObjectsEnumerator interface {
GetCatalogs(ctx context.Context, catalogFilter *string) ([]string, error)
GetDBSchemasForCatalog(ctx context.Context, catalog string, schemaFilter *string) ([]string, error)
GetTablesForDBSchema(ctx context.Context, catalog string, schema string, tableFilter *string, columnFilter *string, includeColumns bool) ([]TableInfo, error)
}
DbObjectsEnumerator is an interface that drivers may implement to simplify the implementation of adbc.Connection.GetObjects(). By independently implementing lookup for catalogs, dbSchemas and tables, the driverbase is able to provide the full GetObjects functionality for arbitrary search patterns and lookup depth.
type DbObjectsEnumeratorFactory ¶
type DbObjectsEnumeratorFactory func(context.Context) (DbObjectsEnumerator, error)
DbObjectsEnumeratorFactory generates a DbObjectsEnumerator that will be used for a particular GetObjects call, allowing internally consistent caching without needing global state.
type Driver ¶
type Driver interface {
DriverWithContext
}
Driver is the interface satisfied by the result of the NewDriver constructor, given an input is provided satisfying the DriverImpl interface.
func NewDriver ¶
func NewDriver(impl DriverImpl) Driver
NewDriver wraps a DriverImpl to create a Driver.
type DriverImpl ¶
type DriverImpl interface {
DriverWithContext
Base() *DriverImplBase
}
DriverImpl is an interface that drivers implement to provide vendor-specific functionality.
type DriverImplBase ¶
type DriverImplBase struct {
Alloc memory.Allocator
ErrorHelper ErrorHelper
DriverInfo *DriverInfo
Logger *slog.Logger
}
DriverImplBase is a struct that provides default implementations of the DriverImpl interface. It is meant to be used as a composite struct for a driver's DriverImpl implementation.
func NewDriverImplBase ¶
func NewDriverImplBase(info *DriverInfo, alloc memory.Allocator) DriverImplBase
NewDriverImplBase instantiates DriverImplBase.
- info contains build and vendor info, as well as the name to construct error messages.
- alloc is an Arrow allocator to use.
func (*DriverImplBase) Base ¶
func (base *DriverImplBase) Base() *DriverImplBase
func (*DriverImplBase) NewDatabaseWithContext ¶
func (base *DriverImplBase) NewDatabaseWithContext(ctx context.Context, opts map[string]string) (adbc.DatabaseWithContext, error)
func (*DriverImplBase) SetLogger ¶
func (base *DriverImplBase) SetLogger(logger *slog.Logger)
type DriverInfo ¶
type DriverInfo struct {
// contains filtered or unexported fields
}
func DefaultDriverInfo ¶
func DefaultDriverInfo(name string) *DriverInfo
func (*DriverInfo) GetInfoForInfoCode ¶
func (di *DriverInfo) GetInfoForInfoCode(code adbc.InfoCode) (any, bool)
func (*DriverInfo) GetName ¶
func (di *DriverInfo) GetName() string
func (*DriverInfo) InfoSupportedCodes ¶
func (di *DriverInfo) InfoSupportedCodes() []adbc.InfoCode
func (*DriverInfo) MustRegister ¶
func (di *DriverInfo) MustRegister(codes map[adbc.InfoCode]any)
func (*DriverInfo) RegisterInfoCode ¶
func (di *DriverInfo) RegisterInfoCode(code adbc.InfoCode, value any) error
type DriverInfoPreparer ¶
type DriverInfoPreparer interface {
PrepareDriverInfo(ctx context.Context, infoCodes []adbc.InfoCode) error
}
DriverInfoPreparer is an interface that drivers may implement to add/update DriverInfo values whenever adbc.Connection.GetInfo() is called.
type DriverWithContext ¶
type ErrorHelper ¶
type ErrorHelper struct {
DriverName string
ErrorInspector ErrorInspector
}
ErrorHelper helps format errors for ADBC drivers.
func (*ErrorHelper) AlreadyExists ¶
func (helper *ErrorHelper) AlreadyExists(message string, format ...any) error
func (*ErrorHelper) Cancelled ¶
func (helper *ErrorHelper) Cancelled(message string, format ...any) error
func (*ErrorHelper) Integrity ¶
func (helper *ErrorHelper) Integrity(message string, format ...any) error
func (*ErrorHelper) Internal ¶
func (helper *ErrorHelper) Internal(message string, format ...any) error
func (*ErrorHelper) InvalidArgument ¶
func (helper *ErrorHelper) InvalidArgument(message string, format ...any) error
func (*ErrorHelper) InvalidData ¶
func (helper *ErrorHelper) InvalidData(message string, format ...any) error
func (*ErrorHelper) InvalidState ¶
func (helper *ErrorHelper) InvalidState(message string, format ...any) error
func (*ErrorHelper) NotFound ¶
func (helper *ErrorHelper) NotFound(message string, format ...any) error
func (*ErrorHelper) NotImplemented ¶
func (helper *ErrorHelper) NotImplemented(message string, format ...any) error
func (*ErrorHelper) Timeout ¶
func (helper *ErrorHelper) Timeout(message string, format ...any) error
func (*ErrorHelper) Unauthenticated ¶
func (helper *ErrorHelper) Unauthenticated(message string, format ...any) error
func (*ErrorHelper) Unauthorized ¶
func (helper *ErrorHelper) Unauthorized(message string, format ...any) error
func (*ErrorHelper) Unknown ¶
func (helper *ErrorHelper) Unknown(message string, format ...any) error
func (*ErrorHelper) WrapAlreadyExists ¶
func (helper *ErrorHelper) WrapAlreadyExists(err error, format string, args ...any) error
func (*ErrorHelper) WrapCancelled ¶
func (helper *ErrorHelper) WrapCancelled(err error, format string, args ...any) error
func (*ErrorHelper) WrapIO ¶
func (helper *ErrorHelper) WrapIO(err error, format string, args ...any) error
func (*ErrorHelper) WrapIntegrity ¶
func (helper *ErrorHelper) WrapIntegrity(err error, format string, args ...any) error
func (*ErrorHelper) WrapInternal ¶
func (helper *ErrorHelper) WrapInternal(err error, format string, args ...any) error
func (*ErrorHelper) WrapInvalidArgument ¶
func (helper *ErrorHelper) WrapInvalidArgument(err error, format string, args ...any) error
func (*ErrorHelper) WrapInvalidData ¶
func (helper *ErrorHelper) WrapInvalidData(err error, format string, args ...any) error
func (*ErrorHelper) WrapInvalidState ¶
func (helper *ErrorHelper) WrapInvalidState(err error, format string, args ...any) error
func (*ErrorHelper) WrapNotFound ¶
func (helper *ErrorHelper) WrapNotFound(err error, format string, args ...any) error
func (*ErrorHelper) WrapNotImplemented ¶
func (helper *ErrorHelper) WrapNotImplemented(err error, format string, args ...any) error
func (*ErrorHelper) WrapTimeout ¶
func (helper *ErrorHelper) WrapTimeout(err error, format string, args ...any) error
func (*ErrorHelper) WrapUnauthenticated ¶
func (helper *ErrorHelper) WrapUnauthenticated(err error, format string, args ...any) error
func (*ErrorHelper) WrapUnauthorized ¶
func (helper *ErrorHelper) WrapUnauthorized(err error, format string, args ...any) error
func (*ErrorHelper) WrapUnknown ¶
func (helper *ErrorHelper) WrapUnknown(err error, format string, args ...any) error
type ErrorInspector ¶
ErrorInspector inspects database driver errors and formats them as ADBC errors. Drivers can implement this interface to map database-specific errors to ADBC status codes, format vendor-specific error messages, and extract error details like SQLSTATE and vendor codes.
type GetObjectsInfo ¶
type GetObjectsInfo struct {
CatalogName *string `json:"catalog_name,omitempty"`
CatalogDbSchemas []DBSchemaInfo `json:"catalog_db_schemas"`
}
GetObjectsInfo is a structured representation of adbc.GetObjectsSchema
func (*GetObjectsInfo) Scan ¶
func (g *GetObjectsInfo) Scan(src any) error
Scan implements sql.Scanner.
type ParquetIngestImpl ¶
type ParquetIngestImpl struct{}
ParquetIngestImpl is a base for BulkIngestImpl that writes Parquet data.
func (*ParquetIngestImpl) Serialize ¶
func (p *ParquetIngestImpl) Serialize(ctx context.Context, writerProps *WriterProps, schema *arrow.Schema, batches chan arrow.RecordBatch, sink BulkIngestSink) (int64, int64, error)
type RecordReaderImpl ¶
type RecordReaderImpl interface {
io.Closer
// AppendRows adds one or more rows of the current result set to the
// record builder. Return io.EOF if no more rows can be appended from
// the current result set. Return the number of rows appended, and an
// estimate of row size. If ErrOverflow is returned, end the current
// batch immediately. It is assumed the reader can retry again on the
// next call.
AppendRows(builder *array.RecordBuilder) (int64, int64, error)
// BeginAppending is called exactly once before the first call to
// AppendRow. The implementation can do any necessary initialization
// here. It will be called after the first call to NextResultSet.
BeginAppending(builder *array.RecordBuilder) error
// NextResultSet closes the current result set and opens the next
// result set for the given parameters. If there are no parameters, it
// will be called exactly once with rec == nil.
NextResultSet(ctx context.Context, rec arrow.RecordBatch, rowIdx int) (*arrow.Schema, error)
}
RecordReaderImpl is a row-wise implementation of a record reader. The driverbase can pivot this into an array.RecordReader.
type Shared ¶
type Shared[T any] struct { // contains filtered or unexported fields }
Shared allows shared usage of an underlying resource, but not concurrently.
func (*Shared[T]) Hold ¶
func (sh *Shared[T]) Hold() (SharedHandle[T], error)
Hold gets exclusive access to the connection until the returned handle is released. Use sparingly; do not create long-lived handles as it increases potential for deadlock.
type SharedHandle ¶
type SharedHandle[T any] struct { // contains filtered or unexported fields }
func (*SharedHandle[T]) Handle ¶
func (sh *SharedHandle[T]) Handle() *T
func (*SharedHandle[T]) Release ¶
func (sh *SharedHandle[T]) Release()
type Statement ¶
type Statement interface {
adbc.StatementWithContext
adbc.GetSetOptionsWithContext
}
type StatementImpl ¶
type StatementImpl interface {
adbc.StatementWithContext
adbc.StatementExecuteSchema
adbc.GetSetOptionsWithContext
adbc.OTelTracing
Base() *StatementImplBase
}
type StatementImplBase ¶
type StatementImplBase struct {
ErrorHelper ErrorHelper
Tracer trace.Tracer
// contains filtered or unexported fields
}
func NewStatementImplBase ¶
func NewStatementImplBase(cnxn *ConnectionImplBase, errorHelper ErrorHelper) StatementImplBase
func (*StatementImplBase) Base ¶
func (st *StatementImplBase) Base() *StatementImplBase
func (*StatementImplBase) Bind ¶
func (st *StatementImplBase) Bind(ctx context.Context, values arrow.RecordBatch) error
func (*StatementImplBase) BindStream ¶
func (st *StatementImplBase) BindStream(ctx context.Context, stream array.RecordReader) error
func (*StatementImplBase) ExecutePartitions ¶
func (st *StatementImplBase) ExecutePartitions(ctx context.Context) (*arrow.Schema, adbc.Partitions, int64, error)
func (*StatementImplBase) ExecuteQuery ¶
func (st *StatementImplBase) ExecuteQuery(ctx context.Context) (array.RecordReader, int64, error)
func (*StatementImplBase) ExecuteSchema ¶
func (*StatementImplBase) ExecuteUpdate ¶
func (st *StatementImplBase) ExecuteUpdate(ctx context.Context) (int64, error)
func (*StatementImplBase) GetInitialSpanAttributes ¶
func (st *StatementImplBase) GetInitialSpanAttributes() []attribute.KeyValue
func (*StatementImplBase) GetOptionBytes ¶
func (*StatementImplBase) GetOptionDouble ¶
func (*StatementImplBase) GetOptionInt ¶
func (*StatementImplBase) GetParameterSchema ¶
func (*StatementImplBase) GetTraceParent ¶
func (st *StatementImplBase) GetTraceParent() string
func (*StatementImplBase) SetOption ¶
func (st *StatementImplBase) SetOption(ctx context.Context, key, value string) error
func (*StatementImplBase) SetOptionBytes ¶
func (*StatementImplBase) SetOptionDouble ¶
func (*StatementImplBase) SetOptionInt ¶
func (*StatementImplBase) SetSqlQuery ¶
func (st *StatementImplBase) SetSqlQuery(ctx context.Context, query string) error
func (*StatementImplBase) SetSubstraitPlan ¶
func (st *StatementImplBase) SetSubstraitPlan(ctx context.Context, plan []byte) error
func (*StatementImplBase) SetTraceParent ¶
func (st *StatementImplBase) SetTraceParent(traceParent string)
type Statistic ¶
type Statistic struct {
TableName string
ColumnName *string // nil for table-level statistics
Key int16
ValueKind arrow.UnionTypeCode
ValueI64 int64
ValueU64 uint64
ValueF64 float64
ValueBin []byte
Approx bool
}
Statistic represents a single statistic value for a table or column. This struct is used to accumulate statistics before building the final Arrow RecordReader for GetStatistics results.
func NewBinaryStat ¶
NewBinaryStat creates a statistic with a binary value.
func NewFloat64Stat ¶
NewFloat64Stat creates a statistic with a float64 value.
func NewInt64Stat ¶
NewInt64Stat creates a statistic with an int64 value.
type StatisticNameKey ¶
StatisticNameKey represents a named statistic with its key for GetStatisticNames.
type SynchronousCancel ¶
type SynchronousCancel interface {
// Cancel is called to cancel the current query. Note that other
// methods may be called after, but Cancel will not be called
// concurrently with other methods. If possible an implementation
// should handle context cancellation itself.
Cancel()
}
type TableInfo ¶
type TableInfo struct {
TableName string `json:"table_name"`
TableType string `json:"table_type"`
TableColumns []ColumnInfo `json:"table_columns"`
TableConstraints []ConstraintInfo `json:"table_constraints"`
}
TableInfo is a structured representation of adbc.TableSchema
type TableTypeLister ¶
TableTypeLister is an interface that drivers may implement to simplify the implementation of adbc.Connection.GetTableTypes() for backends that do not natively send these values as arrow records. The conversion of the result to a RecordReader is handled automatically.
type WriterProps ¶
type WriterProps struct {
// A target file size in bytes.
MaxBytes int64
ParquetWriterProps *parquet.WriterProperties
ArrowWriterProps pqarrow.ArrowWriterProperties
ArrowIpcProps []ipc.Option
}
WriterProps holds properties for writing data files to be ingested.
type XdbcDataType ¶
type XdbcDataType int32
The JDBC/ODBC-defined type of any object. All the values here are the sames as in the JDBC and ODBC specs.
const ( XdbcDataType_XDBC_UNKNOWN_TYPE XdbcDataType = 0 XdbcDataType_XDBC_CHAR XdbcDataType = 1 XdbcDataType_XDBC_NUMERIC XdbcDataType = 2 XdbcDataType_XDBC_DECIMAL XdbcDataType = 3 XdbcDataType_XDBC_INTEGER XdbcDataType = 4 XdbcDataType_XDBC_SMALLINT XdbcDataType = 5 XdbcDataType_XDBC_FLOAT XdbcDataType = 6 XdbcDataType_XDBC_REAL XdbcDataType = 7 XdbcDataType_XDBC_DOUBLE XdbcDataType = 8 XdbcDataType_XDBC_DATETIME XdbcDataType = 9 XdbcDataType_XDBC_INTERVAL XdbcDataType = 10 XdbcDataType_XDBC_VARCHAR XdbcDataType = 12 XdbcDataType_XDBC_DATE XdbcDataType = 91 XdbcDataType_XDBC_TIME XdbcDataType = 92 XdbcDataType_XDBC_TIMESTAMP XdbcDataType = 93 XdbcDataType_XDBC_LONGVARCHAR XdbcDataType = -1 XdbcDataType_XDBC_BINARY XdbcDataType = -2 XdbcDataType_XDBC_VARBINARY XdbcDataType = -3 XdbcDataType_XDBC_LONGVARBINARY XdbcDataType = -4 XdbcDataType_XDBC_BIGINT XdbcDataType = -5 XdbcDataType_XDBC_TINYINT XdbcDataType = -6 XdbcDataType_XDBC_BIT XdbcDataType = -7 XdbcDataType_XDBC_WCHAR XdbcDataType = -8 XdbcDataType_XDBC_WVARCHAR XdbcDataType = -9 )
func ToXdbcDataType ¶
func ToXdbcDataType(dt arrow.DataType) (xdbcType XdbcDataType)