Mandukhai-Alimaa commented on code in PR #3239:
URL: https://github.com/apache/arrow-adbc/pull/3239#discussion_r2259669024
##########
go/adbc/ext.go:
##########
@@ -159,3 +160,136 @@ func IngestStream(ctx context.Context, cnxn Connection,
reader array.RecordReade
return count, nil
}
+
+// VersionInfo contains comprehensive driver and library version information.
+type VersionInfo struct {
+ DriverName string `json:"driver_name"` // e.g., "ADBC
PostgreSQL Driver"
+ DriverVersion string `json:"driver_version"` // e.g.,
"15.13.0000"
+ LibraryInfo map[string]string `json:"library_info"` // Additional
library versions, protocol info, etc.
+}
+
+// GetVersionInfo retrieves comprehensive driver version information from a
connection.
+// This helper function encapsulates the complex process of querying driver
info codes,
+// handling streaming record batches and union arrays, extracting and safely
cloning
+// string values, and managing errors with fallback defaults.
+//
+// Returns detailed version information including driver name, version, and
additional
+// library information such as Arrow version, vendor details, and ADBC version.
+//
+// This is not part of the ADBC API specification.
+func GetVersionInfo(ctx context.Context, cnxn Connection) (*VersionInfo,
error) {
+ stream, err := cnxn.GetInfo(ctx, []InfoCode{
+ InfoDriverName,
+ InfoDriverVersion,
+ InfoDriverArrowVersion,
+ InfoDriverADBCVersion,
+ InfoVendorName,
+ InfoVendorVersion,
+ InfoVendorArrowVersion,
+ InfoVendorSql,
+ InfoVendorSubstrait,
+ InfoVendorSubstraitMinVersion,
+ InfoVendorSubstraitMaxVersion,
Review Comment:
I added a comment that says if any fields from libraryInfo are promoted to
the top-level, they must still be preserved in libraryInfo to maintain backward
compatibility.
--
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]