clickhouse

package
v0.61.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIntervalToMillis added in v0.52.0

func ParseIntervalToMillis(s string) (int64, bool)

ParseIntervalToMillis parses a ClickHouse INTERVAL string into milliseconds. ClickHouse currently returns INTERVALs as strings in the format "1 Month", "2 Minutes", etc. This function follows our current policy of treating months as 30 days when converting to milliseconds.

Types

type Connection added in v0.60.7

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

func (*Connection) AsAI added in v0.60.7

func (c *Connection) AsAI(instanceID string) (drivers.AIService, bool)

AsAI implements drivers.Handle.

func (*Connection) AsAdmin added in v0.60.7

func (c *Connection) AsAdmin(instanceID string) (drivers.AdminService, bool)

AsAdmin implements drivers.Handle.

func (*Connection) AsCatalogStore added in v0.60.7

func (c *Connection) AsCatalogStore(instanceID string) (drivers.CatalogStore, bool)

Catalog implements drivers.Connection.

func (*Connection) AsFileStore added in v0.60.7

func (c *Connection) AsFileStore() (drivers.FileStore, bool)

AsFileStore implements drivers.Connection.

func (*Connection) AsModelExecutor added in v0.60.7

func (c *Connection) AsModelExecutor(instanceID string, opts *drivers.ModelExecutorOptions) (drivers.ModelExecutor, bool)

AsModelExecutor implements drivers.Handle.

func (*Connection) AsModelManager added in v0.60.7

func (c *Connection) AsModelManager(instanceID string) (drivers.ModelManager, bool)

AsModelManager implements drivers.Handle.

func (*Connection) AsNotifier added in v0.60.7

func (c *Connection) AsNotifier(properties map[string]any) (drivers.Notifier, error)

AsNotifier implements drivers.Connection.

func (*Connection) AsOLAP added in v0.60.7

func (c *Connection) AsOLAP(instanceID string) (drivers.OLAPStore, bool)

OLAP implements drivers.Connection.

func (*Connection) AsObjectStore added in v0.60.7

func (c *Connection) AsObjectStore() (drivers.ObjectStore, bool)

AsObjectStore implements drivers.Connection.

func (*Connection) AsRegistry added in v0.60.7

func (c *Connection) AsRegistry() (drivers.RegistryStore, bool)

Registry implements drivers.Connection.

func (*Connection) AsRepoStore added in v0.60.7

func (c *Connection) AsRepoStore(instanceID string) (drivers.RepoStore, bool)

Repo implements drivers.Connection.

func (*Connection) AsWarehouse added in v0.60.7

func (c *Connection) AsWarehouse() (drivers.Warehouse, bool)

AsWarehouse implements drivers.Handle.

func (*Connection) Close added in v0.60.7

func (c *Connection) Close() error

Close implements drivers.Connection.

func (*Connection) Config added in v0.60.7

func (c *Connection) Config() map[string]any

Config used to open the Connection

func (*Connection) Delete added in v0.60.7

func (c *Connection) Delete(ctx context.Context, res *drivers.ModelResult) error

func (*Connection) Dialect added in v0.60.7

func (c *Connection) Dialect() drivers.Dialect

func (*Connection) Driver added in v0.60.7

func (c *Connection) Driver() string

Driver implements drivers.Connection.

func (*Connection) Exec added in v0.60.7

func (c *Connection) Exec(ctx context.Context, stmt *drivers.Statement) error

func (*Connection) Exists added in v0.60.7

func (c *Connection) Exists(ctx context.Context, res *drivers.ModelResult) (bool, error)

func (*Connection) InformationSchema added in v0.60.7

func (c *Connection) InformationSchema() drivers.InformationSchema

func (*Connection) MayBeScaledToZero added in v0.60.7

func (c *Connection) MayBeScaledToZero(ctx context.Context) bool

func (*Connection) MergePartitionResults added in v0.60.7

func (c *Connection) MergePartitionResults(a, b *drivers.ModelResult) (*drivers.ModelResult, error)

func (*Connection) Migrate added in v0.60.7

func (c *Connection) Migrate(ctx context.Context) (err error)

Migrate implements drivers.Connection.

func (*Connection) MigrationStatus added in v0.60.7

func (c *Connection) MigrationStatus(ctx context.Context) (current, desired int, err error)

MigrationStatus implements drivers.Connection.

func (*Connection) Ping added in v0.60.7

func (c *Connection) Ping(ctx context.Context) error

Ping implements drivers.Handle.

func (*Connection) Query added in v0.60.7

func (c *Connection) Query(ctx context.Context, stmt *drivers.Statement) (res *drivers.Result, outErr error)

func (*Connection) Rename added in v0.60.7

func (c *Connection) Rename(ctx context.Context, res *drivers.ModelResult, newName string, env *drivers.ModelEnv) (*drivers.ModelResult, error)

func (*Connection) WithConnection added in v0.60.7

func (c *Connection) WithConnection(ctx context.Context, priority int, fn drivers.WithConnectionFunc) error

type InsertTableOptions added in v0.60.7

type InsertTableOptions struct {
	Strategy drivers.IncrementalStrategy
}

type ModelInputProperties added in v0.45.0

type ModelInputProperties struct {
	SQL string `mapstructure:"sql"`
}

func (*ModelInputProperties) Validate added in v0.45.0

func (p *ModelInputProperties) Validate() error

type ModelOutputProperties added in v0.45.0

type ModelOutputProperties struct {
	Table               string                      `mapstructure:"table"`
	Materialize         *bool                       `mapstructure:"materialize"`
	UniqueKey           []string                    `mapstructure:"unique_key"`
	IncrementalStrategy drivers.IncrementalStrategy `mapstructure:"incremental_strategy"`
	// Typ to materialize the model into. Possible values include `TABLE`, `VIEW` or `DICTIONARY`. Optional.
	Typ string `mapstructure:"type"`
	// Columns sets the column names and data types. If unspecified these are detected from the select query by clickhouse.
	// It is also possible to set indexes with this property.
	// Example : (id UInt32, username varchar, email varchar, created_at datetime, INDEX idx1 username TYPE set(100) GRANULARITY 3)
	Columns string `mapstructure:"columns"`
	// EngineFull can be used to set the table parameters like engine, partition key in SQL format without setting individual properties.
	// It also allows creating dictionaries using a source.
	// Example:
	//  ENGINE = MergeTree
	//	PARTITION BY toYYYYMM(__time)
	//	ORDER BY __time
	//	TTL d + INTERVAL 1 MONTH DELETE
	EngineFull string `mapstructure:"engine_full"`
	// Engine sets the table engine. Default: MergeTree
	Engine string `mapstructure:"engine"`
	// OrderBy sets the order by clause. Default: tuple() for MergeTree and not set for other engines
	OrderBy string `mapstructure:"order_by"`
	// PartitionBy sets the partition by clause.
	PartitionBy string `mapstructure:"partition_by"`
	// PrimaryKey sets the primary key clause.
	PrimaryKey string `mapstructure:"primary_key"`
	// SampleBy sets the sample by clause.
	SampleBy string `mapstructure:"sample_by"`
	// TTL sets ttl for column and table.
	TTL string `mapstructure:"ttl"`
	// TableSettings set the table specific settings.
	TableSettings string `mapstructure:"table_settings"`
	// QuerySettings sets the settings clause used in insert/create table as select queries.
	QuerySettings string `mapstructure:"query_settings"`
	// DistributedSettings is table settings for distributed table.
	DistributedSettings string `mapstructure:"distributed.settings"`
	// DistributedShardingKey is the sharding key for distributed table.
	DistributedShardingKey string `mapstructure:"distributed.sharding_key"`
	// DictionarySourceUser is the user that case access the source dictionary table. Only used when typ is DICTIONARY.
	DictionarySourceUser string `mapstructure:"dictionary_source_user"`
	// DictionarySourcePassword is the password for the user that can access the source dictionary table. Only used when typ is DICTIONARY.
	DictionarySourcePassword string `mapstructure:"dictionary_source_password"`
}

func (*ModelOutputProperties) Validate added in v0.45.0

type ModelResultProperties added in v0.45.0

type ModelResultProperties struct {
	Table         string `mapstructure:"table"`
	View          bool   `mapstructure:"view"`
	UsedModelName bool   `mapstructure:"used_model_name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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