snowflake

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SuspendTrigger suspends all assigned warehouses while allowing currently running queries to complete.
	SuspendTrigger = "SUSPEND"
	// SuspendImmediatelyTrigger suspends all assigned warehouses immediately and cancel any currently running queries or statements using the warehouses.
	SuspendImmediatelyTrigger = "SUSPEND_IMMEDIATE"
	// NotifyTrigger sends an alert (to all users who have enabled notifications for themselves), but do not take any other action.
	NotifyTrigger = "NOTIFY"
)

Variables

View Source
var (
	ErrNoRowInRS = "sql: no rows in result set"
)

Generic Errors.

Functions

func AddressEscape added in v0.34.0

func AddressEscape(in ...string) string

AddressEscape wraps a name inside double quotes only if required by Snowflake.

func ClusterStatementToList added in v0.34.0

func ClusterStatementToList(clusterStatement string) []string

function to take the literal snowflake cluster statement returned from SHOW TABLES and convert it to a list of keys.

func Contains added in v0.34.0

func Contains(s []string, str string) bool

func DescStage added in v0.34.0

func DescStage(db *sql.DB, query string) (*descStageResult, error)

func EscapeSnowflakeString added in v0.34.0

func EscapeSnowflakeString(in string) string

EscapeSnowflakeString will escape single quotes with the SQL native double single quote.

func EscapeString

func EscapeString(in string) string

EscapeString will escape only the ' character. Would prefer a more robust OSS solution, but this should prevent some dumb errors for now.

func Exec added in v0.34.0

func Exec(db *sql.DB, query string) error

func ExecMulti added in v0.34.0

func ExecMulti(db *sql.DB, queries []string) error

func FlattenTablePrimaryKey added in v0.34.0

func FlattenTablePrimaryKey(pkds []primaryKeyDescription) []interface{}

func IsResourceNotExistOrNotAuthorized added in v0.44.0

func IsResourceNotExistOrNotAuthorized(errorString string, resourceType string) bool

func JoinStringList added in v0.34.0

func JoinStringList(instrings []string, delimiter string) string

func ListDatabase added in v0.34.0

func ListDatabase(sdb *sqlx.DB, databaseName string) (*database, error)

func ListDatabases added in v0.34.0

func ListDatabases(sdb *sqlx.DB) ([]database, error)

func ListExternalFunctions added in v0.34.0

func ListExternalFunctions(databaseName string, schemaName string, db *sql.DB) ([]externalFunction, error)

func ListExternalTables added in v0.34.0

func ListExternalTables(databaseName string, schemaName string, db *sql.DB) ([]externalTable, error)

func ListFileFormats added in v0.34.0

func ListFileFormats(databaseName string, schemaName string, db *sql.DB) ([]fileFormatShow, error)

func ListFunctions added in v0.34.0

func ListFunctions(databaseName string, schemaName string, db *sql.DB) ([]function, error)

func ListMaterializedViews added in v0.34.0

func ListMaterializedViews(databaseName string, schemaName string, db *sql.DB) ([]materializedView, error)

func ListPipes added in v0.34.0

func ListPipes(databaseName string, schemaName string, db *sql.DB) ([]pipe, error)

func ListProcedures added in v0.34.0

func ListProcedures(databaseName string, schemaName string, db *sql.DB) ([]procedure, error)

func ListResourceMonitors added in v0.34.0

func ListResourceMonitors(db *sql.DB) ([]resourceMonitor, error)

func ListRoles added in v0.43.1

func ListRoles(db *sql.DB) ([]*role, error)

func ListSchemas added in v0.34.0

func ListSchemas(databaseName string, db *sql.DB) ([]schema, error)

func ListSequences added in v0.34.0

func ListSequences(databaseName string, schemaName string, db *sql.DB) ([]sequence, error)

func ListStages added in v0.34.0

func ListStages(databaseName string, schemaName string, db *sql.DB) ([]stage, error)

func ListStorageIntegrations added in v0.34.0

func ListStorageIntegrations(db *sql.DB) ([]storageIntegration, error)

func ListStreams added in v0.34.0

func ListStreams(databaseName string, schemaName string, db *sql.DB) ([]descStreamRow, error)

func ListTables added in v0.34.0

func ListTables(databaseName string, schemaName string, db *sql.DB) ([]table, error)

func ListTagAssociations added in v0.42.0

func ListTagAssociations(tb *TagAssociationBuilder, db *sql.DB) ([]tagAssociation, error)

func ListTags added in v0.34.0

func ListTags(databaseName, schemaName string, db *sql.DB) ([]tag, error)

ListTags returns a list of tags in a database or schema.

func ListTasks added in v0.34.0

func ListTasks(databaseName string, schemaName string, db *sql.DB) ([]task, error)

func ListUsers added in v0.34.0

func ListUsers(pattern string, db *sql.DB) ([]user, error)

func ListViews added in v0.34.0

func ListViews(databaseName string, schemaName string, db *sql.DB) ([]view, error)

func ListWarehouses added in v0.34.0

func ListWarehouses(db *sql.DB) ([]warehouse, error)

func ParseFormatOptions added in v0.34.0

func ParseFormatOptions(fileOptions string) (*fileFormatOptions, error)

func Query added in v0.34.0

func Query(db *sql.DB, stmt string) (*sqlx.Rows, error)

Query will run stmt against the db and return the rows. We use [DB.Unsafe](https://godoc.org/github.com/jmoiron/sqlx#DB.Unsafe) so that we can scan to structs without worrying about newly introduced columns.

func QueryRow added in v0.34.0

func QueryRow(db *sql.DB, stmt string) *sqlx.Row

QueryRow will run stmt against the db and return the row. We use [DB.Unsafe](https://godoc.org/github.com/jmoiron/sqlx#DB.Unsafe) so that we can scan to structs without worrying about newly introduced columns.

func ReadCurrentAccount added in v0.34.0

func ReadCurrentAccount(db *sql.DB) (*account, error)

func ScanAPIIntegration added in v0.47.0

func ScanAPIIntegration(row *sqlx.Row) (*apiIntegration, error)

func ScanAWSSNSIAMPolicy added in v0.34.0

func ScanAWSSNSIAMPolicy(row *sqlx.Row) (*awsSNSIAMPolicy, error)

ScanAWSSNSIAMPolicy convert a result into a.

func ScanCurrentAccount added in v0.34.0

func ScanCurrentAccount(row *sqlx.Row) (*account, error)

func ScanDatabase added in v0.34.0

func ScanDatabase(row *sqlx.Row) (*database, error)

func ScanExternalFunction added in v0.34.0

func ScanExternalFunction(row *sqlx.Row) (*externalFunction, error)

ScanExternalFunction.

func ScanExternalFunctionDescription added in v0.34.0

func ScanExternalFunctionDescription(rows *sqlx.Rows) ([]externalFunctionDescription, error)

ScanExternalFunctionDescription.

func ScanExternalOauthIntegration added in v0.34.0

func ScanExternalOauthIntegration(row *sqlx.Row) (*externalOauthIntegration, error)

func ScanExternalTable added in v0.34.0

func ScanExternalTable(row *sqlx.Row) (*externalTable, error)

func ScanFileFormatShow added in v0.34.0

func ScanFileFormatShow(row *sqlx.Row) (*fileFormatShow, error)

func ScanFunctionDescription added in v0.34.0

func ScanFunctionDescription(rows *sqlx.Rows) ([]functionDescription, error)

ScanFunctionDescription reads through the rows with property and value columns and returns a slice of functionDescription structs.

func ScanFunctions added in v0.34.0

func ScanFunctions(rows *sqlx.Rows) ([]*function, error)

SHOW FUNCTION can return more than one item because of function names overloading https://docs.snowflake.com/en/sql-reference/sql/show-functions.html

func ScanManagedAccount added in v0.34.0

func ScanManagedAccount(row *sqlx.Row) (*managedAccount, error)

func ScanMaterializedView added in v0.34.0

func ScanMaterializedView(row *sqlx.Row) (*materializedView, error)

func ScanNotificationIntegration added in v0.34.0

func ScanNotificationIntegration(row *sqlx.Row) (*notificationIntegration, error)

func ScanOAuthIntegration added in v0.34.0

func ScanOAuthIntegration(row *sqlx.Row) (*oauthIntegration, error)

func ScanPipe added in v0.34.0

func ScanPipe(row *sqlx.Row) (*pipe, error)

func ScanPrimaryKeyDescription added in v0.34.0

func ScanPrimaryKeyDescription(rows *sqlx.Rows) ([]primaryKeyDescription, error)

func ScanProcedureDescription added in v0.34.0

func ScanProcedureDescription(rows *sqlx.Rows) ([]procedureDescription, error)

ScanProcedureDescription reads through the rows with property and value columns and returns a slice of procedureDescription structs.

func ScanProcedures added in v0.34.0

func ScanProcedures(rows *sqlx.Rows) ([]*procedure, error)

SHOW PROCEDURE can return more than one item because of procedure names overloading https://docs.snowflake.com/en/sql-reference/sql/show-procedures.html

func ScanReplication added in v0.34.0

func ScanReplication(rows *sqlx.Rows, AccName string) (*replication, error)

func ScanResourceMonitor added in v0.34.0

func ScanResourceMonitor(row *sqlx.Row) (*resourceMonitor, error)

func ScanRole added in v0.34.0

func ScanRole(row *sqlx.Row) (*role, error)

func ScanRoleOwnershipGrant added in v0.34.0

func ScanRoleOwnershipGrant(row *sqlx.Row) (*roleOwnershipGrant, error)

func ScanSCIMAccessToken added in v0.34.0

func ScanSCIMAccessToken(row *sqlx.Row) (*scimAccessToken, error)

ScanSCIMAccessToken convert a result into a.

func ScanSamlIntegration added in v0.34.0

func ScanSamlIntegration(row *sqlx.Row) (*samlIntegration, error)

func ScanSchema added in v0.34.0

func ScanSchema(row *sqlx.Row) (*schema, error)

func ScanScimIntegration added in v0.34.0

func ScanScimIntegration(row *sqlx.Row) (*scimIntegration, error)

func ScanSequence added in v0.34.0

func ScanSequence(row *sqlx.Row) (*sequence, error)

func ScanShare added in v0.34.0

func ScanShare(row *sqlx.Row) (*share, error)

func ScanStageShow added in v0.34.0

func ScanStageShow(row *sqlx.Row) (*stage, error)

func ScanStorageIntegration added in v0.34.0

func ScanStorageIntegration(row *sqlx.Row) (*storageIntegration, error)

func ScanStream added in v0.34.0

func ScanStream(row *sqlx.Row) (*descStreamRow, error)

func ScanTable added in v0.34.0

func ScanTable(row *sqlx.Row) (*table, error)

func ScanTableDescription added in v0.34.0

func ScanTableDescription(rows *sqlx.Rows) ([]tableDescription, error)

func ScanTag added in v0.34.0

func ScanTag(row *sqlx.Row) (*tag, error)

func ScanTagPolicy added in v0.43.0

func ScanTagPolicy(row *sqlx.Row) (*tagPolicyAttachment, error)

func ScanTask added in v0.34.0

func ScanTask(row *sqlx.Row) (*task, error)

ScanTask turns a sql row into a task object.

func ScanTaskParameters added in v0.34.0

func ScanTaskParameters(rows *sqlx.Rows) ([]*taskParams, error)

ScanTaskParameters takes a database row and converts it to a task parameter pointer.

func ScanUser added in v0.34.0

func ScanUser(row *sqlx.Row) (*user, error)

func ScanUserDescription added in v0.34.0

func ScanUserDescription(rows *sqlx.Rows) (*user, error)

func ScanUserOwnershipGrant added in v0.34.0

func ScanUserOwnershipGrant(row *sqlx.Row) (*userOwnershipGrant, error)

func ScanView added in v0.34.0

func ScanView(row *sqlx.Row) (*view, error)

func ScanWarehouse added in v0.34.0

func ScanWarehouse(row *sqlx.Row) (*warehouse, error)

func ScanWarehouseParameters added in v0.34.0

func ScanWarehouseParameters(rows *sqlx.Rows) ([]*warehouseParams, error)

ScanWarehouseParameters takes a database row and converts it to a warehouse parameter pointer.

func SelectCurrentAccount added in v0.34.0

func SelectCurrentAccount() string

func ShowTableConstraint added in v0.47.0

func ShowTableConstraint(name, tableDB, tableSchema, tableName string, db *sql.DB) (*tableConstraint, error)

Show returns the SQL query that will show a table constraint by ID.

func SystemGetPrivateLinkConfigQuery added in v0.34.0

func SystemGetPrivateLinkConfigQuery() string

func SystemGetSnowflakePlatformInfoQuery added in v0.34.0

func SystemGetSnowflakePlatformInfoQuery() string

func UnescapeSnowflakeString added in v0.34.0

func UnescapeSnowflakeString(in string) string

UnescapeSnowflakeString reverses EscapeSnowflakeString.

func UnescapeString added in v0.34.0

func UnescapeString(in string) string

UnescapeString reverses EscapeString.

func ValidateIdentifier

func ValidateIdentifier(val interface{}, exclusions []string) (warns []string, errs []error)

ValidateIdentifier implements a strict definition of valid identifiers from https://docs.snowflake.net/manuals/sql-reference/identifiers-syntax.html

Types

type AlterPropertiesBuilder added in v0.3.0

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

func (*AlterPropertiesBuilder) GetTagValueString added in v0.34.0

func (ab *AlterPropertiesBuilder) GetTagValueString() string

func (*AlterPropertiesBuilder) SetBool added in v0.3.0

func (ab *AlterPropertiesBuilder) SetBool(key string, value bool)

func (*AlterPropertiesBuilder) SetFloat added in v0.34.0

func (ab *AlterPropertiesBuilder) SetFloat(key string, value float64)

func (*AlterPropertiesBuilder) SetInt added in v0.3.0

func (ab *AlterPropertiesBuilder) SetInt(key string, value int)

func (*AlterPropertiesBuilder) SetRaw added in v0.34.0

func (ab *AlterPropertiesBuilder) SetRaw(rawStatement string)

func (*AlterPropertiesBuilder) SetString added in v0.3.0

func (ab *AlterPropertiesBuilder) SetString(key, value string)

func (*AlterPropertiesBuilder) SetStringList added in v0.34.0

func (ab *AlterPropertiesBuilder) SetStringList(key string, value []string)

func (*AlterPropertiesBuilder) SetTags added in v0.34.0

func (b *AlterPropertiesBuilder) SetTags(tags []TagValue)

func (*AlterPropertiesBuilder) Statement added in v0.3.0

func (ab *AlterPropertiesBuilder) Statement() string

type Builder added in v0.3.0

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

func APIIntegration added in v0.47.0

func APIIntegration(name string) *Builder

ApiIntegration returns a pointer to a Builder that abstracts the DDL operations for an api integration.

Supported DDL operations are:

  • CREATE API INTEGRATION
  • ALTER API INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#api-integrations)

func ExternalOauthIntegration added in v0.34.0

func ExternalOauthIntegration(name string) *Builder

ExternalOauthIntegration returns a pointer to a Builder that abstracts the DDL operations for an api integration.

Supported DDL operations are:

  • CREATE SECURITY INTEGRATION
  • ALTER SECURITY INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#security-integrations)

func ManagedAccount added in v0.34.0

func ManagedAccount(name string) *Builder

ManagedAccount returns a pointer to a Builder that abstracts the DDL operations for a reader account.

Supported DDL operations are:

  • CREATE MANAGED ACCOUNT
  • DROP MANAGED ACCOUNT
  • SHOW MANAGED ACCOUNTS

[Snowflake Reference](https://docs.snowflake.net/manuals/user-guide/data-sharing-reader-create.html)

func NotificationIntegration added in v0.34.0

func NotificationIntegration(name string) *Builder

NotificationIntegration returns a pointer to a Builder that abstracts the DDL operations for a notification integration.

Supported DDL operations are:

  • CREATE NOTIFICATION INTEGRATION
  • ALTER NOTIFICATION INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#notification-integrations)

func OAuthIntegration added in v0.34.0

func OAuthIntegration(name string) *Builder

OAuthIntegration returns a pointer to a Builder that abstracts the DDL operations for an api integration.

Supported DDL operations are:

  • CREATE SECURITY INTEGRATION
  • ALTER SECURITY INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#security-integrations)

func Role added in v0.3.0

func Role(name string) *Builder

func SamlIntegration added in v0.34.0

func SamlIntegration(name string) *Builder

SamlIntegration returns a pointer to a Builder that abstracts the DDL operations for a SAML2 integration.

Supported DDL operations are:

  • CREATE SECURITY INTEGRATION
  • ALTER SECURITY INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#security-integrations)

func ScimIntegration added in v0.34.0

func ScimIntegration(name string) *Builder

ScimIntegration returns a pointer to a Builder that abstracts the DDL operations for an api integration.

Supported DDL operations are:

  • CREATE SECURITY INTEGRATION
  • ALTER SECURITY INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-user-security.html#security-integrations)

func Share added in v0.34.0

func Share(name string) *Builder

Share returns a pointer to a Builder that abstracts the DDL operations for a share.

Supported DDL operations are:

  • CREATE SHARE
  • ALTER SHARE
  • DROP SHARE
  • SHOW SHARES
  • DESCRIBE SHARE

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-database.html#share-management)

func StorageIntegration added in v0.34.0

func StorageIntegration(name string) *Builder

StorageIntegration returns a pointer to a Builder that abstracts the DDL operations for a storage integration.

Supported DDL operations are:

  • CREATE STORAGE INTEGRATION
  • ALTER STORAGE INTEGRATION
  • DROP INTEGRATION
  • SHOW INTEGRATIONS
  • DESCRIBE INTEGRATION

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-user-security.html#storage-integrations)

func User added in v0.3.0

func User(name string) *Builder

func (*Builder) Alter added in v0.3.0

func (b *Builder) Alter() *AlterPropertiesBuilder

func (*Builder) Create added in v0.3.0

func (b *Builder) Create() *CreateBuilder

func (*Builder) Describe added in v0.34.0

func (b *Builder) Describe() string

func (*Builder) Drop added in v0.3.0

func (b *Builder) Drop() string

func (*Builder) Rename added in v0.3.0

func (b *Builder) Rename(newName string) string

func (*Builder) Show added in v0.3.0

func (b *Builder) Show() string

type Column added in v0.34.0

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

Column structure that represents a table column.

func (*Column) WithComment added in v0.34.0

func (c *Column) WithComment(comment string) *Column

WithComment set the column comment.

func (*Column) WithDefault added in v0.34.0

func (c *Column) WithDefault(cd *ColumnDefault) *Column

func (*Column) WithIdentity added in v0.34.0

func (c *Column) WithIdentity(id *ColumnIdentity) *Column

func (*Column) WithName added in v0.34.0

func (c *Column) WithName(name string) *Column

WithName set the column name.

func (*Column) WithNullable added in v0.34.0

func (c *Column) WithNullable(nullable bool) *Column

WithNullable set if the column is nullable.

func (*Column) WithType added in v0.34.0

func (c *Column) WithType(t string) *Column

WithType set the column type.

type ColumnDefault added in v0.34.0

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

func NewColumnDefaultWithConstant added in v0.34.0

func NewColumnDefaultWithConstant(constant string) *ColumnDefault

func NewColumnDefaultWithExpression added in v0.34.0

func NewColumnDefaultWithExpression(expression string) *ColumnDefault

func NewColumnDefaultWithSequence added in v0.34.0

func NewColumnDefaultWithSequence(sequence string) *ColumnDefault

func (*ColumnDefault) String added in v0.34.0

func (d *ColumnDefault) String(columnType string) string

func (*ColumnDefault) UnescapeConstantSnowflakeString added in v0.34.0

func (d *ColumnDefault) UnescapeConstantSnowflakeString(columnType string) string

type ColumnDefaultType added in v0.34.0

type ColumnDefaultType int

type ColumnIdentity added in v0.34.0

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

func (*ColumnIdentity) WithStartNum added in v0.34.0

func (id *ColumnIdentity) WithStartNum(start int) *ColumnIdentity

func (*ColumnIdentity) WithStep added in v0.34.0

func (id *ColumnIdentity) WithStep(step int) *ColumnIdentity

type Columns added in v0.34.0

type Columns []Column

func NewColumns added in v0.34.0

func NewColumns(tds []tableDescription) Columns

NewColumns generates columns from a table description.

func (Columns) Flatten added in v0.34.0

func (c Columns) Flatten() []interface{}

type CreateBuilder added in v0.3.0

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

func (*CreateBuilder) GetTagValueString added in v0.34.0

func (b *CreateBuilder) GetTagValueString() string

func (*CreateBuilder) SetBool added in v0.3.0

func (b *CreateBuilder) SetBool(key string, value bool)

func (*CreateBuilder) SetFloat added in v0.34.0

func (b *CreateBuilder) SetFloat(key string, value float64)

func (*CreateBuilder) SetInt added in v0.3.0

func (b *CreateBuilder) SetInt(key string, value int)

func (*CreateBuilder) SetRaw added in v0.34.0

func (b *CreateBuilder) SetRaw(rawStatement string)

func (*CreateBuilder) SetString added in v0.3.0

func (b *CreateBuilder) SetString(key, value string)

func (*CreateBuilder) SetStringList added in v0.34.0

func (b *CreateBuilder) SetStringList(key string, value []string)

func (*CreateBuilder) SetTags added in v0.34.0

func (b *CreateBuilder) SetTags(tags []TagValue)

func (*CreateBuilder) Statement added in v0.3.0

func (b *CreateBuilder) Statement() string

type CurrentGrantBuilder added in v0.34.0

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

CurrentGrantBuilder abstracts the creation of GrantExecutables.

func (*CurrentGrantBuilder) GrantType added in v0.34.0

func (gb *CurrentGrantBuilder) GrantType() string

func (*CurrentGrantBuilder) Name added in v0.34.0

func (gb *CurrentGrantBuilder) Name() string

Name returns the object name for this CurrentGrantBuilder.

func (*CurrentGrantBuilder) Role added in v0.34.0

Role returns a pointer to a CurrentGrantExecutable for a role.

func (*CurrentGrantBuilder) Share added in v0.34.0

Share returns a pointer to a CurrentGrantExecutable for a share.

func (*CurrentGrantBuilder) Show added in v0.34.0

func (gb *CurrentGrantBuilder) Show() string

Show returns the SQL that will show all privileges on the grant.

type CurrentGrantExecutable added in v0.34.0

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

CurrentGrantExecutable abstracts the creation of SQL queries to build grants for different resources.

func (*CurrentGrantExecutable) Grant added in v0.34.0

func (ge *CurrentGrantExecutable) Grant(p string, w bool) string

Grant returns the SQL that will grant privileges on the grant to the grantee.

func (*CurrentGrantExecutable) Revoke added in v0.34.0

func (ge *CurrentGrantExecutable) Revoke(p string) []string

Revoke returns the SQL that will revoke privileges on the grant from the grantee.

func (*CurrentGrantExecutable) Show added in v0.34.0

func (ge *CurrentGrantExecutable) Show() string

Show returns the SQL that will show all grants of the grantee.

type CurrentMaterializedViewGrantBuilder added in v0.34.0

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

///////////////////////////////////////////// START CurrentMaterializedViewGrantBuilder // /////////////////////////////////////////////.

func (*CurrentMaterializedViewGrantBuilder) GrantType added in v0.34.0

func (*CurrentMaterializedViewGrantBuilder) Name added in v0.34.0

Name returns the object name for this CurrentGrantBuilder.

func (*CurrentMaterializedViewGrantBuilder) Role added in v0.34.0

Role returns a pointer to a CurrentGrantExecutable for a role.

func (*CurrentMaterializedViewGrantBuilder) Share added in v0.34.0

Share returns a pointer to a CurrentGrantExecutable for a share.

func (*CurrentMaterializedViewGrantBuilder) Show added in v0.34.0

Show returns the SQL that will show all privileges on the grant.

type DatabaseBuilder added in v0.42.0

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

DatabaseBuilder abstracts the creation of SQL queries for a Snowflake database.

func Database added in v0.3.0

func Database(name string) *DatabaseBuilder

Database returns a pointer to a Builder that abstracts the DDL operations for a database.

Supported DDL operations are:

  • CREATE DATABASE
  • ALTER DATABASE
  • DROP DATABASE
  • UNDROP DATABASE
  • USE DATABASE
  • SHOW DATABASE

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-database.html#database-management)

func (*DatabaseBuilder) AddTag added in v0.42.0

func (db *DatabaseBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the database.

func (*DatabaseBuilder) ChangeComment added in v0.42.0

func (db *DatabaseBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the database.

func (*DatabaseBuilder) ChangeDataRetentionDays added in v0.42.0

func (db *DatabaseBuilder) ChangeDataRetentionDays(d int) string

ChangeDataRetentionDays returns the SQL query that will update the data retention days on the database.

func (*DatabaseBuilder) ChangeTag added in v0.42.0

func (db *DatabaseBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the database.

func (*DatabaseBuilder) Clone added in v0.42.0

func (db *DatabaseBuilder) Clone(database string) *DatabaseBuilder

Clone adds CLONE to the DatabaseBuilder to create a clone of another database.

func (*DatabaseBuilder) Create added in v0.42.0

func (db *DatabaseBuilder) Create() string

Create returns the SQL query that will create a new database.

func (*DatabaseBuilder) DisableReplicationAccounts added in v0.42.0

func (db *DatabaseBuilder) DisableReplicationAccounts(dbName string, accounts string) string

DisableReplicationAccounts returns the SQL query that will disable replication to provided accounts.

func (*DatabaseBuilder) Drop added in v0.42.0

func (db *DatabaseBuilder) Drop() string

Drop returns the SQL query that will drop a database.

func (*DatabaseBuilder) EnableReplicationAccounts added in v0.42.0

func (db *DatabaseBuilder) EnableReplicationAccounts(dbName string, accounts string) string

EnableReplicationAccounts returns the SQL query that will enable replication to provided accounts.

func (*DatabaseBuilder) GetRemovedAccountsFromReplicationConfiguration added in v0.42.0

func (db *DatabaseBuilder) GetRemovedAccountsFromReplicationConfiguration(oldAcc []interface{}, newAcc []interface{}) []interface{}

GetRemovedAccountsFromReplicationConfiguration compares two old and new configurations and returns any values that were deleted from the old configuration.

func (*DatabaseBuilder) QualifiedName added in v0.42.0

func (db *DatabaseBuilder) QualifiedName() string

func (*DatabaseBuilder) RemoveComment added in v0.42.0

func (db *DatabaseBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the database.

func (*DatabaseBuilder) RemoveDataRetentionDays added in v0.42.0

func (db *DatabaseBuilder) RemoveDataRetentionDays() string

RemoveDataRetentionDays returns the SQL query that will remove the data retention days on the database.

func (*DatabaseBuilder) Rename added in v0.42.0

func (db *DatabaseBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the database.

func (*DatabaseBuilder) Show added in v0.42.0

func (db *DatabaseBuilder) Show() string

Show returns the SQL query that will show a database.

func (*DatabaseBuilder) Swap added in v0.42.0

func (db *DatabaseBuilder) Swap(targetDatabase string) string

Swap returns the SQL query that Swaps all objects (tables, views, etc.) and metadata, including identifiers, between the two specified databases.

func (*DatabaseBuilder) Transient added in v0.42.0

func (db *DatabaseBuilder) Transient() *DatabaseBuilder

Transient adds the TRANSIENT flag to the DatabaseBuilder.

func (*DatabaseBuilder) Undrop added in v0.42.0

func (db *DatabaseBuilder) Undrop() string

Undrop returns the SQL query that will undrop a database.

func (*DatabaseBuilder) UnsetTag added in v0.42.0

func (db *DatabaseBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the database.

func (*DatabaseBuilder) Use added in v0.42.0

func (db *DatabaseBuilder) Use() string

Use returns the SQL query that will use a database.

func (*DatabaseBuilder) WithComment added in v0.42.0

func (db *DatabaseBuilder) WithComment(c string) *DatabaseBuilder

WithComment adds a comment to the DatabaseBuilder.

func (*DatabaseBuilder) WithDataRetentionDays added in v0.42.0

func (db *DatabaseBuilder) WithDataRetentionDays(d int) *DatabaseBuilder

WithDataRetentionDays adds the days to retain data to the DatabaseBuilder (must be 0-1 for standard edition, 0-90 for enterprise edition).

func (*DatabaseBuilder) WithTags added in v0.42.0

func (db *DatabaseBuilder) WithTags(tags []TagValue) *DatabaseBuilder

WithTags sets the tags on the DatabaseBuilder.

type DatabaseReplicaBuilder added in v0.34.0

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

DatabaseReplicaBuilder is a basic builder that just creates databases from an available replication source.

func DatabaseFromReplica added in v0.34.0

func DatabaseFromReplica(name, replica string) *DatabaseReplicaBuilder

DatabaseFromReplica returns a pointer to a builder that can create a database from an available replication source.

func (*DatabaseReplicaBuilder) Create added in v0.34.0

func (dsb *DatabaseReplicaBuilder) Create() string

Create returns the SQL statement required to create a database from an available replication source.

type DatabaseShareBuilder added in v0.34.0

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

DatabaseShareBuilder is a basic builder that just creates databases from shares.

func DatabaseFromShare added in v0.34.0

func DatabaseFromShare(name, provider, share string) *DatabaseShareBuilder

DatabaseFromShare returns a pointer to a builder that can create a database from a share.

func (*DatabaseShareBuilder) Create added in v0.34.0

func (dsb *DatabaseShareBuilder) Create() string

Create returns the SQL statement required to create a database from a share.

func (*DatabaseShareBuilder) WithComment added in v0.42.0

func (dsb *DatabaseShareBuilder) WithComment(comment string) *DatabaseShareBuilder

WithComment adds a comment to the DatabaseShareBuilder.

type DescribeUserProp added in v0.34.0

type DescribeUserProp struct {
	Property string         `db:"property"`
	Value    sql.NullString `db:"value"`
}

type EntityType added in v0.3.0

type EntityType string
const (
	APIIntegrationType          EntityType = "API INTEGRATION"
	DatabaseType                EntityType = "DATABASE"
	ManagedAccountType          EntityType = "MANAGED ACCOUNT"
	ResourceMonitorType         EntityType = "RESOURCE MONITOR"
	RoleType                    EntityType = "ROLE"
	ShareType                   EntityType = "SHARE"
	ReplicationType             EntityType = "REPLICATION"
	StorageIntegrationType      EntityType = "STORAGE INTEGRATION"
	NotificationIntegrationType EntityType = "NOTIFICATION INTEGRATION"
	SecurityIntegrationType     EntityType = "SECURITY INTEGRATION"
	UserType                    EntityType = "USER"
	WarehouseType               EntityType = "WAREHOUSE"
)

type ExternalFunctionBuilder added in v0.34.0

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

ExternalFunctionBuilder abstracts the creation of SQL queries for a Snowflake schema.

func ExternalFunction added in v0.34.0

func ExternalFunction(name, db, schema string) *ExternalFunctionBuilder

ExternalFunction returns a pointer to a Builder that abstracts the DDL operations for an external function.

Supported DDL operations are:

  • CREATE EXTERNAL FUNCTION
  • ALTER EXTERNAL FUNCTION
  • DROP FUNCTION
  • SHOW EXTERNAL FUNCTIONS
  • DESCRIBE FUNCTION

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-udf.html#external-function-management)

func (*ExternalFunctionBuilder) Create added in v0.34.0

func (fb *ExternalFunctionBuilder) Create() string

Create returns the SQL statement required to create an external function.

func (*ExternalFunctionBuilder) Describe added in v0.34.0

func (fb *ExternalFunctionBuilder) Describe() string

Describe returns the SQL query that will describe an external function.

func (*ExternalFunctionBuilder) Drop added in v0.34.0

func (fb *ExternalFunctionBuilder) Drop() string

Drop returns the SQL query that will drop an external function.

func (*ExternalFunctionBuilder) QualifiedName added in v0.34.0

func (fb *ExternalFunctionBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*ExternalFunctionBuilder) QualifiedNameWithArgTypes added in v0.34.0

func (fb *ExternalFunctionBuilder) QualifiedNameWithArgTypes() string

QualifiedNameWithArgTypes appends all args' types to the qualified name. This is required to invoke 'DESC FUNCTION' and 'DROP FUNCTION' commands.

func (*ExternalFunctionBuilder) Show added in v0.34.0

func (fb *ExternalFunctionBuilder) Show() string

Show returns the SQL query that will show an external function.

func (*ExternalFunctionBuilder) WithAPIIntegration added in v0.34.0

func (fb *ExternalFunctionBuilder) WithAPIIntegration(apiIntegration string) *ExternalFunctionBuilder

WithAPIIntegration adds a apiIntegration to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithArgTypes added in v0.34.0

func (fb *ExternalFunctionBuilder) WithArgTypes(argtypes string) *ExternalFunctionBuilder

WithArgTypes sets the args on the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithArgs added in v0.34.0

WithArgs sets the args on the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithComment added in v0.34.0

WithComment adds a comment to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithCompression added in v0.34.0

func (fb *ExternalFunctionBuilder) WithCompression(compression string) *ExternalFunctionBuilder

WithCompression adds a compression to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithContextHeaders added in v0.34.0

func (fb *ExternalFunctionBuilder) WithContextHeaders(contextHeaders []string) *ExternalFunctionBuilder

WithContextHeaders sets the context headers on the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithHeaders added in v0.34.0

func (fb *ExternalFunctionBuilder) WithHeaders(headers []map[string]string) *ExternalFunctionBuilder

WithHeaders sets the headers on the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithMaxBatchRows added in v0.34.0

func (fb *ExternalFunctionBuilder) WithMaxBatchRows(maxBatchRows int) *ExternalFunctionBuilder

WithMaxBatchRows adds a maxBatchRows to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithNullInputBehavior added in v0.34.0

func (fb *ExternalFunctionBuilder) WithNullInputBehavior(nullInputBehavior string) *ExternalFunctionBuilder

WithNullInputBehavior adds a nullInputBehavior to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithReturnBehavior added in v0.34.0

func (fb *ExternalFunctionBuilder) WithReturnBehavior(returnBehavior string) *ExternalFunctionBuilder

WithReturnBehavior adds a returnBehavior to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithReturnNullAllowed added in v0.34.0

func (fb *ExternalFunctionBuilder) WithReturnNullAllowed(returnNullAllowed bool) *ExternalFunctionBuilder

WithReturnNullAllowed adds a returnNullAllowed to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithReturnType added in v0.34.0

func (fb *ExternalFunctionBuilder) WithReturnType(returnType string) *ExternalFunctionBuilder

WithReturnType adds a returnType to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithURLOfProxyAndResource added in v0.34.0

func (fb *ExternalFunctionBuilder) WithURLOfProxyAndResource(urlOfProxyAndResource string) *ExternalFunctionBuilder

WithURLOfProxyAndResource adds a urlOfProxyAndResource to the ExternalFunctionBuilder.

type ExternalTableBuilder added in v0.34.0

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

externalTableBuilder abstracts the creation of SQL queries for a Snowflake schema.

func ExternalTable added in v0.34.0

func ExternalTable(name, db, schema string) *ExternalTableBuilder

func (*ExternalTableBuilder) Create added in v0.34.0

func (tb *ExternalTableBuilder) Create() string

Create returns the SQL statement required to create a externalTable.

func (*ExternalTableBuilder) Drop added in v0.34.0

func (tb *ExternalTableBuilder) Drop() string

Drop returns the SQL query that will drop a externalTable.

func (*ExternalTableBuilder) GetTagValueString added in v0.34.0

func (tb *ExternalTableBuilder) GetTagValueString() string

func (*ExternalTableBuilder) QualifiedName added in v0.34.0

func (tb *ExternalTableBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*ExternalTableBuilder) Show added in v0.34.0

func (tb *ExternalTableBuilder) Show() string

Show returns the SQL query that will show a externalTable.

func (*ExternalTableBuilder) Update added in v0.34.0

func (tb *ExternalTableBuilder) Update() string

Update returns the SQL statement required to update an externalTable.

func (*ExternalTableBuilder) WithAutoRefresh added in v0.34.0

func (tb *ExternalTableBuilder) WithAutoRefresh(c bool) *ExternalTableBuilder

func (*ExternalTableBuilder) WithAwsSNSTopic added in v0.34.0

func (tb *ExternalTableBuilder) WithAwsSNSTopic(c string) *ExternalTableBuilder

func (*ExternalTableBuilder) WithColumns added in v0.34.0

func (tb *ExternalTableBuilder) WithColumns(c []map[string]string) *ExternalTableBuilder

WithColumns sets the column definitions on the ExternalTableBuilder.

func (*ExternalTableBuilder) WithComment added in v0.34.0

func (tb *ExternalTableBuilder) WithComment(c string) *ExternalTableBuilder

WithComment adds a comment to the ExternalTableBuilder.

func (*ExternalTableBuilder) WithCopyGrants added in v0.34.0

func (tb *ExternalTableBuilder) WithCopyGrants(c bool) *ExternalTableBuilder

func (*ExternalTableBuilder) WithFileFormat added in v0.34.0

func (tb *ExternalTableBuilder) WithFileFormat(c string) *ExternalTableBuilder

func (*ExternalTableBuilder) WithLocation added in v0.34.0

func (tb *ExternalTableBuilder) WithLocation(c string) *ExternalTableBuilder

func (*ExternalTableBuilder) WithPartitionBys added in v0.34.0

func (tb *ExternalTableBuilder) WithPartitionBys(c []string) *ExternalTableBuilder

func (*ExternalTableBuilder) WithPattern added in v0.34.0

func (tb *ExternalTableBuilder) WithPattern(c string) *ExternalTableBuilder

func (*ExternalTableBuilder) WithRefreshOnCreate added in v0.34.0

func (tb *ExternalTableBuilder) WithRefreshOnCreate(c bool) *ExternalTableBuilder

func (*ExternalTableBuilder) WithTags added in v0.34.0

func (tb *ExternalTableBuilder) WithTags(tags []TagValue) *ExternalTableBuilder

WithTags sets the tags on the ExternalTableBuilder.

type FileFormatBuilder added in v0.34.0

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

FileFormatBuilder abstracts the creation of SQL queries for a Snowflake file format.

func FileFormat added in v0.34.0

func FileFormat(name, db, schema string) *FileFormatBuilder

FileFormat returns a pointer to a Builder that abstracts the DDL operations for a file format.

Supported DDL operations are:

  • CREATE FILE FORMAT
  • ALTER FILE FORMAT
  • DROP FILE FORMAT
  • SHOW FILE FORMATS
  • DESCRIBE FILE FORMAT

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/sql/create-file-format.html)

func (*FileFormatBuilder) ChangeAllowDuplicate added in v0.34.0

func (ffb *FileFormatBuilder) ChangeAllowDuplicate(c bool) string

ChangeAllowDuplicate returns the SQL query that will update ALLOW_DUPLICATE on the file format.

func (*FileFormatBuilder) ChangeBinaryAsText added in v0.34.0

func (ffb *FileFormatBuilder) ChangeBinaryAsText(c bool) string

ChangeBinaryAsText returns the SQL query that will update BINARY_AS_TEXT on the file format.

func (*FileFormatBuilder) ChangeBinaryFormat added in v0.34.0

func (ffb *FileFormatBuilder) ChangeBinaryFormat(c string) string

ChangeBinaryFormat returns the SQL query that will update the binary format on the file format.

func (*FileFormatBuilder) ChangeComment added in v0.34.0

func (ffb *FileFormatBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the file format.

func (*FileFormatBuilder) ChangeCompression added in v0.34.0

func (ffb *FileFormatBuilder) ChangeCompression(c string) string

ChangeCompression returns the SQL query that will update the compression on the file format.

func (*FileFormatBuilder) ChangeDateFormat added in v0.34.0

func (ffb *FileFormatBuilder) ChangeDateFormat(c string) string

ChangeDateFormat returns the SQL query that will update the date format on the file format.

func (*FileFormatBuilder) ChangeDisableAutoConvert added in v0.34.0

func (ffb *FileFormatBuilder) ChangeDisableAutoConvert(c bool) string

ChangeDisableAutoConvert returns the SQL query that will update DISABLE_AUTO_CONVERT on the file format.

func (*FileFormatBuilder) ChangeDisableSnowflakeData added in v0.34.0

func (ffb *FileFormatBuilder) ChangeDisableSnowflakeData(c bool) string

ChangeDisableSnowflakeData returns the SQL query that will update DISABLE_SNOWFLAKE_DATA on the file format.

func (*FileFormatBuilder) ChangeEmptyFieldAsNull added in v0.34.0

func (ffb *FileFormatBuilder) ChangeEmptyFieldAsNull(c bool) string

ChangeEmptyFieldAsNull returns the SQL query that will update the error_on_column_count_mismatch on the file format.

func (*FileFormatBuilder) ChangeEnableOctal added in v0.34.0

func (ffb *FileFormatBuilder) ChangeEnableOctal(c bool) string

ChangeEnableOctal returns the SQL query that will update ENABLE_OCTAL on the file format.

func (*FileFormatBuilder) ChangeEncoding added in v0.34.0

func (ffb *FileFormatBuilder) ChangeEncoding(c string) string

ChangeEncoding returns the SQL query that will update the encoding on the file format.

func (*FileFormatBuilder) ChangeErrorOnColumnCountMismatch added in v0.34.0

func (ffb *FileFormatBuilder) ChangeErrorOnColumnCountMismatch(c bool) string

ChangeErrorOnColumnCountMismatch returns the SQL query that will update the error_on_column_count_mismatch on the file format.

func (*FileFormatBuilder) ChangeEscape added in v0.34.0

func (ffb *FileFormatBuilder) ChangeEscape(c string) string

ChangeEscape returns the SQL query that will update the escape on the file format.

func (*FileFormatBuilder) ChangeEscapeUnenclosedField added in v0.34.0

func (ffb *FileFormatBuilder) ChangeEscapeUnenclosedField(c string) string

ChangeEscapeUnenclosedField returns the SQL query that will update the escape unenclosed field on the file format.

func (*FileFormatBuilder) ChangeFieldDelimiter added in v0.34.0

func (ffb *FileFormatBuilder) ChangeFieldDelimiter(c string) string

ChangeFieldDelimiter returns the SQL query that will update the FIELD_DELIMITER on the file format.

func (*FileFormatBuilder) ChangeFieldOptionallyEnclosedBy added in v0.34.0

func (ffb *FileFormatBuilder) ChangeFieldOptionallyEnclosedBy(c string) string

ChangeFieldOptionallyEnclosedBy returns the SQL query that will update the field optionally enclosed by on the file format.

func (*FileFormatBuilder) ChangeFileExtension added in v0.34.0

func (ffb *FileFormatBuilder) ChangeFileExtension(c string) string

ChangeFileExtension returns the SQL query that will update the FILE_EXTENSION on the file format.

func (*FileFormatBuilder) ChangeIgnoreUTF8Errors added in v0.34.0

func (ffb *FileFormatBuilder) ChangeIgnoreUTF8Errors(c bool) string

ChangeIgnoreUTF8Errors returns the SQL query that will update IGNORE_UTF8_ERRORS on the file format.

func (*FileFormatBuilder) ChangeNullIf added in v0.34.0

func (ffb *FileFormatBuilder) ChangeNullIf(c []string) string

ChangeNullIf returns the SQL query that will update the null if on the file format.

func (*FileFormatBuilder) ChangePreserveSpace added in v0.34.0

func (ffb *FileFormatBuilder) ChangePreserveSpace(c bool) string

ChangePreserveSpace returns the SQL query that will update PRESERVE_SPACE on the file format.

func (*FileFormatBuilder) ChangeRecordDelimiter added in v0.34.0

func (ffb *FileFormatBuilder) ChangeRecordDelimiter(c string) string

ChangeRecordDelimiter returns the SQL query that will update the record delimiter on the file format.

func (*FileFormatBuilder) ChangeReplaceInvalidCharacters added in v0.34.0

func (ffb *FileFormatBuilder) ChangeReplaceInvalidCharacters(c bool) string

ChangeReplaceInvalidCharacters returns the SQL query that will update REPLACE_INVALID_CHARACTERS on the file format.

func (*FileFormatBuilder) ChangeSkipBlankLines added in v0.34.0

func (ffb *FileFormatBuilder) ChangeSkipBlankLines(c bool) string

ChangeSkipBlankLines returns the SQL query that will update SKIP_BLANK_LINES on the file format.

func (*FileFormatBuilder) ChangeSkipByteOrderMark added in v0.34.0

func (ffb *FileFormatBuilder) ChangeSkipByteOrderMark(c bool) string

ChangeSkipByteOrderMark returns the SQL query that will update SKIP_BYTE_ORDER_MARK on the file format.

func (*FileFormatBuilder) ChangeSkipHeader added in v0.34.0

func (ffb *FileFormatBuilder) ChangeSkipHeader(c int) string

ChangeSkipHeader returns the SQL query that will update the skip header on the file format.

func (*FileFormatBuilder) ChangeStripNullValues added in v0.34.0

func (ffb *FileFormatBuilder) ChangeStripNullValues(c bool) string

ChangeStripNullValues returns the SQL query that will update STRIP_NULL_VALUES on the file format.

func (*FileFormatBuilder) ChangeStripOuterArray added in v0.34.0

func (ffb *FileFormatBuilder) ChangeStripOuterArray(c bool) string

ChangeStripOuterArray returns the SQL query that will update STRIP_OUTER_ARRAY on the file format.

func (*FileFormatBuilder) ChangeStripOuterElement added in v0.34.0

func (ffb *FileFormatBuilder) ChangeStripOuterElement(c bool) string

ChangeStripOuterElement returns the SQL query that will update STRIP_OUTER_ELEMENT on the file format.

func (*FileFormatBuilder) ChangeTimeFormat added in v0.34.0

func (ffb *FileFormatBuilder) ChangeTimeFormat(c string) string

ChangeTimeFormat returns the SQL query that will update the time format on the file format.

func (*FileFormatBuilder) ChangeTimestampFormat added in v0.34.0

func (ffb *FileFormatBuilder) ChangeTimestampFormat(c string) string

ChangeTimestampFormat returns the SQL query that will update the timestamp format on the file format.

func (*FileFormatBuilder) ChangeTrimSpace added in v0.34.0

func (ffb *FileFormatBuilder) ChangeTrimSpace(c bool) string

ChangeTrimSpace returns the SQL query that will update TRIM_SPACE on the file format.

func (*FileFormatBuilder) Create added in v0.34.0

func (ffb *FileFormatBuilder) Create() string

Create returns the SQL query that will create a new file format.

func (*FileFormatBuilder) Describe added in v0.34.0

func (ffb *FileFormatBuilder) Describe() string

Describe returns the SQL query that will describe a file format..

func (*FileFormatBuilder) Drop added in v0.34.0

func (ffb *FileFormatBuilder) Drop() string

Drop returns the SQL query that will drop a file format.

func (*FileFormatBuilder) QualifiedName added in v0.34.0

func (ffb *FileFormatBuilder) QualifiedName() string

QualifiedName prepends the db and schema and escapes everything nicely.

func (*FileFormatBuilder) RemoveComment added in v0.34.0

func (ffb *FileFormatBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the file format.

func (*FileFormatBuilder) Show added in v0.34.0

func (ffb *FileFormatBuilder) Show() string

Show returns the SQL query that will show a file format.

func (*FileFormatBuilder) WithAllowDuplicate added in v0.34.0

func (ffb *FileFormatBuilder) WithAllowDuplicate(n bool) *FileFormatBuilder

WithAllowDuplicate adds allow duplicate to the FileFormatBuilder.

func (*FileFormatBuilder) WithBinaryAsText added in v0.34.0

func (ffb *FileFormatBuilder) WithBinaryAsText(n bool) *FileFormatBuilder

WithBinaryAsText adds binary as text to the FileFormatBuilder.

func (*FileFormatBuilder) WithBinaryFormat added in v0.34.0

func (ffb *FileFormatBuilder) WithBinaryFormat(s string) *FileFormatBuilder

WithBinaryFormat adds binary format to the FileFormatBuilder.

func (*FileFormatBuilder) WithComment added in v0.34.0

func (ffb *FileFormatBuilder) WithComment(c string) *FileFormatBuilder

WithComment adds a comment to the FileFormatBuilder.

func (*FileFormatBuilder) WithCompression added in v0.34.0

func (ffb *FileFormatBuilder) WithCompression(c string) *FileFormatBuilder

WithCompression adds compression to the FileFormatBuilder.

func (*FileFormatBuilder) WithDateFormat added in v0.34.0

func (ffb *FileFormatBuilder) WithDateFormat(s string) *FileFormatBuilder

WithDateFormat adds date format to the FileFormatBuilder.

func (*FileFormatBuilder) WithDisableAutoConvert added in v0.34.0

func (ffb *FileFormatBuilder) WithDisableAutoConvert(n bool) *FileFormatBuilder

WithDisableAutoConvert adds disbale auto convert to the FileFormatBuilder.

func (*FileFormatBuilder) WithDisableSnowflakeData added in v0.34.0

func (ffb *FileFormatBuilder) WithDisableSnowflakeData(n bool) *FileFormatBuilder

WithDisableSnowflakeData adds disable Snowflake data to the FileFormatBuilder.

func (*FileFormatBuilder) WithEmptyFieldAsNull added in v0.34.0

func (ffb *FileFormatBuilder) WithEmptyFieldAsNull(n bool) *FileFormatBuilder

WithEmptyFieldAsNull adds empty field as null to the FileFormatBuilder.

func (*FileFormatBuilder) WithEnableOctal added in v0.34.0

func (ffb *FileFormatBuilder) WithEnableOctal(n bool) *FileFormatBuilder

WithEnableOctal adds enable octal to the FileFormatBuilder.

func (*FileFormatBuilder) WithEncoding added in v0.34.0

func (ffb *FileFormatBuilder) WithEncoding(e string) *FileFormatBuilder

WithEncoding adds encoding to the FileFormatBuilder.

func (*FileFormatBuilder) WithErrorOnColumnCountMismatch added in v0.34.0

func (ffb *FileFormatBuilder) WithErrorOnColumnCountMismatch(n bool) *FileFormatBuilder

WithErrorOnColumnCountMismatch adds error on column count mistmatch to the FileFormatBuilder.

func (*FileFormatBuilder) WithEscape added in v0.34.0

func (ffb *FileFormatBuilder) WithEscape(s string) *FileFormatBuilder

WithEscape adds escape to the FileFormatBuilder.

func (*FileFormatBuilder) WithEscapeUnenclosedField added in v0.34.0

func (ffb *FileFormatBuilder) WithEscapeUnenclosedField(s string) *FileFormatBuilder

WithEscapeUnenclosedField adds escape unenclosed field to the FileFormatBuilder.

func (*FileFormatBuilder) WithFieldDelimiter added in v0.34.0

func (ffb *FileFormatBuilder) WithFieldDelimiter(f string) *FileFormatBuilder

WithFieldDelimiter adds a field delimiter to the FileFormatBuilder.

func (*FileFormatBuilder) WithFieldOptionallyEnclosedBy added in v0.34.0

func (ffb *FileFormatBuilder) WithFieldOptionallyEnclosedBy(s string) *FileFormatBuilder

WithFieldOptionallyEnclosedBy adds field optionally enclosed by to the FileFormatBuilder.

func (*FileFormatBuilder) WithFileExtension added in v0.34.0

func (ffb *FileFormatBuilder) WithFileExtension(f string) *FileFormatBuilder

WithFileExtension adds a file extension to the FileFormatBuilder.

func (*FileFormatBuilder) WithFormatType added in v0.34.0

func (ffb *FileFormatBuilder) WithFormatType(f string) *FileFormatBuilder

WithFormatType adds a comment to the FileFormatBuilder.

func (*FileFormatBuilder) WithIgnoreUTF8Errors added in v0.34.0

func (ffb *FileFormatBuilder) WithIgnoreUTF8Errors(n bool) *FileFormatBuilder

WithIgnoreUTF8Errors adds ignore UTF8 errors to the FileFormatBuilder.

func (*FileFormatBuilder) WithNullIf added in v0.34.0

func (ffb *FileFormatBuilder) WithNullIf(s []string) *FileFormatBuilder

WithNullIf adds null if to the FileFormatBuilder.

func (*FileFormatBuilder) WithPreserveSpace added in v0.34.0

func (ffb *FileFormatBuilder) WithPreserveSpace(n bool) *FileFormatBuilder

WithPreserveSpace adds preserve space to the FileFormatBuilder.

func (*FileFormatBuilder) WithRecordDelimiter added in v0.34.0

func (ffb *FileFormatBuilder) WithRecordDelimiter(r string) *FileFormatBuilder

WithRecordDelimiter adds a record delimiter to the FileFormatBuilder.

func (*FileFormatBuilder) WithReplaceInvalidCharacters added in v0.34.0

func (ffb *FileFormatBuilder) WithReplaceInvalidCharacters(n bool) *FileFormatBuilder

WithReplaceInvalidCharacters adds replace invalid characters to the FileFormatBuilder.

func (*FileFormatBuilder) WithSkipBlankLines added in v0.34.0

func (ffb *FileFormatBuilder) WithSkipBlankLines(n bool) *FileFormatBuilder

WithSkipBlankLines adds skip blank lines to the FileFormatBuilder.

func (*FileFormatBuilder) WithSkipByteOrderMark added in v0.34.0

func (ffb *FileFormatBuilder) WithSkipByteOrderMark(n bool) *FileFormatBuilder

WithSkipByteOrderMark adds skip byte order mark to the FileFormatBuilder.

func (*FileFormatBuilder) WithSkipHeader added in v0.34.0

func (ffb *FileFormatBuilder) WithSkipHeader(n int) *FileFormatBuilder

WithSkipHeader adds skip header to the FileFormatBuilder.

func (*FileFormatBuilder) WithStripNullValues added in v0.34.0

func (ffb *FileFormatBuilder) WithStripNullValues(n bool) *FileFormatBuilder

WithStripNullValues adds strip null values to the FileFormatBuilder.

func (*FileFormatBuilder) WithStripOuterArray added in v0.34.0

func (ffb *FileFormatBuilder) WithStripOuterArray(n bool) *FileFormatBuilder

WithStripOuterArray adds strip outer array to the FileFormatBuilder.

func (*FileFormatBuilder) WithStripOuterElement added in v0.34.0

func (ffb *FileFormatBuilder) WithStripOuterElement(n bool) *FileFormatBuilder

WithStripOuterElement adds strip outer element to the FileFormatBuilder.

func (*FileFormatBuilder) WithTimeFormat added in v0.34.0

func (ffb *FileFormatBuilder) WithTimeFormat(s string) *FileFormatBuilder

WithTimeFormat adds time format to the FileFormatBuilder.

func (*FileFormatBuilder) WithTimestampFormat added in v0.34.0

func (ffb *FileFormatBuilder) WithTimestampFormat(s string) *FileFormatBuilder

WithTimestampFormat adds timestamp format to the FileFormatBuilder.

func (*FileFormatBuilder) WithTrimSpace added in v0.34.0

func (ffb *FileFormatBuilder) WithTrimSpace(n bool) *FileFormatBuilder

WithTrimSpace adds trim space to the FileFormatBuilder.

func (*FileFormatBuilder) WithValidateUTF8 added in v0.34.0

func (ffb *FileFormatBuilder) WithValidateUTF8(n bool) *FileFormatBuilder

WithValidateUTF8 adds validate utf8 to the FileFormatBuilder.

type FunctionBuilder added in v0.34.0

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

FunctionBuilder abstracts the creation of Function.

func Function added in v0.34.0

func Function(db, schema, name string, argTypes []string) *FunctionBuilder

Function returns a pointer to a Builder that abstracts the DDL operations for a stored function.

Supported DDL operations are:

  • CREATE FUNCTION
  • ALTER FUNCTION
  • DROP FUNCTION
  • SHOW FUNCTION
  • DESCRIBE

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/user-defined-functions.html)

func (*FunctionBuilder) ArgTypes added in v0.34.0

func (pb *FunctionBuilder) ArgTypes() []string

Returns the argument types.

func (*FunctionBuilder) ArgumentsSignature added in v0.34.0

func (pb *FunctionBuilder) ArgumentsSignature() (string, error)

Returns the arguments signature of the function in a form <function>(<type>, <type>, ..) RETURN <type>.

func (*FunctionBuilder) ChangeComment added in v0.34.0

func (vb *FunctionBuilder) ChangeComment(c string) (string, error)

ChangeComment returns the SQL query that will update the comment on the function.

func (*FunctionBuilder) Create added in v0.34.0

func (pb *FunctionBuilder) Create() (string, error)

Create returns the SQL query that will create a new function.

func (*FunctionBuilder) Describe added in v0.34.0

func (pb *FunctionBuilder) Describe() (string, error)

To describe the function the name must be specified as fully qualified name including argument types.

func (*FunctionBuilder) Drop added in v0.34.0

func (pb *FunctionBuilder) Drop() (string, error)

Drop returns the SQL query that will drop the function.

func (*FunctionBuilder) QualifiedName added in v0.34.0

func (pb *FunctionBuilder) QualifiedName() (string, error)

QualifiedName prepends the db and schema and appends argument types.

func (*FunctionBuilder) QualifiedNameWithoutArguments added in v0.34.0

func (pb *FunctionBuilder) QualifiedNameWithoutArguments() (string, error)

QualifiedNameWithoutArguments prepends the db and schema if set.

func (*FunctionBuilder) RemoveComment added in v0.34.0

func (vb *FunctionBuilder) RemoveComment() (string, error)

RemoveComment returns the SQL query that will remove the comment on the function.

func (*FunctionBuilder) Rename added in v0.34.0

func (pb *FunctionBuilder) Rename(newName string) (string, error)

Rename returns the SQL query that will rename the function.

func (*FunctionBuilder) Show added in v0.34.0

func (pb *FunctionBuilder) Show() string

Show returns the SQL query that will show the row representing this function. This show statement returns all functions with the given name (overloaded ones).

func (*FunctionBuilder) WithArgs added in v0.34.0

func (pb *FunctionBuilder) WithArgs(args []map[string]string) *FunctionBuilder

WithArgs sets the args and argumentTypes on the FunctionBuilder.

func (*FunctionBuilder) WithComment added in v0.34.0

func (pb *FunctionBuilder) WithComment(c string) *FunctionBuilder

WithComment adds a comment to the FunctionBuilder.

func (*FunctionBuilder) WithHandler added in v0.34.0

func (pb *FunctionBuilder) WithHandler(s string) *FunctionBuilder

WithHandler sets the handler method for Java / Python function.

func (*FunctionBuilder) WithImports added in v0.34.0

func (pb *FunctionBuilder) WithImports(s []string) *FunctionBuilder

WithImports adds jar files to import for Java function or Python file for Python function.

func (*FunctionBuilder) WithLanguage added in v0.34.0

func (pb *FunctionBuilder) WithLanguage(s string) *FunctionBuilder

WithLanguage sets the language to SQL, JAVA or JAVASCRIPT.

func (*FunctionBuilder) WithNullInputBehavior added in v0.34.0

func (pb *FunctionBuilder) WithNullInputBehavior(s string) *FunctionBuilder

WithNullInputBehavior.

func (*FunctionBuilder) WithPackages added in v0.37.0

func (pb *FunctionBuilder) WithPackages(s []string) *FunctionBuilder

WithPackages.

func (*FunctionBuilder) WithReturnBehavior added in v0.34.0

func (pb *FunctionBuilder) WithReturnBehavior(s string) *FunctionBuilder

WithReturnBehavior.

func (*FunctionBuilder) WithReturnType added in v0.34.0

func (pb *FunctionBuilder) WithReturnType(s string) *FunctionBuilder

WithReturnType adds the data type of the return type to the FunctionBuilder.

func (*FunctionBuilder) WithRuntimeVersion added in v0.37.0

func (pb *FunctionBuilder) WithRuntimeVersion(r string) *FunctionBuilder

WithRuntimeVersion.

func (*FunctionBuilder) WithStatement added in v0.34.0

func (pb *FunctionBuilder) WithStatement(s string) *FunctionBuilder

WithStatement adds the SQL/JAVASCRIPT/JAVA statement to be used for the function.

func (*FunctionBuilder) WithTargetPath added in v0.34.0

func (pb *FunctionBuilder) WithTargetPath(s string) *FunctionBuilder

WithTargetPath sets the target path for compiled jar file for Java function or Python file for Python function.

type FutureGrantBuilder added in v0.34.0

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

FutureGrantBuilder abstracts the creation of FutureGrantExecutables.

func (*FutureGrantBuilder) GrantType added in v0.34.0

func (fgb *FutureGrantBuilder) GrantType() string

func (*FutureGrantBuilder) Name added in v0.34.0

func (fgb *FutureGrantBuilder) Name() string

Name returns the object name for this FutureGrantBuilder.

func (*FutureGrantBuilder) Role added in v0.34.0

Role returns a pointer to a FutureGrantExecutable for a role.

func (*FutureGrantBuilder) Share added in v0.34.0

Share is not implemented because future objects cannot be granted to shares.

func (*FutureGrantBuilder) Show added in v0.34.0

func (fgb *FutureGrantBuilder) Show() string

Show returns the SQL that will show all privileges on the grant.

type FutureGrantExecutable added in v0.34.0

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

FutureGrantExecutable abstracts the creation of SQL queries to build future grants for different future grant types.

func (*FutureGrantExecutable) Grant added in v0.34.0

func (fge *FutureGrantExecutable) Grant(p string, w bool) string

Grant returns the SQL that will grant future privileges on the grant to the grantee.

func (*FutureGrantExecutable) Revoke added in v0.34.0

func (fge *FutureGrantExecutable) Revoke(p string) []string

Revoke returns the SQL that will revoke future privileges on the grant from the grantee.

func (*FutureGrantExecutable) Show added in v0.34.0

func (fge *FutureGrantExecutable) Show() string

Show returns the SQL that will show all future grants on the schema.

type GrantBuilder added in v0.34.0

type GrantBuilder interface {
	Name() string
	GrantType() string
	Role(string) GrantExecutable
	Share(string) GrantExecutable
	Show() string
}

func AccountGrant added in v0.34.0

func AccountGrant() GrantBuilder

AccountGrant returns a pointer to a CurrentGrantBuilder for an account.

func DatabaseGrant added in v0.34.0

func DatabaseGrant(name string) GrantBuilder

DatabaseGrant returns a pointer to a CurrentGrantBuilder for a database.

func ExternalTableGrant added in v0.34.0

func ExternalTableGrant(db, schema, externalTable string) GrantBuilder

ExternalTableGrant returns a pointer to a CurrentGrantBuilder for an external table.

func FileFormatGrant added in v0.34.0

func FileFormatGrant(db, schema, fileFormat string) GrantBuilder

FileFormatGrant returns a pointer to a CurrentGrantBuilder for a file format.

func FunctionGrant added in v0.34.0

func FunctionGrant(db, schema, function string, argumentTypes []string) GrantBuilder

FunctionGrant returns a pointer to a CurrentGrantBuilder for a view.

func FutureExternalTableGrant added in v0.34.0

func FutureExternalTableGrant(db, schema string) GrantBuilder

FutureExternalTableGrant returns a pointer to a FutureGrantBuilder for a external table.

func FutureFileFormatGrant added in v0.34.0

func FutureFileFormatGrant(db, schema string) GrantBuilder

FutureFileFormatGrant returns a pointer to a FutureGrantBuilder for a file format.

func FutureFunctionGrant added in v0.34.0

func FutureFunctionGrant(db, schema string) GrantBuilder

FutureFunctionGrant returns a pointer to a FutureGrantBuilder for a function.

func FutureMaterializedViewGrant added in v0.34.0

func FutureMaterializedViewGrant(db, schema string) GrantBuilder

FutureMaterializedViewGrant returns a pointer to a FutureGrantBuilder for a view.

func FuturePipeGrant added in v0.34.0

func FuturePipeGrant(db, schema string) GrantBuilder

FuturePipeGrant returns a pointer to a FutureGrantBuilder for a pipe.

func FutureProcedureGrant added in v0.34.0

func FutureProcedureGrant(db, schema string) GrantBuilder

FutureProcedureGrant returns a pointer to a FutureGrantBuilder for a procedure.

func FutureSchemaGrant added in v0.34.0

func FutureSchemaGrant(db string) GrantBuilder

FutureSchemaGrant returns a pointer to a FutureGrantBuilder for a schema.

func FutureSequenceGrant added in v0.34.0

func FutureSequenceGrant(db, schema string) GrantBuilder

FutureSequenceGrant returns a pointer to a FutureGrantBuilder for a sequence.

func FutureStageGrant added in v0.34.0

func FutureStageGrant(db, schema string) GrantBuilder

FutureStageGrant returns a pointer to a FutureGrantBuilder for a stage.

func FutureStreamGrant added in v0.34.0

func FutureStreamGrant(db, schema string) GrantBuilder

FutureStreamGrant returns a pointer to a FutureGrantBuilder for a stream.

func FutureTableGrant added in v0.34.0

func FutureTableGrant(db, schema string) GrantBuilder

FutureTableGrant returns a pointer to a FutureGrantBuilder for a table.

func FutureTaskGrant added in v0.34.0

func FutureTaskGrant(db, schema string) GrantBuilder

FutureTaskGrant returns a pointer to a FutureGrantBuilder for a task.

func FutureViewGrant added in v0.34.0

func FutureViewGrant(db, schema string) GrantBuilder

FutureViewGrant returns a pointer to a FutureGrantBuilder for a view.

func IntegrationGrant added in v0.34.0

func IntegrationGrant(w string) GrantBuilder

IntegrationGrant returns a pointer to a CurrentGrantBuilder for an integration.

func MaskingPolicyGrant added in v0.34.0

func MaskingPolicyGrant(db, schema, maskingPolicy string) GrantBuilder

MaskingPolicyGrant returns a pointer to a CurrentGrantBuilder for a masking policy.

func MaterializedViewGrant added in v0.34.0

func MaterializedViewGrant(db, schema, view string) GrantBuilder

MaterializedViewGrant returns a pointer to a CurrentGrantBuilder for a materialized view.

func PipeGrant added in v0.34.0

func PipeGrant(db, schema, pipe string) GrantBuilder

PipeGrant returns a pointer to a CurrentGrantBuilder for a pipe.

func ProcedureGrant added in v0.34.0

func ProcedureGrant(db, schema, procedure string, argumentTypes []string) GrantBuilder

ProcedureGrant returns a pointer to a CurrentGrantBuilder for a procedure.

func ResourceMonitorGrant added in v0.34.0

func ResourceMonitorGrant(w string) GrantBuilder

ResourceMonitorGrant returns a pointer to a CurrentGrantBuilder for a resource monitor.

func RowAccessPolicyGrant added in v0.34.0

func RowAccessPolicyGrant(db, schema, rowAccessPolicy string) GrantBuilder

RowAccessPolicyGrant returns a pointer to a CurrentGrantBuilder for a masking policy.

func SchemaGrant added in v0.34.0

func SchemaGrant(db, schema string) GrantBuilder

SchemaGrant returns a pointer to a CurrentGrantBuilder for a schema.

func SequenceGrant added in v0.34.0

func SequenceGrant(db, schema, sequence string) GrantBuilder

SequenceGrant returns a pointer to a CurrentGrantBuilder for a sequence.

func StageGrant added in v0.34.0

func StageGrant(db, schema, stage string) GrantBuilder

StageGrant returns a pointer to a CurrentGrantBuilder for a stage.

func StreamGrant added in v0.34.0

func StreamGrant(db, schema, stream string) GrantBuilder

StreamGrant returns a pointer to a CurrentGrantBuilder for a stream.

func TableGrant added in v0.34.0

func TableGrant(db, schema, table string) GrantBuilder

TableGrant returns a pointer to a CurrentGrantBuilder for a table.

func TagGrant added in v0.41.0

func TagGrant(db, schema, tag string) GrantBuilder

TagGrant returns a pointer to a CurrentGrantBuilder for a tag grant.

func TaskGrant added in v0.34.0

func TaskGrant(db, schema, task string) GrantBuilder

TaskGrant returns a pointer to a CurrentGrantBuilder for a task.

func UserGrant added in v0.44.0

func UserGrant(w string) GrantBuilder

UserGrant returns a pointer to a CurrentGrantBuilder for a user.

func ViewGrant added in v0.34.0

func ViewGrant(db, schema, view string) GrantBuilder

ViewGrant returns a pointer to a CurrentGrantBuilder for a view.

func WarehouseGrant added in v0.34.0

func WarehouseGrant(w string) GrantBuilder

WarehouseGrant returns a pointer to a CurrentGrantBuilder for a warehouse.

type GrantExecutable added in v0.34.0

type GrantExecutable interface {
	Grant(p string, w bool) string
	Revoke(p string) []string
	Show() string
}

type MaskingPolicyBuilder added in v0.34.0

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

MaskingPolicyBuilder abstracts the creation of SQL queries for a Snowflake Masking Policy.

func MaskingPolicy added in v0.34.0

func MaskingPolicy(name, db, schema string) *MaskingPolicyBuilder

MaskingPolicy returns a pointer to a Builder that abstracts the DDL operations for a masking policy.

Supported DDL operations are:

  • CREATE MASKING POLICY
  • ALTER MASKING POLICY
  • DROP MASKING POLICY
  • SHOW MASKING POLICIES
  • DESCRIBE MASKING POLICY

[Snowflake Reference](https://docs.snowflake.com/en/user-guide/security-column-ddm.html)

func (*MaskingPolicyBuilder) ChangeComment added in v0.34.0

func (mpb *MaskingPolicyBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the masking policy.

func (*MaskingPolicyBuilder) ChangeMaskingExpression added in v0.34.0

func (mpb *MaskingPolicyBuilder) ChangeMaskingExpression(maskingExpression string) string

ChangeMaskingExpression returns the SQL query that will update the masking expression on the masking policy.

func (*MaskingPolicyBuilder) Create added in v0.34.0

func (mpb *MaskingPolicyBuilder) Create() string

Create returns the SQL query that will create a masking policy.

func (*MaskingPolicyBuilder) Describe added in v0.34.0

func (mpb *MaskingPolicyBuilder) Describe() string

Describe returns the SQL query that will describe a masking policy.

func (*MaskingPolicyBuilder) Drop added in v0.34.0

func (mpb *MaskingPolicyBuilder) Drop() string

Drop returns the SQL query that will drop a masking policy.

func (*MaskingPolicyBuilder) QualifiedName added in v0.34.0

func (mpb *MaskingPolicyBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*MaskingPolicyBuilder) RemoveComment added in v0.34.0

func (mpb *MaskingPolicyBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the masking policy.

func (*MaskingPolicyBuilder) Show added in v0.34.0

func (mpb *MaskingPolicyBuilder) Show() string

Show returns the SQL query that will show a masking policy.

func (*MaskingPolicyBuilder) WithComment added in v0.34.0

func (mpb *MaskingPolicyBuilder) WithComment(c string) *MaskingPolicyBuilder

WithComment adds a comment to the MaskingPolicyBuilder.

func (*MaskingPolicyBuilder) WithMaskingExpression added in v0.34.0

func (mpb *MaskingPolicyBuilder) WithMaskingExpression(maskingExpression string) *MaskingPolicyBuilder

WithMaskingExpression adds maskingExpression to the MaskingPolicyBuilder.

func (*MaskingPolicyBuilder) WithReturnDataType added in v0.34.0

func (mpb *MaskingPolicyBuilder) WithReturnDataType(dataType string) *MaskingPolicyBuilder

WithReturnDataType adds returnDataType to the MaskingPolicyBuilder.

func (*MaskingPolicyBuilder) WithValueDataType added in v0.34.0

func (mpb *MaskingPolicyBuilder) WithValueDataType(dataType string) *MaskingPolicyBuilder

WithValueDataType adds valueDataType to the MaskingPolicyBuilder.

type MaskingPolicyStruct added in v0.34.0

type MaskingPolicyStruct struct {
	CreatedOn    sql.NullString `db:"created_on"`
	Name         sql.NullString `db:"name"`
	DatabaseName sql.NullString `db:"database_name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Kind         sql.NullString `db:"kind"`
	Owner        sql.NullString `db:"owner"`
	Comment      sql.NullString `db:"comment"`
}

func ListMaskingPolicies added in v0.34.0

func ListMaskingPolicies(databaseName string, schemaName string, db *sql.DB) ([]MaskingPolicyStruct, error)

func ScanMaskingPolicies added in v0.34.0

func ScanMaskingPolicies(row *sqlx.Row) (*MaskingPolicyStruct, error)

type MaterializedViewBuilder added in v0.34.0

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

MaterializedViewBuilder abstracts the creation of SQL queries for a Snowflake Materialized View.

func MaterializedView added in v0.34.0

func MaterializedView(name string) *MaterializedViewBuilder

View returns a pointer to a Builder that abstracts the DDL operations for a view.

Supported DDL operations are:

  • CREATE MATERIALIZED VIEW
  • ALTER MATERIALIZED VIEW
  • DROP MATERIALIZED VIEW
  • SHOW MATERIALIZED VIEWS
  • DESCRIBE MATERIALIZED VIEW

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-table.html#materialized-view-management)

func (*MaterializedViewBuilder) AddTag added in v0.34.0

func (vb *MaterializedViewBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the view.

func (*MaterializedViewBuilder) ChangeComment added in v0.34.0

func (vb *MaterializedViewBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the view. Note that comment is the only parameter, if more are released this should be abstracted as per the generic builder.

func (*MaterializedViewBuilder) ChangeTag added in v0.34.0

func (vb *MaterializedViewBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the view.

func (*MaterializedViewBuilder) Create added in v0.34.0

func (vb *MaterializedViewBuilder) Create() []string

Create returns the SQL query that will create a new view.

func (*MaterializedViewBuilder) Drop added in v0.34.0

func (vb *MaterializedViewBuilder) Drop() string

Drop returns the SQL query that will drop the row representing this view.

func (*MaterializedViewBuilder) QualifiedName added in v0.34.0

func (vb *MaterializedViewBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*MaterializedViewBuilder) RemoveComment added in v0.34.0

func (vb *MaterializedViewBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the view. Note that comment is the only parameter, if more are released this should be abstracted as per the generic builder.

func (*MaterializedViewBuilder) Rename added in v0.34.0

func (vb *MaterializedViewBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the view.

func (*MaterializedViewBuilder) Secure added in v0.34.0

func (vb *MaterializedViewBuilder) Secure() string

Secure returns the SQL query that will change the view to a secure view.

func (*MaterializedViewBuilder) Show added in v0.34.0

func (vb *MaterializedViewBuilder) Show() string

Show returns the SQL query that will show the row representing this view.

func (*MaterializedViewBuilder) Unsecure added in v0.34.0

func (vb *MaterializedViewBuilder) Unsecure() string

Unsecure returns the SQL query that will change the view to a normal (unsecured) view.

func (*MaterializedViewBuilder) UnsetTag added in v0.34.0

func (vb *MaterializedViewBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the view.

func (*MaterializedViewBuilder) WithComment added in v0.34.0

WithComment adds a comment to the MaterializedViewBuilder.

func (*MaterializedViewBuilder) WithDB added in v0.34.0

WithDB adds the name of the database to the MaterializedViewBuilder.

func (*MaterializedViewBuilder) WithReplace added in v0.34.0

WithReplace adds the "OR REPLACE" option to the MaterializedViewBuilder.

func (*MaterializedViewBuilder) WithSchema added in v0.34.0

WithSchema adds the name of the schema to the MaterializedViewBuilder.

func (*MaterializedViewBuilder) WithSecure added in v0.34.0

WithSecure sets the secure boolean to true [Snowflake Reference](https://docs.snowflake.net/manuals/user-guide/views-secure.html)

func (*MaterializedViewBuilder) WithStatement added in v0.34.0

WithStatement adds the SQL statement to be used for the view.

func (*MaterializedViewBuilder) WithTags added in v0.34.0

WithTags sets the tags on the ExternalTableBuilder.

func (*MaterializedViewBuilder) WithWarehouse added in v0.34.0

WithWarehouse adds the name of the warehouse to the MaterializedViewBuilder.

type NetworkPolicyAttachmentStruct added in v0.34.0

type NetworkPolicyAttachmentStruct struct {
	Key   sql.NullString `db:"key"`
	Value sql.NullString `db:"value"`
	Level sql.NullString `db:"level"`
}

func ScanNetworkPolicyAttachment added in v0.34.0

func ScanNetworkPolicyAttachment(row *sqlx.Row) (*NetworkPolicyAttachmentStruct, error)

type NetworkPolicyBuilder added in v0.34.0

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

NetworkPolicyBuilder abstracts the creation of SQL queries for a Snowflake Network Policy.

func NetworkPolicy added in v0.34.0

func NetworkPolicy(name string) *NetworkPolicyBuilder

NetworkPolicy returns a pointer to a Builder that abstracts the DDL operations for a network policy.

Supported DDL operations are:

  • CREATE NETWORK POLICY
  • DROP NETWORK POLICY
  • SHOW NETWORK POLICIES

[Snowflake Reference](https://docs.snowflake.com/en/user-guide/network-policies.html)

func (*NetworkPolicyBuilder) ChangeComment added in v0.34.0

func (npb *NetworkPolicyBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the network policy.

func (*NetworkPolicyBuilder) ChangeIPList added in v0.47.0

func (npb *NetworkPolicyBuilder) ChangeIPList(listType string, ips []string) string

ChangeIpList returns the SQL query that will update the ip list (of the specified listType) on the network policy.

func (*NetworkPolicyBuilder) Create added in v0.34.0

func (npb *NetworkPolicyBuilder) Create() string

Create returns the SQL query that will create a network policy.

func (*NetworkPolicyBuilder) Describe added in v0.34.0

func (npb *NetworkPolicyBuilder) Describe() string

Describe returns the SQL query that will describe a network policy.

func (*NetworkPolicyBuilder) Drop added in v0.34.0

func (npb *NetworkPolicyBuilder) Drop() string

Drop returns the SQL query that will drop a network policy.

func (*NetworkPolicyBuilder) RemoveComment added in v0.34.0

func (npb *NetworkPolicyBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the network policy.

func (*NetworkPolicyBuilder) SetOnAccount added in v0.34.0

func (npb *NetworkPolicyBuilder) SetOnAccount() string

SetOnAccount returns the SQL query that will set the network policy globally on your Snowflake account.

func (*NetworkPolicyBuilder) SetOnUser added in v0.34.0

func (npb *NetworkPolicyBuilder) SetOnUser(u string) string

SetOnUser returns the SQL query that will set the network policy on a given user.

func (*NetworkPolicyBuilder) ShowAllNetworkPolicies added in v0.34.0

func (npb *NetworkPolicyBuilder) ShowAllNetworkPolicies() string

ShowAllNetworkPolicies returns the SQL query that will SHOW *all* network policies in the Snowflake account Snowflake's implementation of SHOW for network policies does *not* support limiting results with LIKE.

func (*NetworkPolicyBuilder) ShowOnAccount added in v0.34.0

func (npb *NetworkPolicyBuilder) ShowOnAccount() string

ShowOnAccount returns the SQL query that will SHOW network policy set on Account.

func (*NetworkPolicyBuilder) ShowOnUser added in v0.34.0

func (npb *NetworkPolicyBuilder) ShowOnUser(u string) string

ShowOnUser returns the SQL query that will SHOW network policy set on a specific User.

func (*NetworkPolicyBuilder) UnsetOnAccount added in v0.34.0

func (npb *NetworkPolicyBuilder) UnsetOnAccount() string

UnsetOnAccount returns the SQL query that will unset the network policy globally on your Snowflake account.

func (*NetworkPolicyBuilder) UnsetOnUser added in v0.34.0

func (npb *NetworkPolicyBuilder) UnsetOnUser(u string) string

UnsetOnUser returns the SQL query that will unset the network policy of a given user.

func (*NetworkPolicyBuilder) WithAllowedIPList added in v0.47.0

func (npb *NetworkPolicyBuilder) WithAllowedIPList(allowedIps []string) *NetworkPolicyBuilder

WithAllowedIPList adds an allowedIpList to the NetworkPolicyBuilder.

func (*NetworkPolicyBuilder) WithBlockedIPList added in v0.47.0

func (npb *NetworkPolicyBuilder) WithBlockedIPList(blockedIps []string) *NetworkPolicyBuilder

WithBlockedIPList adds a blockedIpList to the NetworkPolicyBuilder.

func (*NetworkPolicyBuilder) WithComment added in v0.34.0

func (npb *NetworkPolicyBuilder) WithComment(c string) *NetworkPolicyBuilder

WithComment adds a comment to the NetworkPolicyBuilder.

type NetworkPolicyStruct added in v0.34.0

type NetworkPolicyStruct struct {
	CreatedOn              sql.NullString `db:"created_on"`
	Name                   sql.NullString `db:"name"`
	Comment                sql.NullString `db:"comment"`
	EntriesInAllowedIPList sql.NullString `db:"entries_in_allowed_ip_list"`
	EntriesInBlockedIPList sql.NullString `db:"entries_in_blocked_ip_list"`
}

func ScanNetworkPolicies added in v0.34.0

func ScanNetworkPolicies(rows *sqlx.Rows) ([]*NetworkPolicyStruct, error)

ScanNetworkPolicies takes database rows and converts them to a list of NetworkPolicyStruct pointers.

type PipeBuilder added in v0.34.0

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

PipeBuilder abstracts the creation of SQL queries for a Snowflake schema.

func Pipe added in v0.34.0

func Pipe(name, db, schema string) *PipeBuilder

Pipe returns a pointer to a Builder that abstracts the DDL operations for a pipe.

Supported DDL operations are:

  • CREATE PIPE
  • ALTER PIPE
  • DROP PIPE
  • SHOW PIPE

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-pipe.html#pipe-management)

func (*PipeBuilder) ChangeComment added in v0.34.0

func (pb *PipeBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the pipe.

func (*PipeBuilder) ChangeErrorIntegration added in v0.34.0

func (pb *PipeBuilder) ChangeErrorIntegration(c string) string

ChangeErrorIntegration return SQL query that will update the error_integration on the pipe.

func (*PipeBuilder) Create added in v0.34.0

func (pb *PipeBuilder) Create() string

Create returns the SQL statement required to create a pipe.

func (*PipeBuilder) Drop added in v0.34.0

func (pb *PipeBuilder) Drop() string

Drop returns the SQL query that will drop a pipe.

func (*PipeBuilder) QualifiedName added in v0.34.0

func (pb *PipeBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*PipeBuilder) RemoveComment added in v0.34.0

func (pb *PipeBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the pipe.

func (*PipeBuilder) RemoveErrorIntegration added in v0.34.0

func (pb *PipeBuilder) RemoveErrorIntegration() string

RemoveErrorIntegration returns the SQL query that will remove the error_integration on the pipe.

func (*PipeBuilder) Show added in v0.34.0

func (pb *PipeBuilder) Show() string

Show returns the SQL query that will show a pipe.

func (*PipeBuilder) WithAutoIngest added in v0.34.0

func (pb *PipeBuilder) WithAutoIngest() *PipeBuilder

WithAutoIngest adds the auto_ingest flag to the PipeBuilder.

func (*PipeBuilder) WithAwsSnsTopicArn added in v0.34.0

func (pb *PipeBuilder) WithAwsSnsTopicArn(s string) *PipeBuilder

WithAwsSnsTopicArn adds the aws_sns_topic to the PipeBuilder.

func (*PipeBuilder) WithComment added in v0.34.0

func (pb *PipeBuilder) WithComment(c string) *PipeBuilder

WithComment adds a comment to the PipeBuilder.

func (*PipeBuilder) WithCopyStatement added in v0.34.0

func (pb *PipeBuilder) WithCopyStatement(s string) *PipeBuilder

WithCopyStatement adds a URL to the PipeBuilder.

func (*PipeBuilder) WithErrorIntegration added in v0.34.0

func (pb *PipeBuilder) WithErrorIntegration(s string) *PipeBuilder

/ WithErrorIntegration adds ErrorIntegration specification to the PipeBuilder.

func (*PipeBuilder) WithIntegration added in v0.34.0

func (pb *PipeBuilder) WithIntegration(s string) *PipeBuilder

/ WithIntegration adds Integration specification to the PipeBuilder.

type PrimaryKey added in v0.34.0

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

PrimaryKey structure that represents a tables primary key.

func (*PrimaryKey) WithKeys added in v0.34.0

func (pk *PrimaryKey) WithKeys(keys []string) *PrimaryKey

WithKeys set the primary key keys.

func (*PrimaryKey) WithName added in v0.34.0

func (pk *PrimaryKey) WithName(name string) *PrimaryKey

WithName set the primary key name.

type PrivateLinkConfig added in v0.34.0

type PrivateLinkConfig struct {
	AccountName               string
	AwsVpceID                 string
	AzurePrivateLinkServiceID string
	AccountURL                string
	OCSPURL                   string
}

type ProcedureBuilder added in v0.34.0

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

ProcedureBuilder abstracts the creation of Stored Procedure.

func Procedure added in v0.34.0

func Procedure(db, schema, name string, argTypes []string) *ProcedureBuilder

Procedure returns a pointer to a Builder that abstracts the DDL operations for a stored procedure.

Supported DDL operations are:

  • CREATE PROCEDURE
  • ALTER PROCEDURE
  • DROP PROCEDURE
  • SHOW PROCEDURE
  • DESCRIBE

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/stored-procedures.html)

func (*ProcedureBuilder) ArgTypes added in v0.34.0

func (pb *ProcedureBuilder) ArgTypes() []string

Returns the argument types.

func (*ProcedureBuilder) ArgumentsSignature added in v0.34.0

func (pb *ProcedureBuilder) ArgumentsSignature() (string, error)

Returns the arguments signature of the procedure in a form <PROCEDURE>(<TYPE>, <TYPE>, ..)

func (*ProcedureBuilder) ChangeComment added in v0.34.0

func (vb *ProcedureBuilder) ChangeComment(c string) (string, error)

ChangeComment returns the SQL query that will update the comment on the procedure.

func (*ProcedureBuilder) ChangeExecuteAs added in v0.34.0

func (vb *ProcedureBuilder) ChangeExecuteAs(c string) (string, error)

ChangeExecuteAs returns the SQL query that will update the call mode on the procedure.

func (*ProcedureBuilder) Create added in v0.34.0

func (pb *ProcedureBuilder) Create() (string, error)

Create returns the SQL query that will create a new procedure.

func (*ProcedureBuilder) Describe added in v0.34.0

func (pb *ProcedureBuilder) Describe() (string, error)

To describe the procedure the name must be specified as fully qualified name including argument types.

func (*ProcedureBuilder) Drop added in v0.34.0

func (pb *ProcedureBuilder) Drop() (string, error)

Drop returns the SQL query that will drop the procedure.

func (*ProcedureBuilder) QualifiedName added in v0.34.0

func (pb *ProcedureBuilder) QualifiedName() (string, error)

QualifiedName prepends the db and schema and appends argument types.

func (*ProcedureBuilder) QualifiedNameWithoutArguments added in v0.34.0

func (pb *ProcedureBuilder) QualifiedNameWithoutArguments() (string, error)

QualifiedNameWithoutArguments prepends the db and schema if set.

func (*ProcedureBuilder) RemoveComment added in v0.34.0

func (vb *ProcedureBuilder) RemoveComment() (string, error)

RemoveComment returns the SQL query that will remove the comment on the procedure.

func (*ProcedureBuilder) Rename added in v0.34.0

func (pb *ProcedureBuilder) Rename(newName string) (string, error)

Rename returns the SQL query that will rename the procedure.

func (*ProcedureBuilder) Show added in v0.34.0

func (pb *ProcedureBuilder) Show() string

Show returns the SQL query that will show the row representing this procedure. This show statement returns all procedures with the given name (overloaded ones).

func (*ProcedureBuilder) WithArgs added in v0.34.0

func (pb *ProcedureBuilder) WithArgs(args []map[string]string) *ProcedureBuilder

WithArgs sets the args and argumentTypes on the ProcedureBuilder.

func (*ProcedureBuilder) WithComment added in v0.34.0

func (pb *ProcedureBuilder) WithComment(c string) *ProcedureBuilder

WithComment adds a comment to the ProcedureBuilder.

func (*ProcedureBuilder) WithExecuteAs added in v0.34.0

func (pb *ProcedureBuilder) WithExecuteAs(s string) *ProcedureBuilder

WithExecuteAs sets the execute to OWNER or CALLER.

func (*ProcedureBuilder) WithLanguage added in v0.35.0

func (pb *ProcedureBuilder) WithLanguage(s string) *ProcedureBuilder

WithLanguage sets the language to SQL, JAVA, SCALA or JAVASCRIPT.

func (*ProcedureBuilder) WithNullInputBehavior added in v0.34.0

func (pb *ProcedureBuilder) WithNullInputBehavior(s string) *ProcedureBuilder

WithNullInputBehavior.

func (*ProcedureBuilder) WithReturnBehavior added in v0.34.0

func (pb *ProcedureBuilder) WithReturnBehavior(s string) *ProcedureBuilder

WithReturnBehavior.

func (*ProcedureBuilder) WithReturnType added in v0.34.0

func (pb *ProcedureBuilder) WithReturnType(s string) *ProcedureBuilder

WithReturnType adds the data type of the return type to the ProcedureBuilder.

func (*ProcedureBuilder) WithStatement added in v0.34.0

func (pb *ProcedureBuilder) WithStatement(s string) *ProcedureBuilder

WithStatement adds the SQL statement to be used for the procedure.

type RawPrivateLinkConfig added in v0.34.0

type RawPrivateLinkConfig struct {
	Config string `db:"config"`
}

func ScanPrivateLinkConfig added in v0.34.0

func ScanPrivateLinkConfig(row *sqlx.Row) (*RawPrivateLinkConfig, error)

func (*RawPrivateLinkConfig) GetStructuredConfig added in v0.34.0

func (r *RawPrivateLinkConfig) GetStructuredConfig() (*PrivateLinkConfig, error)

type RawSnowflakePlatformInfo added in v0.34.0

type RawSnowflakePlatformInfo struct {
	Info string `db:"INFO"`
}

func ScanSnowflakePlatformInfo added in v0.34.0

func ScanSnowflakePlatformInfo(row *sqlx.Row) (*RawSnowflakePlatformInfo, error)

func (*RawSnowflakePlatformInfo) GetStructuredConfig added in v0.34.0

func (r *RawSnowflakePlatformInfo) GetStructuredConfig() (*SnowflakePlatformInfo, error)

type ReplicationBuilder added in v0.34.0

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

ReplicationBuilder is a basic builder that enables replication on databases.

func Replication added in v0.34.0

func Replication(database string) *ReplicationBuilder

DatabaseFromDatabase returns a pointer to a builder that can create a database from a source database.

func (*ReplicationBuilder) Show added in v0.34.0

func (rb *ReplicationBuilder) Show() string

type ResourceMonitorBuilder added in v0.34.0

type ResourceMonitorBuilder struct {
	Builder
}

ResourceMonitorBuilder extends the generic builder to provide support for triggers.

func ResourceMonitor added in v0.34.0

func ResourceMonitor(name string) *ResourceMonitorBuilder

ResourceMonitor returns a pointer to a ResourceMonitorBuilder that abstracts the DDL operations for a resource monitor.

Supported DDL operations are:

  • CREATE RESOURCE MONITOR
  • ALTER RESOURCE MONITOR
  • DROP RESOURCE MONITOR
  • SHOW RESOURCE MONITOR

[Snowflake Reference](https://docs.snowflake.net/manuals/user-guide/resource-monitors.html#ddl-for-resource-monitors)

func (*ResourceMonitorBuilder) Create added in v0.34.0

Create returns a pointer to a ResourceMonitorCreateBuilder.

type ResourceMonitorCreateBuilder added in v0.34.0

type ResourceMonitorCreateBuilder struct {
	CreateBuilder
	// contains filtered or unexported fields
}

ResourceMonitorCreateBuilder extends the generic create builder to provide support for triggers.

func (*ResourceMonitorCreateBuilder) NotifyAt added in v0.34.0

NotifyAt adds a notify trigger at the specified percentage threshold.

func (*ResourceMonitorCreateBuilder) SetOnAccount added in v0.34.0

func (rcb *ResourceMonitorCreateBuilder) SetOnAccount() string

SetOnAccount returns the SQL query that will set the resource monitor globally on your Snowflake account.

func (*ResourceMonitorCreateBuilder) SetOnWarehouse added in v0.34.0

func (rcb *ResourceMonitorCreateBuilder) SetOnWarehouse(warehouse string) string

SetOnWarehouse returns the SQL query that will set the resource monitor on the specified warehouse.

func (*ResourceMonitorCreateBuilder) Statement added in v0.34.0

func (rcb *ResourceMonitorCreateBuilder) Statement() string

Statement returns the SQL statement needed to actually create the resource.

func (*ResourceMonitorCreateBuilder) SuspendAt added in v0.34.0

SuspendAt adds a suspend trigger at the specified percentage threshold.

func (*ResourceMonitorCreateBuilder) SuspendImmediatelyAt added in v0.34.0

func (rcb *ResourceMonitorCreateBuilder) SuspendImmediatelyAt(pct int) *ResourceMonitorCreateBuilder

SuspendImmediatelyAt adds a suspend immediately trigger at the specified percentage threshold.

type RoleGrantBuilder

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

func RoleGrant

func RoleGrant(name string) *RoleGrantBuilder

func (*RoleGrantBuilder) Role

func (*RoleGrantBuilder) User

type RoleGrantExecutable

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

func (*RoleGrantExecutable) Grant

func (gr *RoleGrantExecutable) Grant() string

func (*RoleGrantExecutable) Revoke

func (gr *RoleGrantExecutable) Revoke() string

type RoleOwnershipGrantBuilder added in v0.34.0

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

func RoleOwnershipGrant added in v0.34.0

func RoleOwnershipGrant(role string, currentGrants string) *RoleOwnershipGrantBuilder

func (*RoleOwnershipGrantBuilder) Role added in v0.34.0

type RoleOwnershipGrantExecutable added in v0.34.0

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

func (*RoleOwnershipGrantExecutable) Grant added in v0.34.0

func (*RoleOwnershipGrantExecutable) Revoke added in v0.34.0

func (gr *RoleOwnershipGrantExecutable) Revoke() string

type RowAccessPolicyBuilder added in v0.34.0

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

RowAccessPolicyBuilder abstracts the creation of SQL queries for a Snowflake Row Access Policy.

func RowAccessPolicy added in v0.34.0

func RowAccessPolicy(name, db, schema string) *RowAccessPolicyBuilder

RowAccessPolicy returns a pointer to a Builder that abstracts the DDL operations for a row access policy.

Supported DDL operations are:

  • CREATE ROW ACCESS POLICY
  • ALTER ROW ACCESS POLICY
  • DROP ROW ACCESS POLICY
  • SHOW ROW ACCESS POLICIES
  • DESCRIBE ROW ACCESS POLICY

func (*RowAccessPolicyBuilder) ChangeComment added in v0.34.0

func (rapb *RowAccessPolicyBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the row access policy.

func (*RowAccessPolicyBuilder) ChangeRowAccessExpression added in v0.34.0

func (rapb *RowAccessPolicyBuilder) ChangeRowAccessExpression(rowAccessExpression string) string

ChangeRowAccessExpression returns the SQL query that will update the row access expression on the row access policy.

func (*RowAccessPolicyBuilder) Create added in v0.34.0

func (rapb *RowAccessPolicyBuilder) Create() string

Create returns the SQL query that will create a row access policy.

func (*RowAccessPolicyBuilder) Describe added in v0.34.0

func (rapb *RowAccessPolicyBuilder) Describe() string

Describe returns the SQL query that will describe a row access policy.

func (*RowAccessPolicyBuilder) Drop added in v0.34.0

func (rapb *RowAccessPolicyBuilder) Drop() string

Drop returns the SQL query that will drop a row access policy.

func (*RowAccessPolicyBuilder) QualifiedName added in v0.34.0

func (rapb *RowAccessPolicyBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*RowAccessPolicyBuilder) RemoveComment added in v0.34.0

func (rapb *RowAccessPolicyBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the row access policy.

func (*RowAccessPolicyBuilder) Show added in v0.34.0

func (rapb *RowAccessPolicyBuilder) Show() string

Show returns the SQL query that will show a row access policy.

func (*RowAccessPolicyBuilder) WithComment added in v0.34.0

WithComment adds a comment to the RowAccessPolicyBuilder.

func (*RowAccessPolicyBuilder) WithRowAccessExpression added in v0.34.0

func (rapb *RowAccessPolicyBuilder) WithRowAccessExpression(rowAccessExpression string) *RowAccessPolicyBuilder

WithRowAccessExpression adds rowAccessExpression to the RowAccessPolicyBuilder.

func (*RowAccessPolicyBuilder) WithSignature added in v0.34.0

func (rapb *RowAccessPolicyBuilder) WithSignature(signature map[string]interface{}) *RowAccessPolicyBuilder

WithSignature adds signature to the RowAccessPolicyBuilder.

type RowAccessPolicyStruct added in v0.34.0

type RowAccessPolicyStruct struct {
	CreatedOn    sql.NullString `db:"created_on"`
	Name         sql.NullString `db:"name"`
	DatabaseName sql.NullString `db:"database_name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Kind         sql.NullString `db:"kind"`
	Owner        sql.NullString `db:"owner"`
	Comment      sql.NullString `db:"comment"`
}

func ListRowAccessPolicies added in v0.34.0

func ListRowAccessPolicies(databaseName string, schemaName string, db *sql.DB) ([]RowAccessPolicyStruct, error)

func ScanRowAccessPolicies added in v0.34.0

func ScanRowAccessPolicies(row *sqlx.Row) (*RowAccessPolicyStruct, error)

type SchemaBuilder added in v0.34.0

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

SchemaBuilder abstracts the creation of SQL queries for a Snowflake schema.

func Schema added in v0.34.0

func Schema(name string) *SchemaBuilder

Schema returns a pointer to a Builder that abstracts the DDL operations for a schema.

Supported DDL operations are:

  • CREATE SCHEMA
  • ALTER SCHEMA
  • DROP SCHEMA
  • UNDROP SCHEMA
  • USE SCHEMA
  • SHOW SCHEMAS

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-database.html#schema-management)

func (*SchemaBuilder) AddTag added in v0.34.0

func (sb *SchemaBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the schema.

func (*SchemaBuilder) ChangeComment added in v0.34.0

func (sb *SchemaBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the schema.

func (*SchemaBuilder) ChangeDataRetentionDays added in v0.34.0

func (sb *SchemaBuilder) ChangeDataRetentionDays(d int) string

ChangeDataRetentionDays returns the SQL query that will update the data retention days on the schema.

func (*SchemaBuilder) ChangeTag added in v0.34.0

func (sb *SchemaBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the schema.

func (*SchemaBuilder) Create added in v0.34.0

func (sb *SchemaBuilder) Create() string

Create returns the SQL query that will create a new schema.

func (*SchemaBuilder) Drop added in v0.34.0

func (sb *SchemaBuilder) Drop() string

Drop returns the SQL query that will drop a schema.

func (*SchemaBuilder) Manage added in v0.34.0

func (sb *SchemaBuilder) Manage() string

Manage returns the SQL query that will enable managed access for a schema.

func (*SchemaBuilder) Managed added in v0.34.0

func (sb *SchemaBuilder) Managed() *SchemaBuilder

Managed adds the WITH MANAGED ACCESS flag to the SchemaBuilder.

func (*SchemaBuilder) QualifiedName added in v0.34.0

func (sb *SchemaBuilder) QualifiedName() string

QualifiedName prepends the db if set and escapes everything nicely.

func (*SchemaBuilder) RemoveComment added in v0.34.0

func (sb *SchemaBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the schema.

func (*SchemaBuilder) RemoveDataRetentionDays added in v0.34.0

func (sb *SchemaBuilder) RemoveDataRetentionDays() string

RemoveDataRetentionDays returns the SQL query that will remove the data retention days on the schema.

func (*SchemaBuilder) Rename added in v0.34.0

func (sb *SchemaBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the schema.

func (*SchemaBuilder) Show added in v0.34.0

func (sb *SchemaBuilder) Show() string

Show returns the SQL query that will show a schema.

func (*SchemaBuilder) Swap added in v0.34.0

func (sb *SchemaBuilder) Swap(targetSchema string) string

Swap returns the SQL query that Swaps all objects (tables, views, etc.) and metadata, including identifiers, between the two specified schemas.

func (*SchemaBuilder) Transient added in v0.34.0

func (sb *SchemaBuilder) Transient() *SchemaBuilder

Transient adds the TRANSIENT flag to the SchemaBuilder.

func (*SchemaBuilder) Undrop added in v0.34.0

func (sb *SchemaBuilder) Undrop() string

Undrop returns the SQL query that will undrop a schema.

func (*SchemaBuilder) Unmanage added in v0.34.0

func (sb *SchemaBuilder) Unmanage() string

Unmanage returns the SQL query that will disble managed access for a schema.

func (*SchemaBuilder) UnsetTag added in v0.34.0

func (sb *SchemaBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the schema.

func (*SchemaBuilder) Use added in v0.34.0

func (sb *SchemaBuilder) Use() string

Use returns the SQL query that will use a schema.

func (*SchemaBuilder) WithComment added in v0.34.0

func (sb *SchemaBuilder) WithComment(c string) *SchemaBuilder

WithComment adds a comment to the SchemaBuilder.

func (*SchemaBuilder) WithDB added in v0.34.0

func (sb *SchemaBuilder) WithDB(db string) *SchemaBuilder

WithDB adds the name of the database to the SchemaBuilder.

func (*SchemaBuilder) WithDataRetentionDays added in v0.34.0

func (sb *SchemaBuilder) WithDataRetentionDays(d int) *SchemaBuilder

WithDataRetentionDays adds the days to retain data to the SchemaBuilder (must be 0-1 for standard edition, 0-90 for enterprise edition).

func (*SchemaBuilder) WithTags added in v0.34.0

func (sb *SchemaBuilder) WithTags(tags []TagValue) *SchemaBuilder

WithTags sets the tags on the SchemaBuilder.

type SequenceBuilder added in v0.34.0

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

func Sequence added in v0.34.0

func Sequence(name, db, schema string) *SequenceBuilder

Sequence returns a pointer to a Builder for a sequence.

func (*SequenceBuilder) Address added in v0.34.0

func (sb *SequenceBuilder) Address() string

func (*SequenceBuilder) Create added in v0.34.0

func (sb *SequenceBuilder) Create() string

func (*SequenceBuilder) Drop added in v0.34.0

func (sb *SequenceBuilder) Drop() string

Drop returns the SQL query that will drop a sequence.

func (*SequenceBuilder) QualifiedName added in v0.34.0

func (sb *SequenceBuilder) QualifiedName() string

func (*SequenceBuilder) Show added in v0.34.0

func (sb *SequenceBuilder) Show() string

Show returns the SQL query that will show a sequence.

func (*SequenceBuilder) WithComment added in v0.34.0

func (sb *SequenceBuilder) WithComment(comment string) *SequenceBuilder

func (*SequenceBuilder) WithIncrement added in v0.34.0

func (sb *SequenceBuilder) WithIncrement(increment int) *SequenceBuilder

func (*SequenceBuilder) WithStart added in v0.34.0

func (sb *SequenceBuilder) WithStart(start int) *SequenceBuilder

type SettingBuilder added in v0.34.0

type SettingBuilder interface {
	SetString(string, string)
	SetStringList(string, []string)
	SetBool(string, bool)
	SetInt(string, int)
	SetFloat(string, float64)
	SetRaw(string)
}

SettingBuilder is an interface for a builder that allows you to set key value pairs.

type SnowflakePlatformInfo added in v0.34.0

type SnowflakePlatformInfo struct {
	AzureVnetSubnetIds []string
	AwsVpcIds          []string
}

type StageBuilder added in v0.34.0

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

StageBuilder abstracts the creation of SQL queries for a Snowflake stage.

func Stage added in v0.34.0

func Stage(name, db, schema string) *StageBuilder

Stage returns a pointer to a Builder that abstracts the DDL operations for a stage.

Supported DDL operations are:

  • CREATE STAGE
  • ALTER STAGE
  • DROP STAGE
  • UNDROP STAGE
  • DESCRIBE STAGE

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-stage.html#stage-management)

func (*StageBuilder) AddTag added in v0.34.0

func (sb *StageBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the view.

func (*StageBuilder) ChangeComment added in v0.34.0

func (sb *StageBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the stage.

func (*StageBuilder) ChangeCopyOptions added in v0.34.0

func (sb *StageBuilder) ChangeCopyOptions(c string) string

ChangeCopyOptions returns the SQL query that will update the copy options on the stage.

func (*StageBuilder) ChangeCredentials added in v0.34.0

func (sb *StageBuilder) ChangeCredentials(c string) string

ChangeCredentials returns the SQL query that will update the credentials on the stage.

func (*StageBuilder) ChangeEncryption added in v0.34.0

func (sb *StageBuilder) ChangeEncryption(e string) string

ChangeEncryption returns the SQL query that will update the encryption on the stage.

func (*StageBuilder) ChangeFileFormat added in v0.34.0

func (sb *StageBuilder) ChangeFileFormat(f string) string

ChangeFileFormat returns the SQL query that will update the file format on the stage.

func (*StageBuilder) ChangeStorageIntegration added in v0.34.0

func (sb *StageBuilder) ChangeStorageIntegration(s string) string

ChangeStorageIntegration returns the SQL query that will update the storage integration on the stage.

func (*StageBuilder) ChangeTag added in v0.34.0

func (sb *StageBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the view.

func (*StageBuilder) ChangeURL added in v0.34.0

func (sb *StageBuilder) ChangeURL(u string) string

ChangeURL returns the SQL query that will update the url on the stage.

func (*StageBuilder) Create added in v0.34.0

func (sb *StageBuilder) Create() string

Create returns the SQL query that will create a new stage.

func (*StageBuilder) Describe added in v0.34.0

func (sb *StageBuilder) Describe() string

Describe returns the SQL query that will describe a stage.

func (*StageBuilder) Drop added in v0.34.0

func (sb *StageBuilder) Drop() string

Drop returns the SQL query that will drop a stage.

func (*StageBuilder) QualifiedName added in v0.34.0

func (sb *StageBuilder) QualifiedName() string

QualifiedName prepends the db and schema and escapes everything nicely.

func (*StageBuilder) RemoveComment added in v0.34.0

func (sb *StageBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the stage.

func (*StageBuilder) Rename added in v0.34.0

func (sb *StageBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the stage.

func (*StageBuilder) Show added in v0.34.0

func (sb *StageBuilder) Show() string

Show returns the SQL query that will show a stage.

func (*StageBuilder) Undrop added in v0.34.0

func (sb *StageBuilder) Undrop() string

Undrop returns the SQL query that will undrop a stage.

func (*StageBuilder) UnsetTag added in v0.34.0

func (sb *StageBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the view.

func (*StageBuilder) WithComment added in v0.34.0

func (sb *StageBuilder) WithComment(c string) *StageBuilder

WithComment adds a comment to the StageBuilder.

func (*StageBuilder) WithCopyOptions added in v0.34.0

func (sb *StageBuilder) WithCopyOptions(c string) *StageBuilder

WithCopyOptions adds copy options to the StageBuilder.

func (*StageBuilder) WithCredentials added in v0.34.0

func (sb *StageBuilder) WithCredentials(c string) *StageBuilder

WithCredentials adds credentials to the StageBuilder.

func (*StageBuilder) WithDirectory added in v0.34.0

func (sb *StageBuilder) WithDirectory(d string) *StageBuilder

WithDirectory adds directory option to the StageBuilder.

func (*StageBuilder) WithEncryption added in v0.34.0

func (sb *StageBuilder) WithEncryption(e string) *StageBuilder

WithEncryption adds encryption to the StageBuilder.

func (*StageBuilder) WithFileFormat added in v0.34.0

func (sb *StageBuilder) WithFileFormat(f string) *StageBuilder

WithFileFormat adds a file format to the StageBuilder.

func (*StageBuilder) WithStorageIntegration added in v0.34.0

func (sb *StageBuilder) WithStorageIntegration(s string) *StageBuilder

WithStorageIntegration adds a storage integration to the StageBuilder.

func (*StageBuilder) WithTags added in v0.34.0

func (sb *StageBuilder) WithTags(tags []TagValue) *StageBuilder

WithTags sets the tags on the ExternalTableBuilder.

func (*StageBuilder) WithURL added in v0.34.0

func (sb *StageBuilder) WithURL(u string) *StageBuilder

WithURL adds a URL to the StageBuilder.

type StreamBuilder added in v0.34.0

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

StreamBuilder abstracts the creation of SQL queries for a Snowflake stream.

func Stream added in v0.34.0

func Stream(name, db, schema string) *StreamBuilder

Stream returns a pointer to a Builder that abstracts the DDL operations for a stream.

Supported DDL operations are:

  • CREATE Stream
  • ALTER Stream
  • DROP Stream
  • SHOW Stream

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/sql/create-stream.html)

func (*StreamBuilder) ChangeComment added in v0.34.0

func (sb *StreamBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the stream.

func (*StreamBuilder) Create added in v0.34.0

func (sb *StreamBuilder) Create() string

Create returns the SQL statement required to create a stream.

func (*StreamBuilder) Drop added in v0.34.0

func (sb *StreamBuilder) Drop() string

Drop returns the SQL query that will drop a stream.

func (*StreamBuilder) QualifiedName added in v0.34.0

func (sb *StreamBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*StreamBuilder) RemoveComment added in v0.34.0

func (sb *StreamBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the stream.

func (*StreamBuilder) Show added in v0.34.0

func (sb *StreamBuilder) Show() string

Show returns the SQL query that will show a stream.

func (*StreamBuilder) WithAppendOnly added in v0.34.0

func (sb *StreamBuilder) WithAppendOnly(b bool) *StreamBuilder

func (*StreamBuilder) WithComment added in v0.34.0

func (sb *StreamBuilder) WithComment(c string) *StreamBuilder

func (*StreamBuilder) WithExternalTable added in v0.35.0

func (sb *StreamBuilder) WithExternalTable(b bool) *StreamBuilder

func (*StreamBuilder) WithInsertOnly added in v0.34.0

func (sb *StreamBuilder) WithInsertOnly(b bool) *StreamBuilder

func (*StreamBuilder) WithOnTable added in v0.34.0

func (sb *StreamBuilder) WithOnTable(d string, s string, t string) *StreamBuilder

func (*StreamBuilder) WithOnView added in v0.40.0

func (sb *StreamBuilder) WithOnView(d string, s string, t string) *StreamBuilder

func (*StreamBuilder) WithShowInitialRows added in v0.34.0

func (sb *StreamBuilder) WithShowInitialRows(b bool) *StreamBuilder

type SystemGenerateSCIMAccessTokenBuilder added in v0.34.0

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

SystemGenerateSCIMAccessTokenBuilder abstracts calling the SYSTEM$GENERATE_SCIM_ACCESS_TOKEN system function.

func SystemGenerateSCIMAccessToken added in v0.34.0

func SystemGenerateSCIMAccessToken(integrationName string) *SystemGenerateSCIMAccessTokenBuilder

SystemGenerateSCIMAccessToken returns a pointer to a builder that abstracts calling the the SYSTEM$GENERATE_SCIM_ACCESS_TOKEN system function.

func (*SystemGenerateSCIMAccessTokenBuilder) Select added in v0.34.0

Select generates the select statement for obtaining the scim access token.

type SystemGetAWSSNSIAMPolicyBuilder added in v0.34.0

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

SystemGetAWSSNSIAMPolicyBuilder abstracts calling the SYSTEM$GET_AWS_SNS_IAM_POLICY system function.

func SystemGetAWSSNSIAMPolicy added in v0.34.0

func SystemGetAWSSNSIAMPolicy(awsSnsTopicArn string) *SystemGetAWSSNSIAMPolicyBuilder

SystemGetAWSSNSIAMPolicy returns a pointer to a builder that abstracts calling the the SYSTEM$GET_AWS_SNS_IAM_POLICY system function.

func (*SystemGetAWSSNSIAMPolicyBuilder) Select added in v0.34.0

Select generates the select statement for obtaining the aws sns iam policy.

type TableBuilder added in v0.34.0

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

TableBuilder abstracts the creation of SQL queries for a Snowflake schema.

func Table added in v0.34.0

func Table(name, db, schema string) *TableBuilder

Table returns a pointer to a Builder that abstracts the DDL operations for a table.

Supported DDL operations are:

  • ALTER TABLE
  • DROP TABLE
  • SHOW TABLES

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-table.html)

func TableWithColumnDefinitions added in v0.34.0

func TableWithColumnDefinitions(name, db, schema string, columns Columns) *TableBuilder

Table returns a pointer to a Builder that abstracts the DDL operations for a table.

Supported DDL operations are:

  • CREATE TABLE

[Snowflake Reference](https://docs.snowflake.com/en/sql-reference/ddl-table.html)

func (*TableBuilder) AddColumn added in v0.34.0

func (tb *TableBuilder) AddColumn(name string, dataType string, nullable bool, _default *ColumnDefault, identity *ColumnIdentity, comment string) string

AddColumn returns the SQL query that will add a new column to the table.

func (*TableBuilder) AddTag added in v0.34.0

func (tb *TableBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the table.

func (*TableBuilder) ChangeChangeTracking added in v0.34.0

func (tb *TableBuilder) ChangeChangeTracking(changeTracking bool) string

ChangeChangeTracking returns the SQL query that will update the CHANGE_TRACKING on the table.

func (*TableBuilder) ChangeClusterBy added in v0.34.0

func (tb *TableBuilder) ChangeClusterBy(cb string) string

ChangeClusterBy returns the SQL query to change cluastering on table.

func (*TableBuilder) ChangeColumnComment added in v0.34.0

func (tb *TableBuilder) ChangeColumnComment(name string, comment string) string

func (*TableBuilder) ChangeColumnType added in v0.34.0

func (tb *TableBuilder) ChangeColumnType(name string, dataType string) string

ChangeColumnType returns the SQL query that will change the type of the named column to the given type.

func (*TableBuilder) ChangeComment added in v0.34.0

func (tb *TableBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the table.

func (*TableBuilder) ChangeDataRetention added in v0.34.0

func (tb *TableBuilder) ChangeDataRetention(days int) string

ChangeDataRetention returns the SQL query that will update the DATA_RETENTION_TIME_IN_DAYS on the table.

func (*TableBuilder) ChangeNullConstraint added in v0.34.0

func (tb *TableBuilder) ChangeNullConstraint(name string, nullable bool) string

Return sql to set/unset null constraint on column.

func (*TableBuilder) ChangePrimaryKey added in v0.34.0

func (tb *TableBuilder) ChangePrimaryKey(newPk PrimaryKey) string

func (*TableBuilder) ChangeTag added in v0.34.0

func (tb *TableBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the table.

func (*TableBuilder) Create added in v0.34.0

func (tb *TableBuilder) Create() string

Create returns the SQL statement required to create a table.

func (*TableBuilder) Drop added in v0.34.0

func (tb *TableBuilder) Drop() string

Drop returns the SQL query that will drop a table.

func (*TableBuilder) DropClustering added in v0.34.0

func (tb *TableBuilder) DropClustering() string

RemoveClustering returns the SQL query that will remove data clustering from the table.

func (*TableBuilder) DropColumn added in v0.34.0

func (tb *TableBuilder) DropColumn(name string) string

DropColumn returns the SQL query that will add a new column to the table.

func (*TableBuilder) DropColumnDefault added in v0.34.0

func (tb *TableBuilder) DropColumnDefault(name string) string

func (*TableBuilder) DropPrimaryKey added in v0.34.0

func (tb *TableBuilder) DropPrimaryKey() string

func (*TableBuilder) GetClusterKeyString added in v0.34.0

func (tb *TableBuilder) GetClusterKeyString() string

Function to get clustering definition.

func (*TableBuilder) GetTagValueString added in v0.34.0

func (tb *TableBuilder) GetTagValueString() string

func (*TableBuilder) QualifiedName added in v0.34.0

func (tb *TableBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*TableBuilder) RemoveComment added in v0.34.0

func (tb *TableBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the table.

func (*TableBuilder) Rename added in v0.34.0

func (tb *TableBuilder) Rename(newName string) string

func (*TableBuilder) Show added in v0.34.0

func (tb *TableBuilder) Show() string

Show returns the SQL query that will show a table.

func (*TableBuilder) ShowColumns added in v0.34.0

func (tb *TableBuilder) ShowColumns() string

func (*TableBuilder) ShowPrimaryKeys added in v0.34.0

func (tb *TableBuilder) ShowPrimaryKeys() string

func (*TableBuilder) UnsetTag added in v0.34.0

func (tb *TableBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the table.

func (*TableBuilder) WithChangeTracking added in v0.34.0

func (tb *TableBuilder) WithChangeTracking(changeTracking bool) *TableBuilder

WithChangeTracking sets the change tracking on the TableBuilder.

func (*TableBuilder) WithClustering added in v0.34.0

func (tb *TableBuilder) WithClustering(c []string) *TableBuilder

WithClustering adds cluster keys/expressions to TableBuilder.

func (*TableBuilder) WithColumns added in v0.34.0

func (tb *TableBuilder) WithColumns(c Columns) *TableBuilder

WithColumns sets the column definitions on the TableBuilder.

func (*TableBuilder) WithComment added in v0.34.0

func (tb *TableBuilder) WithComment(c string) *TableBuilder

WithComment adds a comment to the TableBuilder.

func (*TableBuilder) WithDataRetentionTimeInDays added in v0.34.0

func (tb *TableBuilder) WithDataRetentionTimeInDays(days int) *TableBuilder

WithDataRetentionTimeInDays sets the data retention time on the TableBuilder.

func (*TableBuilder) WithPrimaryKey added in v0.34.0

func (tb *TableBuilder) WithPrimaryKey(pk PrimaryKey) *TableBuilder

WithPrimaryKey sets the primary key on the TableBuilder.

func (*TableBuilder) WithTags added in v0.34.0

func (tb *TableBuilder) WithTags(tags []TagValue) *TableBuilder

WithTags sets the tags on the TableBuilder.

type TableConstraintBuilder added in v0.47.0

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

TableConstraintBuilder abstracts the creation of SQL queries for a Snowflake table constraint.

func TableConstraint added in v0.47.0

func TableConstraint(name string, constraintType string, tableID string) *TableConstraintBuilder

func (*TableConstraintBuilder) Create added in v0.47.0

func (b *TableConstraintBuilder) Create() string

Create returns the SQL query that will create a new table constraint.

func (*TableConstraintBuilder) Drop added in v0.47.0

func (b *TableConstraintBuilder) Drop() string

Drop returns the SQL query that will drop a table constraint.

func (*TableConstraintBuilder) Rename added in v0.47.0

func (b *TableConstraintBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the table constraint.

func (*TableConstraintBuilder) SetComment added in v0.47.0

func (b *TableConstraintBuilder) SetComment(c string) string

SetComment returns the SQL query that will update the comment on the table constraint.

func (*TableConstraintBuilder) WithColumns added in v0.47.0

func (b *TableConstraintBuilder) WithColumns(columns []string) *TableConstraintBuilder

WithColumns sets columns.

func (*TableConstraintBuilder) WithComment added in v0.47.0

func (b *TableConstraintBuilder) WithComment(comment string) *TableConstraintBuilder

WithComment sets comment.

func (*TableConstraintBuilder) WithDeferrable added in v0.47.0

func (b *TableConstraintBuilder) WithDeferrable(deferrable bool) *TableConstraintBuilder

WithDeferrable sets deferrable.

func (*TableConstraintBuilder) WithDelete added in v0.47.0

func (b *TableConstraintBuilder) WithDelete(onDelete string) *TableConstraintBuilder

WithDelete sets delete.

func (*TableConstraintBuilder) WithEnable added in v0.47.0

func (b *TableConstraintBuilder) WithEnable(enable bool) *TableConstraintBuilder

WithEnable sets enable.

func (*TableConstraintBuilder) WithEnforced added in v0.47.0

func (b *TableConstraintBuilder) WithEnforced(enforced bool) *TableConstraintBuilder

WithEnforced sets enforced.

func (*TableConstraintBuilder) WithInitially added in v0.47.0

func (b *TableConstraintBuilder) WithInitially(initially string) *TableConstraintBuilder

WithInitially sets initially.

func (*TableConstraintBuilder) WithMatch added in v0.47.0

WithMatch sets match.

func (*TableConstraintBuilder) WithReferenceColumns added in v0.47.0

func (b *TableConstraintBuilder) WithReferenceColumns(referenceColumns []string) *TableConstraintBuilder

WithReferenceColumns sets referenceColumns.

func (*TableConstraintBuilder) WithReferenceTableID added in v0.47.0

func (b *TableConstraintBuilder) WithReferenceTableID(referenceTableID string) *TableConstraintBuilder

WithReferenceTableID sets referenceTableID.

func (*TableConstraintBuilder) WithRely added in v0.47.0

WithRely sets rely.

func (*TableConstraintBuilder) WithUpdate added in v0.47.0

func (b *TableConstraintBuilder) WithUpdate(onUpdate string) *TableConstraintBuilder

WithUpdate sets update.

func (*TableConstraintBuilder) WithValidate added in v0.47.0

func (b *TableConstraintBuilder) WithValidate(validate bool) *TableConstraintBuilder

WithValidated sets validated.

type TagAssociationBuilder added in v0.42.0

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

TagAssociationBuilder abstracts the creation of SQL queries for a Snowflake tag.

func TagAssociation added in v0.42.0

func TagAssociation(tagID string) *TagAssociationBuilder

TagAssociation returns a pointer to a Builder that abstracts the DDL operations for a tag sssociation.

Supported DDL operations are:

  • CREATE TAG
  • DROP TAG

[Snowflake Reference](https://docs.snowflake.com/en/user-guide/object-tagging.html)

func (*TagAssociationBuilder) Create added in v0.42.0

func (tb *TagAssociationBuilder) Create() string

Create returns the SQL query that will set the tag on an object.

func (*TagAssociationBuilder) Drop added in v0.42.0

func (tb *TagAssociationBuilder) Drop() string

Drop returns the SQL query that will remove a tag from an object.

func (*TagAssociationBuilder) GetTagDatabase added in v0.42.0

func (tb *TagAssociationBuilder) GetTagDatabase() string

GetTagDatabase returns the value of the tag database of TagAssociationBuilder.

func (*TagAssociationBuilder) GetTagName added in v0.42.0

func (tb *TagAssociationBuilder) GetTagName() string

GetTagName returns the value of the tag name of TagAssociationBuilder.

func (*TagAssociationBuilder) GetTagSchema added in v0.42.0

func (tb *TagAssociationBuilder) GetTagSchema() string

GetTagSchema returns the value of the tag schema of TagAssociationBuilder.

func (*TagAssociationBuilder) WithObjectName added in v0.42.0

func (tb *TagAssociationBuilder) WithObjectName(objectName string) *TagAssociationBuilder

WithObjectId adds the name of the schema to the TagAssociationBuilder.

func (*TagAssociationBuilder) WithObjectType added in v0.42.0

func (tb *TagAssociationBuilder) WithObjectType(objectType string) *TagAssociationBuilder

WithObjectType adds the object type of the resource to add tag attachement to the TagAssociationBuilder.

func (*TagAssociationBuilder) WithTagValue added in v0.42.0

func (tb *TagAssociationBuilder) WithTagValue(tagValue string) *TagAssociationBuilder

WithTagValue adds the name of the tag value to the TagAssociationBuilder.

type TagBuilder added in v0.34.0

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

TagBuilder abstracts the creation of SQL queries for a Snowflake tag.

func Tag added in v0.34.0

func Tag(name string) *TagBuilder

Tag returns a pointer to a Builder that abstracts the DDL operations for a tag.

Supported DDL operations are:

  • CREATE TAG
  • ALTER TAG
  • DROP TAG
  • UNDROP TAG
  • SHOW TAGS

[Snowflake Reference](https://docs.snowflake.com/en/user-guide/object-tagging.html)

func (*TagBuilder) AddAllowedValues added in v0.35.0

func (tb *TagBuilder) AddAllowedValues(avs []string) string

AddAllowedValues returns the SQL query that will add the allowed_values.

func (*TagBuilder) AddMaskingPolicy added in v0.43.0

func (tb *TagBuilder) AddMaskingPolicy() string

AddMaskingPolicy returns the SQL query that will add a masking policy to a tag.

func (*TagBuilder) ChangeComment added in v0.34.0

func (tb *TagBuilder) ChangeComment(c string) string

ChangeComment returns the SQL query that will update the comment on the tag.

func (*TagBuilder) Create added in v0.34.0

func (tb *TagBuilder) Create() string

Create returns the SQL query that will create a new tag.

func (*TagBuilder) Drop added in v0.34.0

func (tb *TagBuilder) Drop() string

Drop returns the SQL query that will drop a tag.

func (*TagBuilder) DropAllowedValues added in v0.35.0

func (tb *TagBuilder) DropAllowedValues(davs []string) string

DropAllowedValues returns the SQL query that will drop the unwanted allowed_values.

func (*TagBuilder) QualifiedName added in v0.34.0

func (tb *TagBuilder) QualifiedName() string

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*TagBuilder) RemoveAllowedValues added in v0.35.0

func (tb *TagBuilder) RemoveAllowedValues() string

RemoveAllowedValues returns the SQL query that will remove the allowed_values from the tag.

func (*TagBuilder) RemoveComment added in v0.34.0

func (tb *TagBuilder) RemoveComment() string

RemoveComment returns the SQL query that will remove the comment on the tag.

func (*TagBuilder) RemoveMaskingPolicy added in v0.43.0

func (tb *TagBuilder) RemoveMaskingPolicy() string

ReamoveMaskingPolicy returns the SQL query that will remove a masking policy from a tag.

func (*TagBuilder) Rename added in v0.34.0

func (tb *TagBuilder) Rename(newName string) string

Rename returns the SQL query that will rename the tag.

func (*TagBuilder) Show added in v0.34.0

func (tb *TagBuilder) Show() string

Show returns the SQL query that will show a tag.

func (*TagBuilder) ShowAttachedPolicy added in v0.43.0

func (tb *TagBuilder) ShowAttachedPolicy() string

Returns sql to show a tag with a specific policy attached to it.

func (*TagBuilder) Undrop added in v0.34.0

func (tb *TagBuilder) Undrop() string

Undrop returns the SQL query that will undrop a tag.

func (*TagBuilder) WithAllowedValues added in v0.35.0

func (tb *TagBuilder) WithAllowedValues(av []string) *TagBuilder

WithAllowedValues adds the allowed values to the query.

func (*TagBuilder) WithComment added in v0.34.0

func (tb *TagBuilder) WithComment(c string) *TagBuilder

WithComment adds a comment to the TagBuilder.

func (*TagBuilder) WithDB added in v0.34.0

func (tb *TagBuilder) WithDB(db string) *TagBuilder

WithDB adds the name of the database to the TagBuilder.

func (*TagBuilder) WithMaskingPolicy added in v0.43.0

func (tb *TagBuilder) WithMaskingPolicy(mpb *MaskingPolicyBuilder) *TagBuilder

WithMaskingPolicy adds a pointer to a MaskingPolicyBuilder to the TagBuilder.

func (*TagBuilder) WithSchema added in v0.34.0

func (tb *TagBuilder) WithSchema(schema string) *TagBuilder

WithSchema adds the name of the schema to the TagBuilder.

type TagValue added in v0.34.0

type TagValue struct {
	Name     string
	Database string
	Schema   string
	Value    string
}

type TaskBuilder added in v0.34.0

type TaskBuilder struct {
	SQLStatement string
	// contains filtered or unexported fields
}

TaskBuilder abstracts the creation of sql queries for a snowflake task.

func Task added in v0.34.0

func Task(name, db, schema string) *TaskBuilder

Task returns a pointer to a Builder that abstracts the DDL operations for a task.

Supported DDL operations are:

  • CREATE TASK
  • ALTER TASK
  • DROP TASK
  • DESCRIBE TASK

[Snowflake Reference](https://docs.snowflake.com/en/user-guide/tasks-intro.html#task-ddl)

func (*TaskBuilder) AddDependency added in v0.34.0

func (tb *TaskBuilder) AddDependency(after string) string

AddDependency returns the sql that will add the after dependency for the task.

func (*TaskBuilder) AddSessionParameters added in v0.34.0

func (tb *TaskBuilder) AddSessionParameters(params map[string]interface{}) string

AddSessionParameters returns the sql that will remove the session parameters for the task.

func (*TaskBuilder) ChangeComment added in v0.34.0

func (tb *TaskBuilder) ChangeComment(newComment string) string

ChangeComment returns the sql that will change the comment for the task.

func (*TaskBuilder) ChangeCondition added in v0.34.0

func (tb *TaskBuilder) ChangeCondition(newCondition string) string

ChangeCondition returns the sql that will update the when condition for the task.

func (*TaskBuilder) ChangeErrorIntegration added in v0.34.0

func (tb *TaskBuilder) ChangeErrorIntegration(c string) string

ChangeErrorIntegration return SQL query that will update the error_integration on the task.

func (*TaskBuilder) ChangeSQLStatement added in v0.47.0

func (tb *TaskBuilder) ChangeSQLStatement(newStatement string) string

ChangeSQLStatement returns the sql that will update the sql the task executes.

func (*TaskBuilder) ChangeSchedule added in v0.34.0

func (tb *TaskBuilder) ChangeSchedule(newSchedule string) string

ChangeSchedule returns the sql that will change the schedule for the task.

func (*TaskBuilder) ChangeTimeout added in v0.34.0

func (tb *TaskBuilder) ChangeTimeout(newTimeout int) string

ChangeTimeout returns the sql that will change the user task timeout for the task.

func (*TaskBuilder) ChangeWarehouse added in v0.34.0

func (tb *TaskBuilder) ChangeWarehouse(newWh string) string

ChangeWarehouse returns the sql that will change the warehouse for the task.

func (*TaskBuilder) Create added in v0.34.0

func (tb *TaskBuilder) Create() string

Create returns the SQL that will create a new task.

func (*TaskBuilder) Describe added in v0.34.0

func (tb *TaskBuilder) Describe() string

Describe returns the sql that will describe a task.

func (*TaskBuilder) Drop added in v0.34.0

func (tb *TaskBuilder) Drop() string

Drop returns the sql that will remove the task.

func (*TaskBuilder) GetFullName added in v0.34.0

func (tb *TaskBuilder) GetFullName(in string) string

GetFullName prepends db and schema to in parameter.

func (*TaskBuilder) IsDisabled added in v0.34.0

func (tb *TaskBuilder) IsDisabled() bool

IsDisabled returns if the task builder is disabled.

func (*TaskBuilder) Name added in v0.34.0

func (tb *TaskBuilder) Name() string

Name returns the name of the task.

func (*TaskBuilder) QualifiedName added in v0.34.0

func (tb *TaskBuilder) QualifiedName() string

QualifiedName prepends the db and schema and escapes everything nicely.

func (*TaskBuilder) RemoveComment added in v0.34.0

func (tb *TaskBuilder) RemoveComment() string

RemoveComment returns the sql that will remove the comment for the task.

func (*TaskBuilder) RemoveDependency added in v0.34.0

func (tb *TaskBuilder) RemoveDependency(after string) string

RemoveDependency returns the sql that will remove the after dependency for the task.

func (*TaskBuilder) RemoveErrorIntegration added in v0.34.0

func (tb *TaskBuilder) RemoveErrorIntegration() string

RemoveErrorIntegration returns the SQL query that will remove the error_integration on the task.

func (*TaskBuilder) RemoveSchedule added in v0.34.0

func (tb *TaskBuilder) RemoveSchedule() string

RemoveSchedule returns the sql that will remove the schedule for the task.

func (*TaskBuilder) RemoveSessionParameters added in v0.34.0

func (tb *TaskBuilder) RemoveSessionParameters(params map[string]interface{}) string

RemoveSessionParameters returns the sql that will remove the session parameters for the task.

func (*TaskBuilder) RemoveTimeout added in v0.34.0

func (tb *TaskBuilder) RemoveTimeout() string

RemoveTimeout returns the sql that will remove the user task timeout for the task.

func (*TaskBuilder) Resume added in v0.34.0

func (tb *TaskBuilder) Resume() string

Resume returns the sql that will resume the task.

func (*TaskBuilder) SetDisabled added in v0.34.0

func (tb *TaskBuilder) SetDisabled() *TaskBuilder

SetDisabled disables the task builder.

func (*TaskBuilder) Show added in v0.34.0

func (tb *TaskBuilder) Show() string

Show returns the sql that will show a task.

func (*TaskBuilder) ShowParameters added in v0.34.0

func (tb *TaskBuilder) ShowParameters() string

ShowParameters returns the query to show the session parameters for the task.

func (*TaskBuilder) Suspend added in v0.34.0

func (tb *TaskBuilder) Suspend() string

Suspend returns the sql that will suspend the task.

func (*TaskBuilder) SwitchManagedWithInitialSize added in v0.34.0

func (tb *TaskBuilder) SwitchManagedWithInitialSize(initialSize string) string

SwitchManagedWithInitialSize returns the sql that will update warehouse initial size .

func (*TaskBuilder) SwitchWarehouseToManaged added in v0.34.0

func (tb *TaskBuilder) SwitchWarehouseToManaged() string

SwitchWarehouseToManaged returns the sql that will switch to managed warehouse.

func (*TaskBuilder) WithComment added in v0.34.0

func (tb *TaskBuilder) WithComment(c string) *TaskBuilder

WithComment adds a comment to the TaskBuilder.

func (*TaskBuilder) WithCondition added in v0.34.0

func (tb *TaskBuilder) WithCondition(when string) *TaskBuilder

WithCondition adds a when condition to the TaskBuilder.

func (*TaskBuilder) WithDependency added in v0.34.0

func (tb *TaskBuilder) WithDependency(after string) *TaskBuilder

WithDependency adds an after task dependency to the TaskBuilder.

func (*TaskBuilder) WithErrorIntegration added in v0.34.0

func (tb *TaskBuilder) WithErrorIntegration(s string) *TaskBuilder

/ WithErrorIntegration adds ErrorIntegration specification to the TaskBuilder.

func (*TaskBuilder) WithInitialWarehouseSize added in v0.34.0

func (tb *TaskBuilder) WithInitialWarehouseSize(initialWarehouseSize string) *TaskBuilder

WithInitialWarehouseSize adds an initial warehouse size to the TaskBuilder.

func (*TaskBuilder) WithSchedule added in v0.34.0

func (tb *TaskBuilder) WithSchedule(s string) *TaskBuilder

WithSchedule adds a schedule to the TaskBuilder.

func (*TaskBuilder) WithSessionParameters added in v0.34.0

func (tb *TaskBuilder) WithSessionParameters(params map[string]interface{}) *TaskBuilder

WithSessionParameters adds session parameters to the TaskBuilder.

func (*TaskBuilder) WithStatement added in v0.34.0

func (tb *TaskBuilder) WithStatement(sql string) *TaskBuilder

WithStatement adds a sql statement to the TaskBuilder.

func (*TaskBuilder) WithTimeout added in v0.34.0

func (tb *TaskBuilder) WithTimeout(t int) *TaskBuilder

WithTimeout adds a timeout to the TaskBuilder.

func (*TaskBuilder) WithWarehouse added in v0.34.0

func (tb *TaskBuilder) WithWarehouse(s string) *TaskBuilder

WithWarehouse adds a warehouse to the TaskBuilder.

type UserOwnershipGrantBuilder added in v0.34.0

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

func UserOwnershipGrant added in v0.34.0

func UserOwnershipGrant(user string, currentGrants string) *UserOwnershipGrantBuilder

func (*UserOwnershipGrantBuilder) Role added in v0.34.0

type UserOwnershipGrantExecutable added in v0.34.0

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

func (*UserOwnershipGrantExecutable) Grant added in v0.34.0

func (*UserOwnershipGrantExecutable) Revoke added in v0.34.0

func (gr *UserOwnershipGrantExecutable) Revoke() string

type ViewBuilder added in v0.34.0

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

ViewBuilder abstracts the creation of SQL queries for a Snowflake View.

func View added in v0.34.0

func View(name string) *ViewBuilder

View returns a pointer to a Builder that abstracts the DDL operations for a view.

Supported DDL operations are:

  • CREATE VIEW
  • ALTER VIEW
  • DROP VIEW
  • SHOW VIEWS
  • DESCRIBE VIEW

[Snowflake Reference](https://docs.snowflake.net/manuals/sql-reference/ddl-table.html#standard-view-management)

func (*ViewBuilder) AddTag added in v0.34.0

func (vb *ViewBuilder) AddTag(tag TagValue) string

AddTag returns the SQL query that will add a new tag to the view.

func (*ViewBuilder) ChangeComment added in v0.34.0

func (vb *ViewBuilder) ChangeComment(c string) (string, error)

ChangeComment returns the SQL query that will update the comment on the view. Note that comment is the only parameter, if more are released this should be abstracted as per the generic builder.

func (*ViewBuilder) ChangeTag added in v0.34.0

func (vb *ViewBuilder) ChangeTag(tag TagValue) string

ChangeTag returns the SQL query that will alter a tag on the view.

func (*ViewBuilder) Create added in v0.34.0

func (vb *ViewBuilder) Create() (string, error)

Create returns the SQL query that will create a new view.

func (*ViewBuilder) Drop added in v0.34.0

func (vb *ViewBuilder) Drop() (string, error)

Drop returns the SQL query that will drop the row representing this view.

func (*ViewBuilder) QualifiedName added in v0.34.0

func (vb *ViewBuilder) QualifiedName() (string, error)

QualifiedName prepends the db and schema if set and escapes everything nicely.

func (*ViewBuilder) RemoveComment added in v0.34.0

func (vb *ViewBuilder) RemoveComment() (string, error)

RemoveComment returns the SQL query that will remove the comment on the view. Note that comment is the only parameter, if more are released this should be abstracted as per the generic builder.

func (*ViewBuilder) Rename added in v0.34.0

func (vb *ViewBuilder) Rename(newName string) (string, error)

Rename returns the SQL query that will rename the view.

func (*ViewBuilder) Secure added in v0.34.0

func (vb *ViewBuilder) Secure() (string, error)

Secure returns the SQL query that will change the view to a secure view.

func (*ViewBuilder) Show added in v0.34.0

func (vb *ViewBuilder) Show() string

Show returns the SQL query that will show the row representing this view.

func (*ViewBuilder) Unsecure added in v0.34.0

func (vb *ViewBuilder) Unsecure() (string, error)

Unsecure returns the SQL query that will change the view to a normal (unsecured) view.

func (*ViewBuilder) UnsetTag added in v0.34.0

func (vb *ViewBuilder) UnsetTag(tag TagValue) string

UnsetTag returns the SQL query that will unset a tag on the view.

func (*ViewBuilder) WithComment added in v0.34.0

func (vb *ViewBuilder) WithComment(c string) *ViewBuilder

WithComment adds a comment to the ViewBuilder.

func (*ViewBuilder) WithDB added in v0.34.0

func (vb *ViewBuilder) WithDB(db string) *ViewBuilder

WithDB adds the name of the database to the ViewBuilder.

func (*ViewBuilder) WithReplace added in v0.34.0

func (vb *ViewBuilder) WithReplace() *ViewBuilder

WithReplace adds the "OR REPLACE" option to the ViewBuilder.

func (*ViewBuilder) WithSchema added in v0.34.0

func (vb *ViewBuilder) WithSchema(s string) *ViewBuilder

WithSchema adds the name of the schema to the ViewBuilder.

func (*ViewBuilder) WithSecure added in v0.34.0

func (vb *ViewBuilder) WithSecure() *ViewBuilder

WithSecure sets the secure boolean to true [Snowflake Reference](https://docs.snowflake.net/manuals/user-guide/views-secure.html)

func (*ViewBuilder) WithStatement added in v0.34.0

func (vb *ViewBuilder) WithStatement(s string) *ViewBuilder

WithStatement adds the SQL statement to be used for the view.

func (*ViewBuilder) WithTags added in v0.34.0

func (vb *ViewBuilder) WithTags(tags []TagValue) *ViewBuilder

WithTags sets the tags on the ViewBuilder.

type ViewSelectStatementExtractor added in v0.34.0

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

ViewSelectStatementExtractor is a simplistic parser that only exists to extract the select statement from a create view statement

The implementation is optimized for undertandable and predictable behavior. So far we only seek to support queries of the sort that are generated by this project.

Also there is little error handling and we assume queries are well-formed.

func NewViewSelectStatementExtractor added in v0.34.0

func NewViewSelectStatementExtractor(input string) *ViewSelectStatementExtractor

func (*ViewSelectStatementExtractor) Extract added in v0.34.0

func (e *ViewSelectStatementExtractor) Extract() (string, error)

func (*ViewSelectStatementExtractor) ExtractMaterializedView added in v0.34.0

func (e *ViewSelectStatementExtractor) ExtractMaterializedView() (string, error)

type WarehouseBuilder added in v0.34.0

type WarehouseBuilder struct {
	*Builder
}

func Warehouse added in v0.3.0

func Warehouse(name string) *WarehouseBuilder

func (*WarehouseBuilder) Alter added in v0.34.0

func (*WarehouseBuilder) Create added in v0.34.0

func (wb *WarehouseBuilder) Create() *CreateBuilder

func (*WarehouseBuilder) Describe added in v0.34.0

func (wb *WarehouseBuilder) Describe() string

func (*WarehouseBuilder) Drop added in v0.34.0

func (wb *WarehouseBuilder) Drop() string

func (*WarehouseBuilder) Rename added in v0.34.0

func (wb *WarehouseBuilder) Rename(newName string) string

func (*WarehouseBuilder) Show added in v0.34.0

func (wb *WarehouseBuilder) Show() string

func (*WarehouseBuilder) ShowParameters added in v0.34.0

func (wb *WarehouseBuilder) ShowParameters() string

ShowParameters returns the query to show the parameters for the warehouse.

Jump to

Keyboard shortcuts

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