lidavidm commented on code in PR #3239: URL: https://github.com/apache/arrow-adbc/pull/3239#discussion_r2259665462
########## go/adbc/ext.go: ########## @@ -159,3 +160,145 @@ func IngestStream(ctx context.Context, cnxn Connection, reader array.RecordReade return count, nil } + +// DriverInfo library info map keys for auxiliary information +// +// NOTE: If in the future any of these InfoCodes are promoted to top-level fields +// in the DriverInfo struct, their values should still also be included in the +// LibraryInfo map to maintain backward compatibility. This ensures older clients +// relying on LibraryInfo won't break when new fields are introduced. +const ( + DriverInfoKeyDriverArrowVersion = "driver_arrow_version" + DriverInfoKeyVendorArrowVersion = "vendor_arrow_version" + DriverInfoKeyVendorSQLSupport = "vendor_sql_support" + DriverInfoKeyVendorSubstraitSupport = "vendor_substrait_support" + DriverInfoKeyVendorSubstraitMinVersion = "vendor_substrait_min_version" + DriverInfoKeyVendorSubstraitMaxVersion = "vendor_substrait_max_version" +) + +// VersionInfo contains comprehensive driver and library version information. +type DriverInfo struct { + DriverName string `json:"driver_name"` // e.g., "ADBC PostgreSQL Driver" + DriverVersion string `json:"driver_version"` // e.g., "15.13.0000" Review Comment: Hmm, DriverVersion should be like 1.7.0 (if you used the PostgreSQL driver as an example) ########## go/adbc/ext.go: ########## @@ -159,3 +160,145 @@ func IngestStream(ctx context.Context, cnxn Connection, reader array.RecordReade return count, nil } + +// DriverInfo library info map keys for auxiliary information +// +// NOTE: If in the future any of these InfoCodes are promoted to top-level fields +// in the DriverInfo struct, their values should still also be included in the +// LibraryInfo map to maintain backward compatibility. This ensures older clients +// relying on LibraryInfo won't break when new fields are introduced. +const ( + DriverInfoKeyDriverArrowVersion = "driver_arrow_version" + DriverInfoKeyVendorArrowVersion = "vendor_arrow_version" + DriverInfoKeyVendorSQLSupport = "vendor_sql_support" + DriverInfoKeyVendorSubstraitSupport = "vendor_substrait_support" + DriverInfoKeyVendorSubstraitMinVersion = "vendor_substrait_min_version" + DriverInfoKeyVendorSubstraitMaxVersion = "vendor_substrait_max_version" +) + +// VersionInfo contains comprehensive driver and library version information. Review Comment: ```suggestion // DriverInfo contains comprehensive driver and library version information. ``` ########## go/adbc/ext.go: ########## @@ -159,3 +160,145 @@ func IngestStream(ctx context.Context, cnxn Connection, reader array.RecordReade return count, nil } + +// DriverInfo library info map keys for auxiliary information +// +// NOTE: If in the future any of these InfoCodes are promoted to top-level fields +// in the DriverInfo struct, their values should still also be included in the +// LibraryInfo map to maintain backward compatibility. This ensures older clients +// relying on LibraryInfo won't break when new fields are introduced. +const ( + DriverInfoKeyDriverArrowVersion = "driver_arrow_version" + DriverInfoKeyVendorArrowVersion = "vendor_arrow_version" + DriverInfoKeyVendorSQLSupport = "vendor_sql_support" + DriverInfoKeyVendorSubstraitSupport = "vendor_substrait_support" + DriverInfoKeyVendorSubstraitMinVersion = "vendor_substrait_min_version" + DriverInfoKeyVendorSubstraitMaxVersion = "vendor_substrait_max_version" +) + +// VersionInfo contains comprehensive driver and library version information. +type DriverInfo struct { + DriverName string `json:"driver_name"` // e.g., "ADBC PostgreSQL Driver" + DriverVersion string `json:"driver_version"` // e.g., "15.13.0000" + VendorName string `json:"vendor_name"` // e.g., "PostgreSQL" + VendorVersion string `json:"vendor_version"` // e.g., "15.3" + DriverADBCVersion int64 `json:"driver_adbc_version"` // ADBC API version number + LibraryInfo map[string]string `json:"library_info"` // Additional library versions, protocol info, etc. +} + +// GetDriverInfo 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 GetDriverInfo(ctx context.Context, cnxn Connection) (DriverInfo, error) { + stream, err := cnxn.GetInfo(ctx, []InfoCode{ Review Comment: Maybe just omit the list of info codes? This should be equivalent to "all supported info" -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org