tables

package
v0.0.0-...-63319d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableTypeOBS  = "OBS"
	TableTypeDLI  = "DLI"
	TableTypeVIEW = "VIEW"
)

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

This section is empty.

Types

type Column

type Column struct {
	ColumnName        string `json:"column_name"`
	Type              string `json:"type"`
	Description       string `json:"description"`
	IsPartitionColumn bool   `json:"is_partition_column"`
}

type ColumnOpts

type ColumnOpts struct {
	ColumnName        string `json:"column_name" required:"true"`
	Type              string `json:"type" required:"true"`
	Description       string `json:"description,omitempty"`
	IsPartitionColumn *bool  `json:"is_partition_column,omitempty"`
}

type CommonResp

type CommonResp struct {
	IsSuccess bool   `json:"is_success"`
	Message   string `json:"message"`
}

func Create

func Create(c *golangsdk.ServiceClient, databaseName string, opts CreateTableOpts) (*CommonResp, error)

func UpdateOwner

func UpdateOwner(c *golangsdk.ServiceClient, databaseName string, tableName string, opts UpdateOwnerOpts) (*CommonResp, error)

type CreateTableOpts

type CreateTableOpts struct {
	TableName string `json:"table_name" required:"true"`
	// Data storage location. OBS tables,DLI tables and view are available.
	DataLocation    string       `json:"data_location" required:"true"`
	Description     string       `json:"description,omitempty"`
	Columns         []ColumnOpts `json:"columns" required:"true"`
	SelectStatement string       `json:"select_statement,omitempty"`
	// Type of the data to be added to the OBS table. The options: Parquet, ORC, CSV, JSON, Carbon, and Avro.
	DataType string `json:"data_type,omitempty"`
	// Storage path of data in the new OBS table, which must be a path on OBS and must begin with obs. start with s3a
	DataPath string `json:"data_path,omitempty"`
	// Whether the table header is included in the OBS table data. Only data in CSV files has this attribute.
	WithColumnHeader *bool `json:"with_column_header,omitempty"`
	// User-defined data delimiter. Only data in CSV files has this attribute.
	Delimiter string `json:"delimiter,omitempty"`
	// User-defined reference character. Double quotation marks ("\") are used by default. Only data in CSV files
	// has this attribute.
	QuoteChar string `json:"quote_char,omitempty"`
	// User-defined escape character. Backslashes (\\) are used by default. Only data in CSV files has this attribute.
	EscapeChar string `json:"escape_char,omitempty"`
	// User-defined date type. yyyy-MM-dd is used by default. Only data in CSV and JSON files has this attribute.
	DateFormat string `json:"date_format,omitempty"`
	// User-defined timestamp type. yyyy-MM-dd HH:mm:ss is used by default. Only data in CSV and JSON files has
	// this attribute.
	TimestampFormat string `json:"timestamp_format,omitempty"`
}

type DeleteResp

type DeleteResp struct {
	CommonResp
	JobMode string `json:"job_mode"`
}

func Delete

func Delete(c *golangsdk.ServiceClient, databaseName string, tableName string, asyncFlag bool) (*DeleteResp, error)

type ListOpts

type ListOpts struct {
	Keyword          string `q:"keyword"`
	WithDetail       *bool  `q:"with-detail"`
	PageSize         *int   `q:"page-size"`
	CurrentPage      *int   `q:"current-page"`
	WithPriv         *bool  `q:"with-priv"`
	TableType        string `q:"table-type"`
	DatasourceType   string `q:"table-type"`
	WithoutTablemeta *bool  `q:"table-type"`
}

type ListResp

type ListResp struct {
	IsSuccess  bool         `json:"is_success"`
	Message    string       `json:"message"`
	TableCount int          `json:"table_count"`
	Tables     []Table4List `json:"tables"`
}

func List

func List(c *golangsdk.ServiceClient, databaseName string, opts ListOpts) (*ListResp, error)

type Partition

type Partition struct {
	PartitionName  string   `json:"partition_name"`
	CreateTime     int      `json:"create_time"`
	LastAccessTime int      `json:"last_access_time"`
	Locations      []string `json:"locations"`
	LastDdlTime    int      `json:"last_ddl_time"`
	NumRows        int      `json:"num_rows"`
	NumFiles       int      `json:"num_files"`
	TotalSize      int      `json:"total_size"`
}

type PartitionsInfo

type PartitionsInfo struct {
	TotalCount     int         `json:"total_count"`
	PartitionInfos []Partition `json:"partition_infos"`
}

type PartitionsOpts

type PartitionsOpts struct {
	// default:100
	Limit  int `q:"limit"`
	Offset int `q:"offset"`
}

type PartitionsResp

type PartitionsResp struct {
	IsSuccess  bool           `json:"is_success"`
	Message    string         `json:"message"`
	Partitions PartitionsInfo `json:"partitions"`
}

func Partitions

func Partitions(c *golangsdk.ServiceClient, databaseName string, tableName string, opts PartitionsOpts) (*PartitionsResp, error)

type Table

type Table struct {
	IsSuccess         bool                     `json:"is_success"`
	Message           string                   `json:"message"`
	ColumnCount       int                      `json:"column_count"`
	Columns           []Column                 `json:"columns"`
	TableType         string                   `json:"table_type"`
	DataType          string                   `json:"data_type"`
	DataLocation      string                   `json:"data_location"`
	StorageProperties []map[string]interface{} `json:"storage_properties"`
	TableComment      string                   `json:"table_comment"`
	CreateTableSql    string                   `json:"create_table_sql"`
}

func Get

func Get(c *golangsdk.ServiceClient, databaseName string, tableName string) (*Table, error)

type Table4List

type Table4List struct {
	CreateTime       int    `json:"create_time"`
	DataType         string `json:"data_type"`
	DataLocation     string `json:"data_location"`
	LastAccessTime   int    `json:"last_access_time"`
	Location         string `json:"location"`
	Owner            string `json:"owner"`
	TableName        string `json:"table_name"`
	TableSize        int    `json:"table_size"`
	PartitionColumns string `json:"partition_columns"`
	PageSize         int    `json:"page-size"`
	CurrentPage      int    `json:"current-page"`
	// Type of a table.
	// EXTERNAL: Indicates an OBS table.
	// MANAGED: Indicates a DLI table.
	// VIEW: Indicates a view.
	TableType string `json:"table_type"`
}

If with-detail is set to false in the URI, only values of tables-related parameters data_location, table_name, and table_type are returned.

type UpdateOwnerOpts

type UpdateOwnerOpts struct {
	NewOwner string `json:"new_owner" required:"true"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL