RefreshExternalCollection()
This operation scans the data files in the schema-defined external storage and generates metadata files that record their mapping relationship to those data files.
func (c *Client) RefreshExternalCollection(ctx context.Context, option RefreshExternalCollectionOption, callOptions ...grpc.CallOption) (*RefreshExternalCollectionResult, error)
Request Syntax
option := client.NewRefreshExternalCollectionOption(collectionName).
WithExternalSource(externalSource string).
WithExternalSpec(externalSpec string).
WithDbName(dbName string)
result, err := client.RefreshExternalCollection(option)
PARAMETERS:
-
collectionName (string) -
The name of an existing external collection.
BUILDER METHODS:
-
WithExternalSource(externalSource string)This sets the source data URI, which should be the name of an accessible external volume..
-
WithExternalSpec(externalSpec string)The external source specifications, which are a set of secondary parameters:
-
format (string) -
The format of the target source data files.
Possible values are
parquet,vortex,lance-table, andiceberg-table.
-
-
WithDbName(dbName string)The name of the database to which the target external collection belongs.
RETURN TYPE:
*RefreshExternalCollectionResult
RETURNS:
A type struct of the following shape.
type RefreshExternalCollectionResult struct {
JobID int64
}
PARAMETERS:
-
JobID (int64) -
An integer that indicates an asynchronous job that has been created.
Examples
refreshResult, err := client.RefreshExternalCollection(ctx,
client.NewRefreshExternalCollectionOption("test_collection"))
jobID := refreshResult.JobID
for {
progress, _ := client.GetRefreshExternalCollectionProgress(ctx,
client.NewGetRefreshExternalCollectionProgressOption(jobID))
fmt.Printf("State: %s\n", progress.State)
if progress.State == entity.RefreshStateCompleted {
fmt.Println("Refresh completed!")
break
}
if progress.State == entity.RefreshStateFailed {
fmt.Printf("Refresh failed: %s\n", progress.Reason)
break
}
time.Sleep(2 * time.Second)
}