PgBeam
PgBeam Docs
SchemaAnnotations

PutSchemaAnnotation

Create or replace a schema annotation

Attaches an operator-written description to a table (omit column_name) or a column. Keyed by (schema_name, table_name, column_name); an existing annotation with the same key is replaced.

Usage

result, err := client.Schemaannotations.PutSchemaAnnotation(ctx, "prj_xxx", pgbeam.SchemaAnnotationInput{
    TableName: "users",
    Description: "Primary customer account. One row per signed-up user.",
  })

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
reqpgbeam.SchemaAnnotationInputYesRequest body
req.SchemaName*stringNoOptional schema. Null or empty matches the unqualified form.
req.TableNamestringYesRelation (table or view) the annotation describes.
req.ColumnName*stringNoOptional column. Null describes the table itself.
req.DescriptionstringYesThe operator-written description text.

Response

(*pgbeam.SchemaAnnotation, error): the created or updated annotation.

Example

import pgbeam "go.pgbeam.com/sdk"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Schemaannotations.PutSchemaAnnotation(ctx, "prj_xxx", pgbeam.SchemaAnnotationInput{
    SchemaName: "public",
    TableName: "users",
    ColumnName: "email",
    Description: "Primary customer account. One row per signed-up user.",
  })
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page