Package hive is an auto-generated package for the BigLake API.
The BigLake API provides access to BigLake Metastore, a serverless, fully managed, and highly available metastore for open-source data that can be used for querying Apache Iceberg tables in BigQuery.
NOTE : This package is in beta . It is not stable , and may be subject to changes .
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview . Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/biglake/hive/apiv1beta@latest ctx := context . Background () // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c , err := hive . NewHiveMetastoreClient ( ctx ) if err != nil { // TODO: Handle error. } defer c . Close ()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req := & hivepb . BatchCreatePartitionsRequest { // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#BatchCreatePartitionsRequest. } resp , err := c . BatchCreatePartitions ( ctx , req ) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewHiveMetastoreClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
func
DefaultAuthScopes
()
[]
string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
HiveCatalogIterator
type
HiveCatalogIterator
struct
{
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response
interface
{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch
func
(
pageSize
int
,
pageToken
string
)
(
results
[]
*
hivepb
.
HiveCatalog
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
HiveCatalogIterator manages a stream of *hivepb.HiveCatalog.
func (*HiveCatalogIterator) All
func
(
it
*
HiveCatalogIterator
)
All
()
iter
.
Seq2
[
*
hivepb
.
HiveCatalog
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*HiveCatalogIterator) Next
func
(
it
*
HiveCatalogIterator
)
Next
()
(
*
hivepb
.
HiveCatalog
,
error
)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*HiveCatalogIterator) PageInfo
func
(
it
*
HiveCatalogIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
HiveDatabaseIterator
type
HiveDatabaseIterator
struct
{
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response
interface
{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch
func
(
pageSize
int
,
pageToken
string
)
(
results
[]
*
hivepb
.
HiveDatabase
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
HiveDatabaseIterator manages a stream of *hivepb.HiveDatabase.
func (*HiveDatabaseIterator) All
func
(
it
*
HiveDatabaseIterator
)
All
()
iter
.
Seq2
[
*
hivepb
.
HiveDatabase
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*HiveDatabaseIterator) Next
func
(
it
*
HiveDatabaseIterator
)
Next
()
(
*
hivepb
.
HiveDatabase
,
error
)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*HiveDatabaseIterator) PageInfo
func
(
it
*
HiveDatabaseIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
HiveMetastoreCallOptions
type
HiveMetastoreCallOptions
struct
{
CreateHiveCatalog
[]
gax
.
CallOption
GetHiveCatalog
[]
gax
.
CallOption
ListHiveCatalogs
[]
gax
.
CallOption
UpdateHiveCatalog
[]
gax
.
CallOption
DeleteHiveCatalog
[]
gax
.
CallOption
CreateHiveDatabase
[]
gax
.
CallOption
GetHiveDatabase
[]
gax
.
CallOption
ListHiveDatabases
[]
gax
.
CallOption
UpdateHiveDatabase
[]
gax
.
CallOption
DeleteHiveDatabase
[]
gax
.
CallOption
CreateHiveTable
[]
gax
.
CallOption
GetHiveTable
[]
gax
.
CallOption
ListHiveTables
[]
gax
.
CallOption
UpdateHiveTable
[]
gax
.
CallOption
DeleteHiveTable
[]
gax
.
CallOption
BatchCreatePartitions
[]
gax
.
CallOption
BatchDeletePartitions
[]
gax
.
CallOption
BatchUpdatePartitions
[]
gax
.
CallOption
ListPartitions
[]
gax
.
CallOption
}
HiveMetastoreCallOptions contains the retry settings for each method of HiveMetastoreClient.
HiveMetastoreClient
type
HiveMetastoreClient
struct
{
// The call options for this service.
CallOptions
*
HiveMetastoreCallOptions
// contains filtered or unexported fields
}
HiveMetastoreClient is a client for interacting with BigLake API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Hive Metastore Service is a biglake service that allows users to manage their external Hive catalogs. Full API compatibility with OSS Hive Metastore APIs is not supported. The methods match the Hive Metastore API spec mostly except for a few exceptions. These include listing resources with pattern, environment context which are combined in a single List API, return of ListResponse object instead of a list of resources, transactions, locks, etc.
The BigLake Hive Metastore API defines the following resources:
A collection of Google Cloud projects: /projects/*
Each project has a collection of catalogs: /catalogs/*
Each catalog has a collection of databases: /databases/*
Each database has a collection of tables: /tables/*
func NewHiveMetastoreClient
func
NewHiveMetastoreClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
HiveMetastoreClient
,
error
)
NewHiveMetastoreClient creates a new hive metastore service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Hive Metastore Service is a biglake service that allows users to manage their external Hive catalogs. Full API compatibility with OSS Hive Metastore APIs is not supported. The methods match the Hive Metastore API spec mostly except for a few exceptions. These include listing resources with pattern, environment context which are combined in a single List API, return of ListResponse object instead of a list of resources, transactions, locks, etc.
The BigLake Hive Metastore API defines the following resources:
A collection of Google Cloud projects: /projects/*
Each project has a collection of catalogs: /catalogs/*
Each catalog has a collection of databases: /databases/*
Each database has a collection of tables: /tables/*
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func NewHiveMetastoreRESTClient
func
NewHiveMetastoreRESTClient
(
ctx
context
.
Context
,
opts
...
option
.
ClientOption
)
(
*
HiveMetastoreClient
,
error
)
NewHiveMetastoreRESTClient creates a new hive metastore service rest client.
Hive Metastore Service is a biglake service that allows users to manage their external Hive catalogs. Full API compatibility with OSS Hive Metastore APIs is not supported. The methods match the Hive Metastore API spec mostly except for a few exceptions. These include listing resources with pattern, environment context which are combined in a single List API, return of ListResponse object instead of a list of resources, transactions, locks, etc.
The BigLake Hive Metastore API defines the following resources:
A collection of Google Cloud projects: /projects/*
Each project has a collection of catalogs: /catalogs/*
Each catalog has a collection of databases: /databases/*
Each database has a collection of tables: /tables/*
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreRESTClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
// TODO: Use client.
_
=
c
}
func (*HiveMetastoreClient) BatchCreatePartitions
func
(
c
*
HiveMetastoreClient
)
BatchCreatePartitions
(
ctx
context
.
Context
,
req
*
hivepb
.
BatchCreatePartitionsRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
BatchCreatePartitionsResponse
,
error
)
BatchCreatePartitions adds partitions to a table.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
BatchCreatePartitionsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#BatchCreatePartitionsRequest.
}
resp
,
err
:=
c
.
BatchCreatePartitions
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) BatchDeletePartitions
func
(
c
*
HiveMetastoreClient
)
BatchDeletePartitions
(
ctx
context
.
Context
,
req
*
hivepb
.
BatchDeletePartitionsRequest
,
opts
...
gax
.
CallOption
)
error
BatchDeletePartitions deletes partitions from a table.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
BatchDeletePartitionsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#BatchDeletePartitionsRequest.
}
err
=
c
.
BatchDeletePartitions
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*HiveMetastoreClient) BatchUpdatePartitions
func
(
c
*
HiveMetastoreClient
)
BatchUpdatePartitions
(
ctx
context
.
Context
,
req
*
hivepb
.
BatchUpdatePartitionsRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
BatchUpdatePartitionsResponse
,
error
)
BatchUpdatePartitions updates partitions in a table.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
BatchUpdatePartitionsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#BatchUpdatePartitionsRequest.
}
resp
,
err
:=
c
.
BatchUpdatePartitions
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) Close
func
(
c
*
HiveMetastoreClient
)
Close
()
error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*HiveMetastoreClient) Connection (deprecated)
func
(
c
*
HiveMetastoreClient
)
Connection
()
*
grpc
.
ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*HiveMetastoreClient) CreateHiveCatalog
func
(
c
*
HiveMetastoreClient
)
CreateHiveCatalog
(
ctx
context
.
Context
,
req
*
hivepb
.
CreateHiveCatalogRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveCatalog
,
error
)
CreateHiveCatalog creates a new hive catalog.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
CreateHiveCatalogRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#CreateHiveCatalogRequest.
}
resp
,
err
:=
c
.
CreateHiveCatalog
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) CreateHiveDatabase
func
(
c
*
HiveMetastoreClient
)
CreateHiveDatabase
(
ctx
context
.
Context
,
req
*
hivepb
.
CreateHiveDatabaseRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveDatabase
,
error
)
CreateHiveDatabase creates a new database.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
CreateHiveDatabaseRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#CreateHiveDatabaseRequest.
}
resp
,
err
:=
c
.
CreateHiveDatabase
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) CreateHiveTable
func
(
c
*
HiveMetastoreClient
)
CreateHiveTable
(
ctx
context
.
Context
,
req
*
hivepb
.
CreateHiveTableRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveTable
,
error
)
CreateHiveTable creates a new hive table.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
CreateHiveTableRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#CreateHiveTableRequest.
}
resp
,
err
:=
c
.
CreateHiveTable
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) DeleteHiveCatalog
func
(
c
*
HiveMetastoreClient
)
DeleteHiveCatalog
(
ctx
context
.
Context
,
req
*
hivepb
.
DeleteHiveCatalogRequest
,
opts
...
gax
.
CallOption
)
error
DeleteHiveCatalog deletes an existing catalog specified by the catalog ID. Delete will fail if the catalog is not empty.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
DeleteHiveCatalogRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#DeleteHiveCatalogRequest.
}
err
=
c
.
DeleteHiveCatalog
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*HiveMetastoreClient) DeleteHiveDatabase
func
(
c
*
HiveMetastoreClient
)
DeleteHiveDatabase
(
ctx
context
.
Context
,
req
*
hivepb
.
DeleteHiveDatabaseRequest
,
opts
...
gax
.
CallOption
)
error
DeleteHiveDatabase deletes an existing database specified by the database name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
DeleteHiveDatabaseRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#DeleteHiveDatabaseRequest.
}
err
=
c
.
DeleteHiveDatabase
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*HiveMetastoreClient) DeleteHiveTable
func
(
c
*
HiveMetastoreClient
)
DeleteHiveTable
(
ctx
context
.
Context
,
req
*
hivepb
.
DeleteHiveTableRequest
,
opts
...
gax
.
CallOption
)
error
DeleteHiveTable deletes an existing table specified by the table name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
DeleteHiveTableRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#DeleteHiveTableRequest.
}
err
=
c
.
DeleteHiveTable
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
}
func (*HiveMetastoreClient) GetHiveCatalog
func
(
c
*
HiveMetastoreClient
)
GetHiveCatalog
(
ctx
context
.
Context
,
req
*
hivepb
.
GetHiveCatalogRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveCatalog
,
error
)
GetHiveCatalog gets the catalog specified by the resource name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
GetHiveCatalogRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#GetHiveCatalogRequest.
}
resp
,
err
:=
c
.
GetHiveCatalog
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) GetHiveDatabase
func
(
c
*
HiveMetastoreClient
)
GetHiveDatabase
(
ctx
context
.
Context
,
req
*
hivepb
.
GetHiveDatabaseRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveDatabase
,
error
)
GetHiveDatabase gets the database specified by the resource name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
GetHiveDatabaseRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#GetHiveDatabaseRequest.
}
resp
,
err
:=
c
.
GetHiveDatabase
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) GetHiveTable
func
(
c
*
HiveMetastoreClient
)
GetHiveTable
(
ctx
context
.
Context
,
req
*
hivepb
.
GetHiveTableRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveTable
,
error
)
GetHiveTable gets the table specified by the resource name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
GetHiveTableRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#GetHiveTableRequest.
}
resp
,
err
:=
c
.
GetHiveTable
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) ListHiveCatalogs
func
(
c
*
HiveMetastoreClient
)
ListHiveCatalogs
(
ctx
context
.
Context
,
req
*
hivepb
.
ListHiveCatalogsRequest
,
opts
...
gax
.
CallOption
)
*
HiveCatalogIterator
ListHiveCatalogs list all catalogs in a specified project.
Examples
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveCatalogsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveCatalogsRequest.
}
it
:=
c
.
ListHiveCatalogs
(
ctx
,
req
)
for
{
resp
,
err
:=
it
.
Next
()
if
err
==
iterator
.
Done
{
break
}
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_
=
it
.
Response
.(
*
hivepb
.
ListHiveCatalogsResponse
)
}
}
all
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveCatalogsRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveCatalogsRequest.
}
for
resp
,
err
:=
range
c
.
ListHiveCatalogs
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*HiveMetastoreClient) ListHiveDatabases
func
(
c
*
HiveMetastoreClient
)
ListHiveDatabases
(
ctx
context
.
Context
,
req
*
hivepb
.
ListHiveDatabasesRequest
,
opts
...
gax
.
CallOption
)
*
HiveDatabaseIterator
ListHiveDatabases list all databases in a specified catalog.
Examples
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveDatabasesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveDatabasesRequest.
}
it
:=
c
.
ListHiveDatabases
(
ctx
,
req
)
for
{
resp
,
err
:=
it
.
Next
()
if
err
==
iterator
.
Done
{
break
}
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_
=
it
.
Response
.(
*
hivepb
.
ListHiveDatabasesResponse
)
}
}
all
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveDatabasesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveDatabasesRequest.
}
for
resp
,
err
:=
range
c
.
ListHiveDatabases
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*HiveMetastoreClient) ListHiveTables
func
(
c
*
HiveMetastoreClient
)
ListHiveTables
(
ctx
context
.
Context
,
req
*
hivepb
.
ListHiveTablesRequest
,
opts
...
gax
.
CallOption
)
*
HiveTableIterator
ListHiveTables list all hive tables in a specified project under the hive catalog and database.
Examples
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
"google.golang.org/api/iterator"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveTablesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveTablesRequest.
}
it
:=
c
.
ListHiveTables
(
ctx
,
req
)
for
{
resp
,
err
:=
it
.
Next
()
if
err
==
iterator
.
Done
{
break
}
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_
=
it
.
Response
.(
*
hivepb
.
ListHiveTablesResponse
)
}
}
all
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
ListHiveTablesRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#ListHiveTablesRequest.
}
for
resp
,
err
:=
range
c
.
ListHiveTables
(
ctx
,
req
).
All
()
{
if
err
!=
nil
{
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_
=
resp
}
}
func (*HiveMetastoreClient) ListPartitions
func
(
c
*
HiveMetastoreClient
)
ListPartitions
(
ctx
context
.
Context
,
req
*
hivepb
.
ListPartitionsRequest
,
opts
...
gax
.
CallOption
)
(
hivepb
.
HiveMetastoreService_ListPartitionsClient
,
error
)
ListPartitions streams list of partitions from a table.
func (*HiveMetastoreClient) UpdateHiveCatalog
func
(
c
*
HiveMetastoreClient
)
UpdateHiveCatalog
(
ctx
context
.
Context
,
req
*
hivepb
.
UpdateHiveCatalogRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveCatalog
,
error
)
UpdateHiveCatalog updates an existing catalog.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
UpdateHiveCatalogRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#UpdateHiveCatalogRequest.
}
resp
,
err
:=
c
.
UpdateHiveCatalog
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) UpdateHiveDatabase
func
(
c
*
HiveMetastoreClient
)
UpdateHiveDatabase
(
ctx
context
.
Context
,
req
*
hivepb
.
UpdateHiveDatabaseRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveDatabase
,
error
)
UpdateHiveDatabase updates an existing database specified by the database name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
UpdateHiveDatabaseRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#UpdateHiveDatabaseRequest.
}
resp
,
err
:=
c
.
UpdateHiveDatabase
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
func (*HiveMetastoreClient) UpdateHiveTable
func
(
c
*
HiveMetastoreClient
)
UpdateHiveTable
(
ctx
context
.
Context
,
req
*
hivepb
.
UpdateHiveTableRequest
,
opts
...
gax
.
CallOption
)
(
*
hivepb
.
HiveTable
,
error
)
UpdateHiveTable updates an existing table specified by the table name.
Example
package
main
import
(
"context"
hive
"cloud.google.com/go/biglake/hive/apiv1beta"
hivepb
"cloud.google.com/go/biglake/hive/apiv1beta/hivepb"
)
func
main
()
{
ctx
:=
context
.
Background
()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c
,
err
:=
hive
.
NewHiveMetastoreClient
(
ctx
)
if
err
!=
nil
{
// TODO: Handle error.
}
defer
c
.
Close
()
req
:=
& hivepb
.
UpdateHiveTableRequest
{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/biglake/hive/apiv1beta/hivepb#UpdateHiveTableRequest.
}
resp
,
err
:=
c
.
UpdateHiveTable
(
ctx
,
req
)
if
err
!=
nil
{
// TODO: Handle error.
}
// TODO: Use resp.
_
=
resp
}
HiveTableIterator
type
HiveTableIterator
struct
{
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response
interface
{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch
func
(
pageSize
int
,
pageToken
string
)
(
results
[]
*
hivepb
.
HiveTable
,
nextPageToken
string
,
err
error
)
// contains filtered or unexported fields
}
HiveTableIterator manages a stream of *hivepb.HiveTable.
func (*HiveTableIterator) All
func
(
it
*
HiveTableIterator
)
All
()
iter
.
Seq2
[
*
hivepb
.
HiveTable
,
error
]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*HiveTableIterator) Next
func
(
it
*
HiveTableIterator
)
Next
()
(
*
hivepb
.
HiveTable
,
error
)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*HiveTableIterator) PageInfo
func
(
it
*
HiveTableIterator
)
PageInfo
()
*
iterator
.
PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

