schema

package
v0.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClickhouseDDLTimeout is default value of distributed_ddl_task_timeout CH setting, used as fallback
	ClickhouseDDLTimeout = 180
	// DDLTimeoutCorrection is added to DDL query timeout to have a chance to catch CH error, instead of ContextDeadlineExceeded
	DDLTimeoutCorrection  = 2
	ClickhouseReadTimeout = 30 * time.Second
)
View Source
const (
	MaterializedView             = EngineType("MaterializedView")
	MergeTree                    = EngineType("MergeTree")
	ReplacingMergeTree           = EngineType("ReplacingMergeTree")
	SummingMergeTree             = EngineType("SummingMergeTree")
	AggregatingMergeTree         = EngineType("AggregatingMergeTree")
	CollapsingMergeTree          = EngineType("CollapsingMergeTree")
	VersionedCollapsingMergeTree = EngineType("VersionedCollapsingMergeTree")
	GraphiteMergeTree            = EngineType("GraphiteMergeTree")

	ReplicatedMergeTree                    = EngineType("ReplicatedMergeTree")
	ReplicatedReplacingMergeTree           = EngineType("ReplicatedReplacingMergeTree")
	ReplicatedSummingMergeTree             = EngineType("ReplicatedSummingMergeTree")
	ReplicatedAggregatingMergeTree         = EngineType("ReplicatedAggregatingMergeTree")
	ReplicatedCollapsingMergeTree          = EngineType("ReplicatedCollapsingMergeTree")
	ReplicatedVersionedCollapsingMergeTree = EngineType("ReplicatedVersionedCollapsingMergeTree")
	ReplicatedGraphiteMergeTree            = EngineType("ReplicatedGraphiteMergeTree")

	// SharedMergeTree family is available on ch.inc exclusively
	SharedMergeTree                    = EngineType("SharedMergeTree")
	SharedReplacingMergeTree           = EngineType("SharedReplacingMergeTree")
	SharedSummingMergeTree             = EngineType("SharedSummingMergeTree")
	SharedAggregatingMergeTree         = EngineType("SharedAggregatingMergeTree")
	SharedCollapsingMergeTree          = EngineType("SharedCollapsingMergeTree")
	SharedVersionedCollapsingMergeTree = EngineType("SharedVersionedCollapsingMergeTree")
	SharedGraphiteMergeTree            = EngineType("SharedGraphiteMergeTree")
)

Variables

This section is empty.

Functions

func DescribeTable

func DescribeTable(db *sql.DB, database, table string, knownPrimaryKeys []string) (*abstract.TableSchema, error)

func GetBaseEngineType

func GetBaseEngineType(engine string) (string, error)

func GetReplicatedEngineType

func GetReplicatedEngineType(engine string) (string, error)

func GetReplicatedFromSharedEngineType

func GetReplicatedFromSharedEngineType(engine string) (string, error)

func IsDistributedDDL

func IsDistributedDDL(sql string) bool

func IsMergeTreeFamily

func IsMergeTreeFamily(engine string) bool

func IsReplicatedEngineType

func IsReplicatedEngineType(engine string) bool

func IsSharedEngineType

func IsSharedEngineType(engine string) bool

func MakeDistributedDDL

func MakeDistributedDDL(sql, cluster string) string

func ReplaceCluster

func ReplaceCluster(sql, cluster string) string

func SetAltName

func SetAltName(ddl string, targetDB string, names map[string]string) string

func SetIfNotExists

func SetIfNotExists(sql string) string

func SetReplicatedEngine

func SetReplicatedEngine(sql, baseEngine, db, table string) (string, error)

func SetTargetDatabase

func SetTargetDatabase(ddl string, sourceDB, targetDB string) string

func TryFindNextStatement

func TryFindNextStatement(sql string, from int) int

Types

type DDLBatch

type DDLBatch struct {
	DDLs []TableDDL
	// contains filtered or unexported fields
}

func NewDDLBatch

func NewDDLBatch(ddls []TableDDL) *DDLBatch

func (*DDLBatch) Count

func (b *DDLBatch) Count() int

func (*DDLBatch) Event

func (b *DDLBatch) Event() (base.Event, error)

func (*DDLBatch) Next

func (b *DDLBatch) Next() bool

func (*DDLBatch) Size

func (b *DDLBatch) Size() int

type DDLLoaders

type DDLLoaders interface {
	LoadTablesDDL(tables []abstract.TableID) ([]TableDDL, error)
}

type DDLSource

type DDLSource struct {
	// contains filtered or unexported fields
}

func NewDDLSource

func NewDDLSource(logger log.Logger, part base.DataObjectPart, ch abstract.Storage) *DDLSource

func (*DDLSource) Running

func (p *DDLSource) Running() bool

func (*DDLSource) Start

func (p *DDLSource) Start(ctx context.Context, target base.EventTarget) error

func (*DDLSource) Stop

func (p *DDLSource) Stop() error

type Engine

type Engine interface {
	IsEngine()
	String() string
}

type EngineType

type EngineType string

type MergeTreeFamilyEngine

type MergeTreeFamilyEngine struct {
	Type   EngineType
	Params []string
}

func GetEngine

func GetEngine(engineStrSQL string) (engine *MergeTreeFamilyEngine, engineStr string, err error)

func ParseMergeTreeFamilyEngine

func ParseMergeTreeFamilyEngine(sql string) (*MergeTreeFamilyEngine, string, error)

func (*MergeTreeFamilyEngine) IsEngine

func (mt *MergeTreeFamilyEngine) IsEngine()

func (*MergeTreeFamilyEngine) String

func (mt *MergeTreeFamilyEngine) String() string

type ReplicatedEngine

type ReplicatedEngine struct {
	BaseEngine MergeTreeFamilyEngine
	Type       EngineType
	Params     ReplicatedEngineParams
}

func ConvertToReplicated

func ConvertToReplicated(engine *MergeTreeFamilyEngine) (ReplicatedEngine, error)

func NewReplicatedEngine

func NewReplicatedEngine(baseEngine *MergeTreeFamilyEngine, db, table string) (ReplicatedEngine, error)

func (*ReplicatedEngine) IsEngine

func (re *ReplicatedEngine) IsEngine()

func (*ReplicatedEngine) String

func (re *ReplicatedEngine) String() string

type ReplicatedEngineParams

type ReplicatedEngineParams struct {
	ZooPath   string
	Replica   string
	TableName string
}

func ParseReplicatedEngineParams

func ParseReplicatedEngineParams(zooPathArg, replicaArg string) (ReplicatedEngineParams, error)

type TableDDL

type TableDDL struct {
	// contains filtered or unexported fields
}

func NewTableDDL

func NewTableDDL(tableID abstract.TableID, sql, engine string) TableDDL

func (TableDDL) Engine

func (t TableDDL) Engine() string

func (TableDDL) IsMatView

func (t TableDDL) IsMatView() bool

func (TableDDL) SQL

func (t TableDDL) SQL() string

func (TableDDL) TableID

func (t TableDDL) TableID() abstract.TableID

func (TableDDL) ToChangeItem

func (t TableDDL) ToChangeItem() abstract.ChangeItem

Jump to

Keyboard shortcuts

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