lidavidm commented on code in PR #1572: URL: https://github.com/apache/arrow-adbc/pull/1572#discussion_r1511914715
########## go/adbc/driver/driverbase/connection.go: ########## @@ -0,0 +1,403 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package driverbase + +import ( + "context" + "runtime/debug" + "strings" + + "github.com/apache/arrow-adbc/go/adbc" + "github.com/apache/arrow-adbc/go/adbc/driver/internal" + "github.com/apache/arrow/go/v16/arrow" + "github.com/apache/arrow/go/v16/arrow/array" + "github.com/apache/arrow/go/v16/arrow/memory" +) + +var ( + infoDriverArrowVersion string +) + +func init() { + if info, ok := debug.ReadBuildInfo(); ok { + for _, dep := range info.Deps { + switch { + case strings.HasPrefix(dep.Path, "github.com/apache/arrow/go/"): + infoDriverArrowVersion = dep.Version + } + } + } + // XXX: Deps not populated in tests + // https://github.com/golang/go/issues/33976 + if infoDriverArrowVersion == "" { + infoDriverArrowVersion = "(unknown or development build)" + } +} + +// ConnectionImpl is an interface that drivers implement to provide +// vendor-specific functionality. +type ConnectionImpl interface { + // adbc.ConnectionGetStatistics + adbc.GetSetOptions + Base() *ConnectionImplBase + + // Will be called at most once + Close() error + // Will not be called unless autocommit is disabled + Commit(context.Context) error + CurrentCatalog() (string, bool) + CurrentDbSchema() (string, bool) + // Get boxed values for info codes + GetInfo(ctx context.Context, infoCodes []adbc.InfoCode) (map[adbc.InfoCode]interface{}, error) + // Get all info codes the driver supports (minus the 6 standard codes + // which are assumed to always be supported) + GetInfoCodes() []adbc.InfoCode + // Get all catalogs + GetObjectsCatalogs(ctx context.Context, catalog *string) ([]string, error) + GetObjectsDbSchemas(ctx context.Context, depth adbc.ObjectDepth, catalog *string, schema *string, metadataRecords []internal.Metadata) (map[string][]string, error) + GetObjectsTables(ctx context.Context, depth adbc.ObjectDepth, catalog *string, schema *string, tableName *string, columnName *string, tableType []string, metadataRecords []internal.Metadata) (map[internal.CatalogAndSchema][]internal.TableInfo, error) + GetTableSchema(ctx context.Context, catalog, dbSchema *string, tableName string) (*arrow.Schema, error) + GetTableTypes(ctx context.Context) (array.RecordReader, error) + NewStatement() (adbc.Statement, error) + ReadPartition(ctx context.Context, serializedPartition []byte) (array.RecordReader, error) + // Will not be called unless autocommit is disabled + Rollback(context.Context) error + SetAutocommit(enabled bool) error Review Comment: Some of the methods are different, e.g. GetInfo and the GetObjects functions -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
