# README
Feast Golang SDK
The Feast golang SDK currently only supports retrieval from online stores.
Quickstart
import (
"context"
feast "github.com/feast-dev/feast/sdk/go"
)
func main() {
cli, err := feast.NewGrpcClient("localhost", 6565)
if err != nil {
panic(err)
}
ctx := context.Background()
req := feast.OnlineFeaturesRequest{
Features: []string{"my_project_1/feature1", "my_project_2/feature1", "my_project_4/feature3", "feature2", "feature2"},
Entities: []feast.Row{
{"entity1": feast.Int64Val(1), "entity2": feast.StrVal("bob")},
{"entity1": feast.Int64Val(1), "entity2": feast.StrVal("annie")},
{"entity1": feast.Int64Val(1), "entity2": feast.StrVal("jane")},
},
Project: "my_project_3",
}
resp, err := cli.GetOnlineFeatures(ctx, &req)
if err != nil {
panic(err)
}
// returns a list of rows (map[string]featureValue)
out := resp.Rows()
}
If all features retrieved are of a single type, Feast provides convenience functions to retrieve your features as a vector of feature values:
arr, err := resp.Int64Arrays(
[]string{"my_project_1/feature1",
"my_project_2/feature1",
"my_project_4/feature3",
"feature2",
"feature2"}, // order of features
[]int64{1,2,3,4,5}) // fillNa values
# Functions
BoolVal is a bool type feast value.
BytesVal is a bytes type feast value.
DoubleVal is a float64 type feast value.
FloatVal is a float32 type feast value.
Int32Val is a int32 type feast value.
Int64Val is a int64 type feast value.
Creates a new Google Credential which obtains credentials from Application Default Credentials.
NewGrpcClient constructs a client that can interact via grpc with the feast serving instance at the given host:port.
Creates a new OAuth credential witch obtains credentials by making a client credentials request to an OAuth endpoint.
NewSecureGrpcClient constructs a secure client that uses security features (ie authentication).
NewSecureGrpcClientWithDialOptions constructs a secure client that uses security features (ie authentication) along with custom grpc dial options.
Create a Static Authentication Provider that provides a static token.
StrVal is a string type feast value.
# Variables
ErrFeatureNotFound indicates that the requested feature was not found in the response.
ErrInvalidFeatureRef indicates that the user has provided a feature reference with the wrong structure or contents.
ErrLengthMismatch indicates that the number of values returned is not the same as the number of values requested.
ErrTypeMismatch indicates that the there was a type mismatch in the returned values.
# Structs
Credential provides OIDC ID tokens used when authenticating with Feast.
GrpcClient is a grpc client for feast serving.
OnlineFeaturesRequest wrapper on feast.serving.GetOnlineFeaturesRequestV2.
OnlineFeaturesResponse is a wrapper around serving.GetOnlineFeaturesResponseV2.
SecurityConfig wraps security config for GrpcClient.
# Interfaces
Client is a feast serving client.
# Type aliases
Row is a map of fields.