snowflake

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SuspendTrigger suspends all assigned warehouses while allowing currently running queries to complete.
	SuspendTrigger action = "SUSPEND"
	// SuspendImmediatelyTrigger suspends all assigned warehouses immediately and cancel any currently running queries or statements using the warehouses.
	SuspendImmediatelyTrigger action = "SUSPEND_IMMEDIATE"
	// NotifyTrigger sends an alert (to all users who have enabled notifications for themselves), but do not take any other action.
	NotifyTrigger action = "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 DropIntegration added in v0.48.0

func DropIntegration(db *sql.DB, name string) 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 GetParameterDefaults added in v0.54.0

func GetParameterDefaults(t ParameterType) map[string]ParameterDefault

GetParameters returns a map of parameters that match the given type (e.g. Account, Session, Object).

func GetParameterObjectTypeSetAsStrings added in v0.54.0

func GetParameterObjectTypeSetAsStrings() []string

GetParameterObjectTypeSetAsStrings returns a slice of all object types that can have parameters.

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 ParameterDefaults added in v0.54.0

func ParameterDefaults() map[string]ParameterDefault

ParameterDefaults returns a map of default values for all parameters.

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 SelectCurrentAccount added in v0.34.0

func SelectCurrentAccount() string

func SelectCurrentRole added in v0.54.0

func SelectCurrentRole() string

func ShowDatabasesInFailoverGroup added in v0.49.0

func ShowDatabasesInFailoverGroup(name string, db *sql.DB) ([]string, error)

func ShowSharesInFailoverGroup added in v0.49.0

func ShowSharesInFailoverGroup(name string, db *sql.DB) ([]string, error)

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

func WaitResumeAlert added in v0.62.0

func WaitResumeAlert(db *sql.DB, name string, database string, schema string) error

func WaitResumeTask added in v0.50.0

func WaitResumeTask(db *sql.DB, name string, database string, schema string) error

func WaitSuspendAlert added in v0.62.0

func WaitSuspendAlert(db *sql.DB, name string, database string, schema string) error

Types

type APIIntegration added in v0.47.0

type APIIntegration struct {
	Name            sql.NullString `db:"name"`
	Category        sql.NullString `db:"category"`
	IntegrationType sql.NullString `db:"type"`
	CreatedOn       sql.NullString `db:"created_on"`
	Comment         sql.NullString `db:"comment"`
	Enabled         sql.NullBool   `db:"enabled"`
}

func ScanAPIIntegration added in v0.47.0

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

type AWSSNSIAMPolicy added in v0.54.0

type AWSSNSIAMPolicy struct {
	Policy string `db:"policy"`
}

func ScanAWSSNSIAMPolicy added in v0.34.0

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

ScanAWSSNSIAMPolicy convert a result into a.

type Account added in v0.54.0

type Account struct {
	OrganizationName                     sql.NullString `db:"organization_name"`
	AccountName                          sql.NullString `db:"account_name"`
	RegionGroup                          sql.NullString `db:"region_group"`
	SnowflakeRegion                      sql.NullString `db:"snowflake_region"`
	Edition                              sql.NullString `db:"edition"`
	AccountURL                           sql.NullString `db:"account_url"`
	CreatedOn                            sql.NullString `db:"created_on"`
	Comment                              sql.NullString `db:"comment"`
	AccountLocator                       sql.NullString `db:"account_locator"`
	AccountLocatorURL                    sql.NullString `db:"account_locator_url"`
	ManagedAccounts                      sql.NullString `db:"managed_accounts"`
	ConsumptionBillingEntityName         sql.NullString `db:"consumption_billing_entity_name"`
	MarketplaceConsumerBillingEntityName sql.NullString `db:"marketplace_consumer_billing_entity_name"`
	MarketplaceProviderBillingEntityName sql.NullString `db:"marketplace_provider_billing_entity_name"`
	OldAccountURL                        sql.NullString `db:"old_account_url"`
	IsOrgAdmin                           sql.NullBool   `db:"is_org_admin"`
}

func ShowAccount added in v0.56.0

func ShowAccount(db *sql.DB, pattern string) (*Account, error)

Show returns the SQL query that will show a specific account by pattern.

type AccountBuilder added in v0.56.0

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

AccountBuilder abstracts the creation of SQL queries for a Snowflake account.

func NewAlterAccountBuilder added in v0.56.0

func NewAlterAccountBuilder(name string, db *sql.DB) *AccountBuilder

NewAlterAccountBuilder creates a new builder for a Snowflake account.

func NewCreateAccountBuilder added in v0.56.0

func NewCreateAccountBuilder(name, adminName, email string, edition AccountEdition, db *sql.DB) *AccountBuilder

NewCreateAccountBuilder creates a new builder for a Snowflake account.

func (*AccountBuilder) Create added in v0.56.0

func (b *AccountBuilder) Create() (*Account, error)

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

func (*AccountBuilder) Rename added in v0.56.0

func (b *AccountBuilder) Rename(newName string) error

Rename returns the SQL query that will rename the account.

func (*AccountBuilder) SetComment added in v0.56.0

func (b *AccountBuilder) SetComment(comment string) error

SetComment returns the SQL query that will set the comment on the account.

func (*AccountBuilder) WithAdminPassword added in v0.56.0

func (b *AccountBuilder) WithAdminPassword(adminPassword string) *AccountBuilder

WithAdminPassword sets adminPassword.

func (*AccountBuilder) WithAdminRSAPublicKey added in v0.56.0

func (b *AccountBuilder) WithAdminRSAPublicKey(adminRSAPublicKey string) *AccountBuilder

WithAdminRSAPublicKey sets adminRSAPublicKey.

func (*AccountBuilder) WithComment added in v0.56.0

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

WithComment sets comment.

func (*AccountBuilder) WithFirstName added in v0.56.0

func (b *AccountBuilder) WithFirstName(firstName string) *AccountBuilder

WithFirstName sets firstName.

func (*AccountBuilder) WithLastName added in v0.56.0

func (b *AccountBuilder) WithLastName(lastName string) *AccountBuilder

WithLastName sets lastName.

func (*AccountBuilder) WithMustChangePassword added in v0.56.0

func (b *AccountBuilder) WithMustChangePassword(mustChangePassword bool) *AccountBuilder

WithMustChangePassword sets mustChangePassword.

func (*AccountBuilder) WithRegion added in v0.56.0

func (b *AccountBuilder) WithRegion(region string) *AccountBuilder

WithRegion sets region.

func (*AccountBuilder) WithRegionGroup added in v0.56.0

func (b *AccountBuilder) WithRegionGroup(regionGroup string) *AccountBuilder

WithRegionGroup sets regionGroup.

type AccountEdition added in v0.56.0

type AccountEdition string
const (
	AccountEditionStandard         AccountEdition = "STANDARD"
	AccountEditionEnterprise       AccountEdition = "ENTERPRISE"
	AccountEditionBusinessCritical AccountEdition = "BUSINESS_CRITICAL"
)

type AccountParameterBuilder added in v0.61.0

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

AccountParameterBuilder abstracts the creation of SQL queries for Snowflake account parameters.

func NewAccountParameter added in v0.61.0

func NewAccountParameter(key, value string, db *sql.DB) *AccountParameterBuilder

func (*AccountParameterBuilder) SetParameter added in v0.61.0

func (v *AccountParameterBuilder) SetParameter() error

type Alert added in v0.62.0

type Alert struct {
	CreatedOn    string  `db:"created_on"`
	Name         string  `db:"name"`
	DatabaseName string  `db:"database_name"`
	SchemaName   string  `db:"schema_name"`
	Owner        string  `db:"owner"`
	Comment      *string `db:"comment"`
	Warehouse    string  `db:"warehouse"`
	Schedule     string  `db:"schedule"`
	State        string  `db:"state"` // suspended, started
	Condition    string  `db:"condition"`
	Action       string  `db:"action"`
}

func ListAlerts added in v0.62.0

func ListAlerts(databaseName string, schemaName string, db *sql.DB) ([]Alert, error)

func ScanAlert added in v0.62.0

func ScanAlert(row *sqlx.Row) (*Alert, error)

ScanAlert turns a sql row into an alert object.

func (*Alert) IsEnabled added in v0.62.0

func (t *Alert) IsEnabled() bool

func (*Alert) IsSuspended added in v0.62.0

func (t *Alert) IsSuspended() bool

func (*Alert) QualifiedName added in v0.62.0

func (t *Alert) QualifiedName() string

func (*Alert) Resume added in v0.62.0

func (t *Alert) Resume() string

func (*Alert) Suspend added in v0.62.0

func (t *Alert) Suspend() string

type AlertBuilder added in v0.62.0

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

AlertBuilder abstracts the creation of sql queries for a snowflake alert.

func NewAlertBuilder added in v0.62.0

func NewAlertBuilder(name, db, schema string) *AlertBuilder

func (*AlertBuilder) ChangeAction added in v0.62.0

func (builder *AlertBuilder) ChangeAction(newAction string) string

ChangeAction returns the sql that will update the sql the alert executes.

func (*AlertBuilder) ChangeAlertCronSchedule added in v0.62.0

func (builder *AlertBuilder) ChangeAlertCronSchedule(alertScheduleCronExpression string, alertScheduleTimeZone string) string

ChangeAlertCronSchedule returns the sql that will change the cron schedule for the alert.

func (*AlertBuilder) ChangeAlertIntervalSchedule added in v0.62.0

func (builder *AlertBuilder) ChangeAlertIntervalSchedule(alertScheduleInterval int) string

ChangeAlertIntervalSchedule returns the sql that will change the schedule's interval for the alert.

func (*AlertBuilder) ChangeComment added in v0.62.0

func (builder *AlertBuilder) ChangeComment(newComment string) string

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

func (*AlertBuilder) ChangeCondition added in v0.62.0

func (builder *AlertBuilder) ChangeCondition(newCondition string) string

ChangeCondition returns the sql that will update the WHEN condition for the alert.

func (*AlertBuilder) ChangeWarehouse added in v0.62.0

func (builder *AlertBuilder) ChangeWarehouse(newWh string) string

ChangeWarehouse returns the sql that will change the warehouse for the alert.

func (*AlertBuilder) Create added in v0.62.0

func (builder *AlertBuilder) Create() string

Create returns the SQL that will create a new alert.

func (*AlertBuilder) Describe added in v0.62.0

func (builder *AlertBuilder) Describe() string

Describe returns the sql that will describe a alert.

func (*AlertBuilder) Drop added in v0.62.0

func (builder *AlertBuilder) Drop() string

Drop returns the sql that will remove the alert.

func (*AlertBuilder) GetFullName added in v0.62.0

func (builder *AlertBuilder) GetFullName(name string) string

GetFullName prepends db and schema to in parameter.

func (*AlertBuilder) IsDisabled added in v0.62.0

func (builder *AlertBuilder) IsDisabled() bool

IsDisabled returns if the alert builder is disabled.

func (*AlertBuilder) Name added in v0.62.0

func (builder *AlertBuilder) Name() string

Name returns the name of the alert.

func (*AlertBuilder) QualifiedName added in v0.62.0

func (builder *AlertBuilder) QualifiedName() string

QualifiedName prepends the db and schema and escapes everything nicely.

func (*AlertBuilder) RemoveComment added in v0.62.0

func (builder *AlertBuilder) RemoveComment() string

RemoveComment returns the sql that will remove the comment for the alert.

func (*AlertBuilder) RemoveSchedule added in v0.62.0

func (builder *AlertBuilder) RemoveSchedule() string

RemoveSchedule returns the sql that will remove the schedule for the alert.

func (*AlertBuilder) Resume added in v0.62.0

func (builder *AlertBuilder) Resume() string

Resume returns the sql that will resume the alert.

func (*AlertBuilder) SetDisabled added in v0.62.0

func (builder *AlertBuilder) SetDisabled() *AlertBuilder

SetDisabled disables the alert builder.

func (*AlertBuilder) Show added in v0.62.0

func (builder *AlertBuilder) Show() string

Show returns the sql that will show a alert.

func (*AlertBuilder) Suspend added in v0.62.0

func (builder *AlertBuilder) Suspend() string

Suspend returns the sql that will suspend the alert.

func (*AlertBuilder) WithAction added in v0.62.0

func (builder *AlertBuilder) WithAction(action string) *AlertBuilder

WithAction adds a sql statement to the AlertBuilder.

func (*AlertBuilder) WithAlertScheduleCronExpression added in v0.62.0

func (builder *AlertBuilder) WithAlertScheduleCronExpression(alertScheduleCronExpression string) *AlertBuilder

WithAlertScheduleCronExpression adds cron expression to alert schedule.

func (*AlertBuilder) WithAlertScheduleInterval added in v0.62.0

func (builder *AlertBuilder) WithAlertScheduleInterval(alertScheduleInterval int) *AlertBuilder

WithAlertScheduleInterval adds an interval to alert schedule.

func (*AlertBuilder) WithAlertScheduleTimeZone added in v0.62.0

func (builder *AlertBuilder) WithAlertScheduleTimeZone(alertScheduleTimeZone string) *AlertBuilder

WithAlertScheduleTimeZone adds a timezone to alert schedule.

func (*AlertBuilder) WithComment added in v0.62.0

func (builder *AlertBuilder) WithComment(c string) *AlertBuilder

WithComment adds a comment to the AlertBuilder.

func (*AlertBuilder) WithCondition added in v0.62.0

func (builder *AlertBuilder) WithCondition(condition string) *AlertBuilder

WithCondition adds a condition to the AlertBuilder.

func (*AlertBuilder) WithWarehouse added in v0.62.0

func (builder *AlertBuilder) WithWarehouse(s string) *AlertBuilder

WithWarehouse adds a warehouse to the AlertBuilder.

type AllGrantBuilder added in v0.61.0

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

AllGrantBuilder abstracts the creation of ExistingGrantExecutables.

func (*AllGrantBuilder) GrantType added in v0.61.0

func (fgb *AllGrantBuilder) GrantType() string

func (*AllGrantBuilder) Name added in v0.61.0

func (fgb *AllGrantBuilder) Name() string

Name returns the object name for this FutureGrantBuilder.

func (*AllGrantBuilder) Role added in v0.61.0

func (fgb *AllGrantBuilder) Role(n string) GrantExecutable

Role returns a pointer to a AllGrantExecutable for a role.

func (*AllGrantBuilder) Share added in v0.61.0

func (fgb *AllGrantBuilder) Share(_ string) GrantExecutable

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

func (*AllGrantBuilder) Show added in v0.61.0

func (fgb *AllGrantBuilder) Show() string

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

type AllGrantExecutable added in v0.64.0

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

AllGrantExecutable abstracts the creation of SQL queries to build all grants for different all grant types.

func (*AllGrantExecutable) Grant added in v0.64.0

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

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

func (*AllGrantExecutable) Revoke added in v0.64.0

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

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

func (*AllGrantExecutable) Show added in v0.64.0

func (fge *AllGrantExecutable) Show() string

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

type AllGrantTarget added in v0.61.0

type AllGrantTarget string
const (
	AllGrantTargetSchema   AllGrantTarget = "SCHEMA"
	AllGrantTargetDatabase AllGrantTarget = "DATABASE"
)

type AllGrantType added in v0.61.0

type AllGrantType string
const (
	AllGrantTypeSchema           AllGrantType = "SCHEMA"
	AllGrantTypeTable            AllGrantType = "TABLE"
	AllGrantTypeView             AllGrantType = "VIEW"
	AllGrantTypeMaterializedView AllGrantType = "MATERIALIZED VIEW"
	AllGrantTypeStage            AllGrantType = "STAGE"
	AllGrantTypeExternalTable    AllGrantType = "EXTERNAL TABLE"
	AllGrantTypeFileFormat       AllGrantType = "FILE FORMAT"
	AllGrantTypeFunction         AllGrantType = "FUNCTION"
	AllGrantTypeProcedure        AllGrantType = "PROCEDURE"
	AllGrantTypeSequence         AllGrantType = "SEQUENCE"
	AllGrantTypeStream           AllGrantType = "STREAM"
	AllGrantTypeTask             AllGrantType = "TASK"
)

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 (ab *AlterPropertiesBuilder) SetTags(tags []TagValue)

func (*AlterPropertiesBuilder) Statement added in v0.3.0

func (ab *AlterPropertiesBuilder) Statement() string

type AnyRoleMode added in v0.62.0

type AnyRoleMode string
const (
	Disable            AnyRoleMode = "DISABLE"
	Enable             AnyRoleMode = "ENABLE"
	EnableForPrivilege AnyRoleMode = "ENABLE_FOR_PRIVILEGE"
)

type BaseManager added in v0.62.0

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

func (*BaseManager) Ok added in v0.62.0

func (m *BaseManager) Ok(_ interface{}, ok bool) bool

type Builder added in v0.3.0

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

func NewAPIIntegrationBuilder added in v0.54.0

func NewAPIIntegrationBuilder(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 NewEmailNotificationIntegrationBuilder added in v0.64.0

func NewEmailNotificationIntegrationBuilder(name string) *Builder

EmailNotificationIntegration returns a pointer to a Builder that abstracts the DDL operations for a email 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 NewManagedAccountBuilder added in v0.54.0

func NewManagedAccountBuilder(name string) *Builder

NewManagedAccountBuilder 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 NewNotificationIntegrationBuilder added in v0.54.0

func NewNotificationIntegrationBuilder(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 NewOAuthIntegrationBuilder added in v0.54.0

func NewOAuthIntegrationBuilder(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 NewSCIMIntegrationBuilder added in v0.54.0

func NewSCIMIntegrationBuilder(name string) *Builder

NewSCIMIntegrationBuilder 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 NewSamlIntegrationBuilder added in v0.54.0

func NewSamlIntegrationBuilder(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 NewShareBuilder added in v0.54.0

func NewShareBuilder(name string) *Builder

func NewStorageIntegrationBuilder added in v0.54.0

func NewStorageIntegrationBuilder(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 NewUserBuilder added in v0.54.0

func NewUserBuilder(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) WithMaskingPolicy added in v0.49.0

func (c *Column) WithMaskingPolicy(maskingPolicy string) *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 ColumnIdentifier added in v0.63.0

type ColumnIdentifier struct {
	Database   string
	Schema     string
	ObjectName string `db:"NAME"`
	Column     string
}

func ColumnIdentifierFromQualifiedName added in v0.63.0

func ColumnIdentifierFromQualifiedName(name string) *ColumnIdentifier

func (*ColumnIdentifier) QualifiedName added in v0.63.0

func (i *ColumnIdentifier) QualifiedName() string

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 CurrentAccount added in v0.56.0

type CurrentAccount struct {
	Account string `db:"account"`
	Region  string `db:"region"`
}

func ReadCurrentAccount added in v0.34.0

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

func ScanCurrentAccount added in v0.34.0

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

func (*CurrentAccount) AccountURL added in v0.56.0

func (acc *CurrentAccount) AccountURL() (string, error)

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 CurrentRole added in v0.54.0

type CurrentRole struct {
	Role string `db:"currentRole"`
}

func ReadCurrentRole added in v0.54.0

func ReadCurrentRole(db *sql.DB) (*CurrentRole, error)

func ScanCurrentRole added in v0.54.0

func ScanCurrentRole(row *sqlx.Row) (*CurrentRole, error)

type Database added in v0.3.0

type Database struct {
	CreatedOn     sql.NullString `db:"created_on"`
	DBName        sql.NullString `db:"name"`
	IsDefault     sql.NullString `db:"is_default"`
	IsCurrent     sql.NullString `db:"is_current"`
	Origin        sql.NullString `db:"origin"`
	Owner         sql.NullString `db:"owner"`
	Comment       sql.NullString `db:"comment"`
	Options       sql.NullString `db:"options"`
	RetentionTime sql.NullString `db:"retention_time"`
	ResourceGroup sql.NullString `db:"resource_group"`
}

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 ScanDatabase added in v0.34.0

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

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 NewDatabaseBuilder added in v0.54.0

func NewDatabaseBuilder(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 DatabaseRole added in v0.62.0

type DatabaseRole struct {
	CreatedOn    string  `db:"created_on"`
	Name         string  `db:"name"`
	DatabaseName string  `db:"database_name"`
	Owner        string  `db:"owner"`
	Comment      *string `db:"comment"`
}

func ListDatabaseRoles added in v0.62.0

func ListDatabaseRoles(databaseName string, db *sql.DB) ([]DatabaseRole, error)

func ScanDatabaseRole added in v0.62.0

func ScanDatabaseRole(row *sqlx.Row) (*DatabaseRole, error)

ScanDatabaseRole turns a sql row into a database role object.

func (*DatabaseRole) QualifiedName added in v0.62.0

func (dr *DatabaseRole) QualifiedName() string

type DatabaseRoleBuilder added in v0.62.0

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

DatabaseRoleBuilder abstracts the creation of sql queries for a snowflake database role.

func NewDatabaseRoleBuilder added in v0.62.0

func NewDatabaseRoleBuilder(roleName, dbName string) *DatabaseRoleBuilder

func (*DatabaseRoleBuilder) ChangeComment added in v0.62.0

func (builder *DatabaseRoleBuilder) ChangeComment(newComment string) string

ChangeComment returns the sql that will change the comment for the database role.

func (*DatabaseRoleBuilder) Create added in v0.62.0

func (builder *DatabaseRoleBuilder) Create() string

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

func (*DatabaseRoleBuilder) Describe added in v0.62.0

func (builder *DatabaseRoleBuilder) Describe() string

Describe returns the sql that will describe a Database Role.

func (*DatabaseRoleBuilder) Drop added in v0.62.0

func (builder *DatabaseRoleBuilder) Drop() string

Drop returns the sql that will remove the Database Role.

func (*DatabaseRoleBuilder) GetFullName added in v0.62.0

func (builder *DatabaseRoleBuilder) GetFullName(name string) string

GetFullName prepends db and schema to in parameter.

func (*DatabaseRoleBuilder) Name added in v0.62.0

func (builder *DatabaseRoleBuilder) Name() string

Name returns the name of the database role.

func (*DatabaseRoleBuilder) QualifiedName added in v0.62.0

func (builder *DatabaseRoleBuilder) QualifiedName() string

QualifiedName prepends the db and schema and escapes everything nicely.

func (*DatabaseRoleBuilder) Show added in v0.62.0

func (builder *DatabaseRoleBuilder) Show() string

Show returns the sql that will show a Database Role.

func (*DatabaseRoleBuilder) WithComment added in v0.62.0

func (builder *DatabaseRoleBuilder) WithComment(c string) *DatabaseRoleBuilder

WithComment adds a comment to the DatabaseRoleBuilder.

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 DateFormat added in v0.54.0

type DateFormat string
const (
	DateFormatISO   DateFormat = "DateFormatISO"
	DateFormatOther DateFormat = "DateFormatOther"
	DateFormatAny   DateFormat = "DateFormatAny"
)

type DescStageResult added in v0.54.0

type DescStageResult struct {
	URL              string
	AwsExternalID    string
	SnowflakeIamUser string
	FileFormat       string
	CopyOptions      string
	Directory        string
}

func DescStage added in v0.34.0

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

type DescStreamRow added in v0.54.0

type DescStreamRow struct {
	CreatedOn       sql.NullString `db:"created_on"`
	StreamName      sql.NullString `db:"name"`
	DatabaseName    sql.NullString `db:"database_name"`
	SchemaName      sql.NullString `db:"schema_name"`
	Owner           sql.NullString `db:"owner"`
	Comment         sql.NullString `db:"comment"`
	ShowInitialRows bool           `db:"show_initial_rows"`
	TableName       sql.NullString `db:"table_name"`
	Type            sql.NullString `db:"type"`
	Stale           sql.NullString `db:"stale"`
	Mode            sql.NullString `db:"mode"`
	SourceType      sql.NullString `db:"source_type"`
}

func ListStreams added in v0.34.0

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

func ScanStream added in v0.34.0

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

type DescribeUserProp added in v0.34.0

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

type EmailNotificationIntegration added in v0.64.0

type EmailNotificationIntegration struct {
	Name    sql.NullString `db:"name"`
	Type    sql.NullString `db:"type"`
	Comment sql.NullString `db:"comment"`
	Enabled sql.NullBool   `db:"enabled"`
}

func ScanEmailNotificationIntegration added in v0.64.0

func ScanEmailNotificationIntegration(row *sqlx.Row) (*EmailNotificationIntegration, error)

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 ExternalFunction added in v0.34.0

type ExternalFunction struct {
	CreatedOn            sql.NullString `db:"created_on"`
	ExternalFunctionName sql.NullString `db:"name"`
	DatabaseName         sql.NullString `db:"catalog_name"`
	SchemaName           sql.NullString `db:"schema_name"`
	Comment              sql.NullString `db:"description"`
	IsExternalFunction   sql.NullString `db:"is_external_function"`
	Language             sql.NullString `db:"language"`
}

func ListExternalFunctions added in v0.34.0

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

func ScanExternalFunction added in v0.34.0

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

ScanExternalFunction.

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 NewExternalFunctionBuilder added in v0.54.0

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

NewExternalFunctionBuilder 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) WithRequestTranslator added in v0.64.0

func (fb *ExternalFunctionBuilder) WithRequestTranslator(requestTranslator string) *ExternalFunctionBuilder

WithRequestTranslator adds a request translator to the ExternalFunctionBuilder.

func (*ExternalFunctionBuilder) WithResponseTranslator added in v0.64.0

func (fb *ExternalFunctionBuilder) WithResponseTranslator(responseTranslator string) *ExternalFunctionBuilder

WithResponseTranslator adds a response translator 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 ExternalFunctionDescription added in v0.54.0

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

func ScanExternalFunctionDescription added in v0.34.0

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

ScanExternalFunctionDescription.

type ExternalOauthIntegration3 added in v0.62.0

type ExternalOauthIntegration3 struct {
	TopLevelIdentifier

	Type                                         string `pos:"parameter" db:"type"`
	TypeOk                                       bool
	Enabled                                      bool `pos:"parameter" db:"enabled"`
	EnabledOk                                    bool
	ExternalOauthType                            ExternalOauthType `pos:"parameter" db:"EXTERNAL_OAUTH_TYPE"`
	ExternalOauthTypeOk                          bool
	ExternalOauthIssuer                          string `pos:"parameter" db:"EXTERNAL_OAUTH_ISSUER"`
	ExternalOauthIssuerOk                        bool
	ExternalOauthTokenUserMappingClaim           []string `pos:"parameter" db:"EXTERNAL_OAUTH_TOKEN_USER_MAPPING_CLAIM"`
	ExternalOauthTokenUserMappingClaimOk         bool
	ExternalOauthSnowflakeUserMappingAttribute   SFUserMappingAttribute `pos:"parameter" db:"EXTERNAL_OAUTH_SNOWFLAKE_USER_MAPPING_ATTRIBUTE"`
	ExternalOauthSnowflakeUserMappingAttributeOk bool
	ExternalOauthJwsKeysURL                      []string `pos:"parameter" db:"EXTERNAL_OAUTH_JWS_KEYS_URL"`
	ExternalOauthJwsKeysURLOk                    bool
	ExternalOauthBlockedRolesList                []string `pos:"parameter" db:"EXTERNAL_OAUTH_BLOCKED_ROLES_LIST"`
	ExternalOauthBlockedRolesListOk              bool
	ExternalOauthAllowedRolesList                []string `pos:"parameter" db:"EXTERNAL_OAUTH_ALLOWED_ROLES_LIST"`
	ExternalOauthAllowedRolesListOk              bool
	ExternalOauthRsaPublicKey                    string `pos:"parameter" db:"EXTERNAL_OAUTH_RSA_PUBLIC_KEY"`
	ExternalOauthRsaPublicKeyOk                  bool
	ExternalOauthRsaPublicKey2                   string `pos:"parameter" db:"EXTERNAL_OAUTH_RSA_PUBLIC_KEY_2"`
	ExternalOauthRsaPublicKey2Ok                 bool
	ExternalOauthAudienceList                    []string `pos:"parameter" db:"EXTERNAL_OAUTH_AUDIENCE_LIST"`
	ExternalOauthAudienceListOk                  bool
	ExternalOauthAnyRoleMode                     AnyRoleMode `pos:"parameter" db:"EXTERNAL_OAUTH_ANY_ROLE_MODE"`
	ExternalOauthAnyRoleModeOk                   bool
	ExternalOauthScopeDelimiter                  string `pos:"parameter" db:"EXTERNAL_OAUTH_SCOPE_DELIMITER"`
	ExternalOauthScopeDelimiterOk                bool
	ExternalOauthScopeMappingAttribute           string `pos:"parameter" db:"EXTERNAL_OAUTH_SCOPE_MAPPING_ATTRIBUTE"`
	ExternalOauthScopeMappingAttributeOk         bool

	Comment   string `pos:"parameter" db:"comment"`
	CommentOk bool
}

type ExternalOauthIntegration3CreateInput added in v0.62.0

type ExternalOauthIntegration3CreateInput struct {
	ExternalOauthIntegration3

	OrReplace     bool `pos:"beforeObjectType" value:"OR REPLACE"`
	OrReplaceOk   bool
	IfNotExists   bool `pos:"afterObjectType" value:"IF NOT EXISTS"`
	IfNotExistsOk bool
}

type ExternalOauthIntegration3DeleteInput added in v0.62.0

type ExternalOauthIntegration3DeleteInput struct {
	TopLevelIdentifier

	IfExists   bool `pos:"afterObjectType" value:"IF EXISTS"`
	IfExistsOk bool
}

type ExternalOauthIntegration3Manager added in v0.62.0

type ExternalOauthIntegration3Manager struct {
	BaseManager
}

func NewExternalOauthIntegration3Manager added in v0.62.0

func NewExternalOauthIntegration3Manager() (*ExternalOauthIntegration3Manager, error)

func (*ExternalOauthIntegration3Manager) Create added in v0.62.0

func (*ExternalOauthIntegration3Manager) Delete added in v0.62.0

func (*ExternalOauthIntegration3Manager) ParseDescribe added in v0.62.0

func (*ExternalOauthIntegration3Manager) ParseShow added in v0.62.0

func (*ExternalOauthIntegration3Manager) ReadDescribe added in v0.62.0

func (*ExternalOauthIntegration3Manager) ReadShow added in v0.62.0

func (*ExternalOauthIntegration3Manager) Unset added in v0.62.0

func (*ExternalOauthIntegration3Manager) Update added in v0.62.0

type ExternalOauthIntegration3ReadInput added in v0.62.0

type ExternalOauthIntegration3ReadInput = TopLevelIdentifier

type ExternalOauthIntegration3ReadOutput added in v0.62.0

type ExternalOauthIntegration3ReadOutput = ExternalOauthIntegration3

type ExternalOauthIntegration3UpdateInput added in v0.62.0

type ExternalOauthIntegration3UpdateInput struct {
	ExternalOauthIntegration3

	IfExists   bool `pos:"afterObjectType" value:"IF EXISTS"`
	IfExistsOk bool
}

type ExternalOauthType added in v0.62.0

type ExternalOauthType string
const (
	Okta         ExternalOauthType = "OKTA"
	Azure        ExternalOauthType = "AZURE"
	PingFederate ExternalOauthType = "PING_FEDERATE"
	Custom       ExternalOauthType = "CUSTOM"
)

type ExternalTable added in v0.34.0

type ExternalTable struct {
	CreatedOn         sql.NullString `db:"created_on"`
	ExternalTableName sql.NullString `db:"name"`
	DatabaseName      sql.NullString `db:"database_name"`
	SchemaName        sql.NullString `db:"schema_name"`
	Comment           sql.NullString `db:"comment"`
	Owner             sql.NullString `db:"owner"`
}

func ListExternalTables added in v0.34.0

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

func ScanExternalTable added in v0.34.0

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

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 NewExternalTableBuilder added in v0.54.0

func NewExternalTableBuilder(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 FailoverGroup added in v0.49.0

type FailoverGroup struct {
	SnowflakeRegion         sql.NullString `db:"snowflake_region"`
	CreatedOn               sql.NullString `db:"created_on"`
	AccountName             sql.NullString `db:"account_name"`
	Name                    sql.NullString `db:"name"`
	IsPrimary               sql.NullString `db:"is_primary"`
	Primary                 sql.NullString `db:"primary"`
	ObjectTypes             sql.NullString `db:"object_types"`
	AllowedIntegrationTypes sql.NullString `db:"allowed_integration_types"`
	AllowedAccounts         sql.NullString `db:"allowed_accounts"`
	OrganizationName        sql.NullString `db:"organization_name"`
	AccountLocator          sql.NullString `db:"account_locator"`
	ReplicationSchedule     sql.NullString `db:"replication_schedule"`
	SecondaryState          sql.NullString `db:"secondary_state"`
}

func ListFailoverGroups added in v0.49.0

func ListFailoverGroups(db *sql.DB, accountLocator string) ([]FailoverGroup, error)

ListFailoverGroups returns a list of all failover groups in the account.

type FailoverGroupBuilder added in v0.49.0

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

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

func NewFailoverGroupBuilder added in v0.54.0

func NewFailoverGroupBuilder(name string) *FailoverGroupBuilder

CreateFailoverGroup returns a pointer to a Builder that abstracts the DDL operations for a failover group.

func (*FailoverGroupBuilder) AddAllowedAccounts added in v0.49.0

func (b *FailoverGroupBuilder) AddAllowedAccounts(allowedAccounts []string) string

AddAllowedAccounts returns the SQL query that will change the allowed accounts of a failover group.

func (*FailoverGroupBuilder) AddAllowedDatabases added in v0.49.0

func (b *FailoverGroupBuilder) AddAllowedDatabases(allowedDatabases []string) string

AddAllowedDatabases returns the SQL query that will change the allowed databases of a failover group.

func (*FailoverGroupBuilder) AddAllowedShares added in v0.49.0

func (b *FailoverGroupBuilder) AddAllowedShares(allowedShares []string) string

AddAllowedShares returns the SQL query that will change the allowed shares of a failover group.

func (*FailoverGroupBuilder) ChangeAllowedIntegrationTypes added in v0.49.0

func (b *FailoverGroupBuilder) ChangeAllowedIntegrationTypes(allowedIntegrationTypes []string) string

ChangeAllowedIntegrationTypes returns the SQL query that will change the allowed integration types of a failover group.

func (*FailoverGroupBuilder) ChangeObjectTypes added in v0.49.0

func (b *FailoverGroupBuilder) ChangeObjectTypes(objectTypes []string) string

ChangeObjectTypes returns the SQL query that will change the object types of a failover group.

func (*FailoverGroupBuilder) ChangeReplicationCronSchedule added in v0.49.0

func (b *FailoverGroupBuilder) ChangeReplicationCronSchedule(replicationScheduleCronExpression string, replicationScheduleTimeZone string) string

ChangeReplicationCronSchedule returns the SQL query that will change the replication schedule of a failover group.

func (*FailoverGroupBuilder) ChangeReplicationIntervalSchedule added in v0.49.0

func (b *FailoverGroupBuilder) ChangeReplicationIntervalSchedule(replicationScheduleInterval int) string

ChangeReplicationIntervalSchedule returns the SQL query that will change the replication schedule of a failover group.

func (*FailoverGroupBuilder) Create added in v0.49.0

func (b *FailoverGroupBuilder) Create() string

Create returns the SQL query that will create a new failover group.

func (*FailoverGroupBuilder) CreateFromReplica added in v0.49.0

func (b *FailoverGroupBuilder) CreateFromReplica(name string) string

func (*FailoverGroupBuilder) Drop added in v0.49.0

func (b *FailoverGroupBuilder) Drop() string

Drop returns the SQL query that will drop a failover group.

func (*FailoverGroupBuilder) RemoveAllowedAccounts added in v0.49.0

func (b *FailoverGroupBuilder) RemoveAllowedAccounts(allowedAccounts []string) string

RemoveAllowedAccounts returns the SQL query that will change the allowed accounts of a failover group.

func (*FailoverGroupBuilder) RemoveAllowedDatabases added in v0.49.0

func (b *FailoverGroupBuilder) RemoveAllowedDatabases(allowedDatabases []string) string

RemoveAllowedDatabases returns the SQL query that will change the allowed databases of a failover group.

func (*FailoverGroupBuilder) RemoveAllowedShares added in v0.49.0

func (b *FailoverGroupBuilder) RemoveAllowedShares(allowedShares []string) string

RemoveAllowedShares returns the SQL query that will change the allowed shares of a failover group.

func (*FailoverGroupBuilder) Rename added in v0.49.0

func (b *FailoverGroupBuilder) Rename(name string) string

Rename returns the SQL query that will rename a failover group.

func (*FailoverGroupBuilder) Show added in v0.49.0

func (b *FailoverGroupBuilder) Show() string

Show returns the SQL query that will show a failover group.

func (*FailoverGroupBuilder) WithAllowedAccounts added in v0.49.0

func (b *FailoverGroupBuilder) WithAllowedAccounts(allowedAccounts []string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithAllowedDatabases added in v0.49.0

func (b *FailoverGroupBuilder) WithAllowedDatabases(allowedDatabases []string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithAllowedIntegrationTypes added in v0.49.0

func (b *FailoverGroupBuilder) WithAllowedIntegrationTypes(allowedIntegrationTypes []string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithAllowedShares added in v0.49.0

func (b *FailoverGroupBuilder) WithAllowedShares(allowedShares []string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithIgnoreEditionCheck added in v0.49.0

func (b *FailoverGroupBuilder) WithIgnoreEditionCheck(ignoreEditionCheck bool) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithName added in v0.49.0

func (*FailoverGroupBuilder) WithObjectTypes added in v0.49.0

func (b *FailoverGroupBuilder) WithObjectTypes(objectTypes []string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithReplicationScheduleCronExpression added in v0.49.0

func (b *FailoverGroupBuilder) WithReplicationScheduleCronExpression(replicationScheduleCronExpression string) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithReplicationScheduleInterval added in v0.49.0

func (b *FailoverGroupBuilder) WithReplicationScheduleInterval(replicationScheduleInterval int) *FailoverGroupBuilder

func (*FailoverGroupBuilder) WithReplicationScheduleTimeZone added in v0.49.0

func (b *FailoverGroupBuilder) WithReplicationScheduleTimeZone(replicationScheduleTimeZone string) *FailoverGroupBuilder

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 disable 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 FileFormatOptions added in v0.54.0

type FileFormatOptions struct {
	Type                       string   `json:"TYPE"`
	Compression                string   `json:"COMPRESSION,omitempty"`
	RecordDelimiter            string   `json:"RECORD_DELIMITER,omitempty"`
	FieldDelimiter             string   `json:"FIELD_DELIMITER,omitempty"`
	FileExtension              string   `json:"FILE_EXTENSION,omitempty"`
	SkipHeader                 int      `json:"SKIP_HEADER,omitempty"`
	DateFormat                 string   `json:"DATE_FORMAT,omitempty"`
	TimeFormat                 string   `json:"TIME_FORMAT,omitempty"`
	TimestampFormat            string   `json:"TIMESTAMP_FORMAT,omitempty"`
	BinaryFormat               string   `json:"BINARY_FORMAT,omitempty"`
	Escape                     string   `json:"ESCAPE,omitempty"`
	EscapeUnenclosedField      string   `json:"ESCAPE_UNENCLOSED_FIELD,omitempty"`
	TrimSpace                  bool     `json:"TRIM_SPACE,omitempty"`
	FieldOptionallyEnclosedBy  string   `json:"FIELD_OPTIONALLY_ENCLOSED_BY,omitempty"`
	NullIf                     []string `json:"NULL_IF,omitempty"`
	ErrorOnColumnCountMismatch bool     `json:"ERROR_ON_COLUMN_COUNT_MISMATCH,omitempty"`
	SkipBlankLines             bool     `json:"SKIP_BLANK_LINES,omitempty"`
	ReplaceInvalidCharacters   bool     `json:"REPLACE_INVALID_CHARACTERS,omitempty"`
	EmptyFieldAsNull           bool     `json:"EMPTY_FIELD_AS_NULL,omitempty"`
	SkipByteOrderMark          bool     `json:"SKIP_BYTE_ORDER_MARK,omitempty"`
	Encoding                   string   `json:"ENCODING,omitempty"`
	EnabelOctal                bool     `json:"ENABLE_OCTAL,omitempty"`
	AllowDuplicate             bool     `json:"ALLOW_DUPLICATE,omitempty"`
	StripOuterArray            bool     `json:"STRIP_OUTER_ARRAY,omitempty"`
	StripNullValues            bool     `json:"STRIP_NULL_VALUES,omitempty"`
	IgnoreUTF8Errors           bool     `json:"IGNORE_UTF8_ERRORS,omitempty"`
	BinaryAsText               bool     `json:"BINARY_AS_TEXT,omitempty"`
	PreserveSpace              bool     `json:"PRESERVE_SPACE,omitempty"`
	StripOuterElement          bool     `json:"STRIP_OUTER_ELEMENT,omitempty"`
	DisableSnowflakeData       bool     `json:"DISABLE_SNOWFLAKE_DATA,omitempty"`
	DisableAutoConvert         bool     `json:"DISABLE_AUTO_CONVERT,omitempty"`
}

func ParseFormatOptions added in v0.34.0

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

type FileFormatShow added in v0.54.0

type FileFormatShow struct {
	CreatedOn      sql.NullString `db:"created_on"`
	FileFormatName sql.NullString `db:"name"`
	DatabaseName   sql.NullString `db:"database_name"`
	SchemaName     sql.NullString `db:"schema_name"`
	FormatType     sql.NullString `db:"type"`
	Owner          sql.NullString `db:"owner"`
	Comment        sql.NullString `db:"comment"`
	FormatOptions  sql.NullString `db:"format_options"`
}

func ListFileFormats added in v0.34.0

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

func ScanFileFormatShow added in v0.34.0

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

type Function added in v0.34.0

type Function struct {
	Comment      sql.NullString `db:"description"`
	IsSecure     sql.NullString `db:"is_secure"`
	Name         sql.NullString `db:"name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Text         sql.NullString `db:"text"`
	DatabaseName sql.NullString `db:"database_name"`
	Arguments    sql.NullString `db:"arguments"`
}

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

type FunctionBuilder added in v0.34.0

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

FunctionBuilder abstracts the creation of Function.

func NewFunctionBuilder added in v0.54.0

func NewFunctionBuilder(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 (pb *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 (pb *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) Secure added in v0.59.0

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

Secure returns the SQL query that will change the function to a secure 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) Unsecure added in v0.59.0

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

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

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) WithSecure added in v0.59.0

func (pb *FunctionBuilder) WithSecure() *FunctionBuilder

WithSecure sets the secure boolean to true [Snowflake Reference](https://docs.snowflake.com/en/sql-reference/sql/create-function)

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 FunctionDescription added in v0.54.0

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

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.

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 AllExternalTableGrant added in v0.64.0

func AllExternalTableGrant(db, schema string) GrantBuilder

AllExternalTableGrant returns a pointer to a AllGrantBuilder for a external table.

func AllFileFormatGrant added in v0.64.0

func AllFileFormatGrant(db, schema string) GrantBuilder

AllFileFormatGrant returns a pointer to a AllGrantBuilder for a file format.

func AllFunctionGrant added in v0.64.0

func AllFunctionGrant(db, schema string) GrantBuilder

AllFunctionGrant returns a pointer to a AllGrantBuilder for a function.

func AllMaterializedViewGrant added in v0.62.0

func AllMaterializedViewGrant(db, schema string) GrantBuilder

AllMaterializedViewGrant returns a pointer to a AllGrantBuilder for a view.

func AllProcedureGrant added in v0.64.0

func AllProcedureGrant(db, schema string) GrantBuilder

AllProcedureGrant returns a pointer to a AllGrantBuilder for a procedure.

func AllSchemaGrant added in v0.62.0

func AllSchemaGrant(db string) GrantBuilder

AllSchemaGrant returns a pointer to a AllGrantBuilder for a schema.

func AllSequenceGrant added in v0.64.0

func AllSequenceGrant(db, schema string) GrantBuilder

AllSequenceGrant returns a pointer to a AllGrantBuilder for a sequence.

func AllStageGrant added in v0.62.0

func AllStageGrant(db, schema string) GrantBuilder

AllStageGrant returns a pointer to a AllGrantBuilder for a stage.

func AllStreamGrant added in v0.64.0

func AllStreamGrant(db, schema string) GrantBuilder

AllStreamGrant returns a pointer to a AllGrantBuilder for a stream.

func AllTableGrant added in v0.61.0

func AllTableGrant(db, schema string) GrantBuilder

AllTableGrant returns a pointer to a AllGrantBuilder for a table.

func AllTaskGrant added in v0.64.0

func AllTaskGrant(db, schema string) GrantBuilder

AllTaskGrant returns a pointer to a AllGrantBuilder for a task.

func AllViewGrant added in v0.62.0

func AllViewGrant(db, schema string) GrantBuilder

AllViewGrant returns a pointer to a AllGrantBuilder for a view.

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 GrantDetail added in v0.52.0

type GrantDetail struct {
	CreatedOn   sql.NullString `db:"created_on"`
	Privilege   sql.NullString `db:"privilege"`
	GrantedOn   sql.NullString `db:"granted_on"`
	Name        sql.NullString `db:"name"`
	GrantedTo   sql.NullString `db:"granted_to"`
	GranteeName sql.NullString `db:"grantee_name"`
	GrantOption sql.NullString `db:"grant_option"`
	GrantedBy   sql.NullString `db:"granted_by"`
}

func ShowFutureGrantsIn added in v0.52.0

func ShowFutureGrantsIn(db *sql.DB, objectType, objectName string) ([]GrantDetail, error)

func ShowFutureGrantsTo added in v0.52.0

func ShowFutureGrantsTo(db *sql.DB, objectType, objectName string) ([]GrantDetail, error)

func ShowGrantsOf added in v0.52.0

func ShowGrantsOf(db *sql.DB, objectType, objectName string) ([]GrantDetail, error)

func ShowGrantsOn added in v0.52.0

func ShowGrantsOn(db *sql.DB, objectType, objectName string) ([]GrantDetail, error)

func ShowGrantsOnAccount added in v0.52.0

func ShowGrantsOnAccount(db *sql.DB) ([]GrantDetail, error)

func ShowGrantsTo added in v0.52.0

func ShowGrantsTo(db *sql.DB, objectType, objectName string) ([]GrantDetail, error)

type GrantExecutable added in v0.34.0

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

type Identifier added in v0.62.0

type Identifier interface {
	QualifiedName() string
}

type KeywordPosition added in v0.62.0

type KeywordPosition = string
const (
	BeforeObjectType KeywordPosition = "beforeObjectType"
	AfterObjectType  KeywordPosition = "afterObjectType"
	PosParameter     KeywordPosition = "parameter"
)

type ManagedAccount added in v0.34.0

type ManagedAccount struct {
	Name      sql.NullString `db:"name"`
	Cloud     sql.NullString `db:"cloud"`
	Region    sql.NullString `db:"region"`
	Locator   sql.NullString `db:"locator"`
	CreatedOn sql.NullString `db:"created_on"`
	URL       sql.NullString `db:"url"`
	Comment   sql.NullString `db:"comment"`
	IsReader  bool           `db:"is_reader"`
}

func ScanManagedAccount added in v0.34.0

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

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) QualifiedName added in v0.34.0

func (mpb *MaskingPolicyBuilder) QualifiedName() string

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

type MaterializedView added in v0.34.0

type MaterializedView struct {
	Comment       sql.NullString `db:"comment"`
	IsSecure      bool           `db:"is_secure"`
	Name          sql.NullString `db:"name"`
	SchemaName    sql.NullString `db:"schema_name"`
	Text          sql.NullString `db:"text"`
	DatabaseName  sql.NullString `db:"database_name"`
	WarehouseName sql.NullString `db:"warehouse_name"`
}

func ListMaterializedViews added in v0.34.0

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

func ScanMaterializedView added in v0.34.0

func ScanMaterializedView(row *sqlx.Row) (*MaterializedView, 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 NewMaterializedViewBuilder added in v0.54.0

func NewMaterializedViewBuilder(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 NotificationIntegration added in v0.34.0

type NotificationIntegration struct {
	Name      sql.NullString `db:"name"`
	Category  sql.NullString `db:"category"`
	Type      sql.NullString `db:"type"`
	CreatedOn sql.NullString `db:"created_on"`
	Enabled   sql.NullBool   `db:"enabled"`
}

func ScanNotificationIntegration added in v0.34.0

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

type OauthIntegration added in v0.54.0

type OauthIntegration struct {
	Name            sql.NullString `db:"name"`
	Category        sql.NullString `db:"category"`
	IntegrationType sql.NullString `db:"type"`
	Enabled         sql.NullBool   `db:"enabled"`
	Comment         sql.NullString `db:"comment"`
	CreatedOn       sql.NullString `db:"created_on"`
}

func ListIntegrations added in v0.48.0

func ListIntegrations(db *sql.DB) ([]OauthIntegration, error)

func ScanOAuthIntegration added in v0.34.0

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

type ObjectParameterBuilder added in v0.61.0

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

ObjectParameterBuilder abstracts the creation of SQL queries for Snowflake object parameters.

func NewObjectParameter added in v0.61.0

func NewObjectParameter(key, value string, db *sql.DB) *ObjectParameterBuilder

func (*ObjectParameterBuilder) SetOnAccount added in v0.61.0

func (v *ObjectParameterBuilder) SetOnAccount(onAccount bool) *ObjectParameterBuilder

func (*ObjectParameterBuilder) SetParameter added in v0.61.0

func (v *ObjectParameterBuilder) SetParameter() error

func (*ObjectParameterBuilder) WithObjectIdentifier added in v0.61.0

func (v *ObjectParameterBuilder) WithObjectIdentifier(objectIdentifier string) *ObjectParameterBuilder

func (*ObjectParameterBuilder) WithObjectType added in v0.61.0

func (v *ObjectParameterBuilder) WithObjectType(objectType ObjectType) *ObjectParameterBuilder

type ObjectType added in v0.54.0

type ObjectType string

ObjectType is the type of object.

const (
	ObjectTypeDatabase         ObjectType = "DATABASE"
	ObjectTypeSchema           ObjectType = "SCHEMA"
	ObjectTypeTable            ObjectType = "TABLE"
	ObjectTypeReplicationGroup ObjectType = "REPLICATION GROUP"
	ObjectTypeFailoverGroup    ObjectType = "FAILOVER GROUP"
	ObjectTypeWarehouse        ObjectType = "WAREHOUSE"
	ObjectTypePipe             ObjectType = "PIPE"
	ObjectTypeUser             ObjectType = "USER"
	ObjectTypeShare            ObjectType = "SHARE"
	ObjectTypeTask             ObjectType = "TASK"
)

func (ObjectType) String added in v0.54.0

func (o ObjectType) String() string

type ParamType added in v0.62.0

type ParamType string
var (
	Integer    ParamType = "int"
	String     ParamType = "string"
	StringList ParamType = "stringlist"
	Bool       ParamType = "bool"
)

type Parameter added in v0.54.0

type Parameter struct {
	Key         sql.NullString `db:"key"`
	Value       sql.NullString `db:"value"`
	Default     sql.NullString `db:"default"`
	Level       sql.NullString `db:"level"`
	Description sql.NullString `db:"description"`
	PType       sql.NullString `db:"type"`
}

func ListAccountParameters added in v0.61.0

func ListAccountParameters(db *sql.DB, pattern string) ([]Parameter, error)

func ListObjectParameters added in v0.54.0

func ListObjectParameters(db *sql.DB, objectType ObjectType, objectIdentifier, pattern string) ([]Parameter, error)

func ListSessionParameters added in v0.61.0

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

func ShowAccountParameter added in v0.57.0

func ShowAccountParameter(db *sql.DB, key string) (*Parameter, error)

func ShowObjectParameter added in v0.54.0

func ShowObjectParameter(db *sql.DB, key string, objectType ObjectType, objectIdentifier string) (*Parameter, error)

func ShowSessionParameter added in v0.61.0

func ShowSessionParameter(db *sql.DB, key string, user string) (*Parameter, error)

type ParameterDefault added in v0.54.0

type ParameterDefault struct {
	TypeSet            []ParameterType
	DefaultValue       interface{}
	ValueType          reflect.Type
	Validate           func(string) error
	AllowedObjectTypes []ObjectType
}

ParameterDefault is a parameter that can be set on an account, session, or object.

func GetParameterDefault added in v0.54.0

func GetParameterDefault(key string) ParameterDefault

GetParameter returns a parameter by key.

type ParameterExecutor added in v0.61.0

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

func NewParameterExecutor added in v0.61.0

func NewParameterExecutor(db *sql.DB) *ParameterExecutor

func (*ParameterExecutor) Execute added in v0.61.0

func (v *ParameterExecutor) Execute(stmt string, args ...interface{}) error

func (*ParameterExecutor) Query added in v0.61.0

func (v *ParameterExecutor) Query(stmt string) ([]Parameter, error)

func (*ParameterExecutor) QueryOne added in v0.61.0

func (v *ParameterExecutor) QueryOne(stmt string) (*Parameter, error)

type ParameterType added in v0.54.0

type ParameterType string

ParameterType is the type of parameter.

const (
	ParameterTypeAccount ParameterType = "ACCOUNT"
	ParameterTypeSession ParameterType = "SESSION"
	ParameterTypeObject  ParameterType = "OBJECT"
)

type Pipe added in v0.34.0

type Pipe struct {
	Createdon           string         `db:"created_on"`
	Name                string         `db:"name"`
	DatabaseName        string         `db:"database_name"`
	SchemaName          string         `db:"schema_name"`
	Definition          string         `db:"definition"`
	Owner               string         `db:"owner"`
	NotificationChannel *string        `db:"notification_channel"`
	Comment             string         `db:"comment"`
	Integration         sql.NullString `db:"integration"`
	ErrorIntegration    sql.NullString `db:"error_integration"`
}

func ListPipes added in v0.34.0

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

func ScanPipe added in v0.34.0

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

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 NewPipeBuilder added in v0.54.0

func NewPipeBuilder(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 PlatformInfo added in v0.54.0

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

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 PrimaryKeyDescription added in v0.54.0

type PrimaryKeyDescription struct {
	ColumnName     sql.NullString `db:"column_name"`
	KeySequence    sql.NullString `db:"key_sequence"`
	ConstraintName sql.NullString `db:"constraint_name"`
}

func ScanPrimaryKeyDescription added in v0.34.0

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

type PrivateLinkConfig added in v0.34.0

type PrivateLinkConfig struct {
	AccountName               string
	AwsVpceID                 string
	AzurePrivateLinkServiceID string
	AccountURL                string
	OCSPURL                   string
	InternalStage             string
	SnowsightURL              string
	RegionlessSnowsightURL    string
	RegionlessAccountURL      string
	ConnectionURLs            string
}

type Procedure added in v0.34.0

type Procedure struct {
	Comment sql.NullString `db:"description"`
	// Snowflake returns is_secure in the show procedure output, but it is irrelevant
	Name         sql.NullString `db:"name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Text         sql.NullString `db:"text"`
	DatabaseName sql.NullString `db:"catalog_name"`
	Arguments    sql.NullString `db:"arguments"`
}

func ListProcedures added in v0.34.0

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

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

type ProcedureBuilder added in v0.34.0

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

ProcedureBuilder abstracts the creation of Stored Procedure.

func NewProcedureBuilder added in v0.54.0

func NewProcedureBuilder(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 (pb *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 (pb *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 (pb *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) WithHandler added in v0.60.0

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

WithHandler sets the handler method for Java / Python function.

func (*ProcedureBuilder) WithImports added in v0.60.0

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

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

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) WithPackages added in v0.60.0

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

WithPackages.

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) WithRuntimeVersion added in v0.60.0

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

WithRuntimeVersion.

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 ProcedureDescription added in v0.54.0

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

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.

type RawPlatformInfo added in v0.54.0

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

func ScanSnowflakePlatformInfo added in v0.34.0

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

func (*RawPlatformInfo) GetStructuredConfig added in v0.54.0

func (r *RawPlatformInfo) GetStructuredConfig() (*PlatformInfo, error)

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 Replication added in v0.34.0

type Replication struct {
	Region           sql.NullString `db:"snowflake_region"`
	CreatedOn        sql.NullString `db:"created_on"`
	AccountName      sql.NullString `db:"account_name"`
	DBName           sql.NullString `db:"name"`
	Comment          sql.NullString `db:"comment"`
	IsPrimary        sql.NullBool   `db:"is_primary"`
	Primary          sql.NullString `db:"primary"`
	ReplAccounts     sql.NullString `db:"replication_allowed_to_accounts"`
	FailoverAccounts sql.NullString `db:"failover_allowed_to_accounts"`
	Org              sql.NullString `db:"organization_name"`
	AccountLocator   sql.NullString `db:"account_locator"`
}

func ScanReplication added in v0.34.0

func ScanReplication(rows *sqlx.Rows, accName string) (*Replication, 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 NewReplicationBuilder added in v0.54.0

func NewReplicationBuilder(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 ResourceMonitor added in v0.34.0

type ResourceMonitor struct {
	Name                 sql.NullString `db:"name"`
	CreditQuota          sql.NullString `db:"credit_quota"`
	UsedCredits          sql.NullString `db:"used_credits"`
	RemainingCredits     sql.NullString `db:"remaining_credits"`
	Level                sql.NullString `db:"level"`
	Frequency            sql.NullString `db:"frequency"`
	StartTime            sql.NullString `db:"start_time"`
	EndTime              sql.NullString `db:"end_time"`
	NotifyAt             sql.NullString `db:"notify_at"`
	SuspendAt            sql.NullString `db:"suspend_at"`
	SuspendImmediatelyAt sql.NullString `db:"suspend_immediately_at"`
	CreatedOn            sql.NullString `db:"created_on"`
	Owner                sql.NullString `db:"owner"`
	Comment              sql.NullString `db:"comment"`
	NotifyUsers          sql.NullString `db:"notify_users"`
}

func ListResourceMonitors added in v0.34.0

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

func ScanResourceMonitor added in v0.34.0

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

type ResourceMonitorAlterBuilder added in v0.55.0

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

func (*ResourceMonitorAlterBuilder) NotifyAt added in v0.55.0

NotifyAt adds a notify trigger at the specified percentage threshold.

func (*ResourceMonitorAlterBuilder) SetOnAccount added in v0.55.0

func (rcb *ResourceMonitorAlterBuilder) SetOnAccount() string

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

func (*ResourceMonitorAlterBuilder) SetOnWarehouse added in v0.55.0

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

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

func (*ResourceMonitorAlterBuilder) Statement added in v0.55.0

func (rcb *ResourceMonitorAlterBuilder) Statement() string

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

func (*ResourceMonitorAlterBuilder) SuspendAt added in v0.55.0

SuspendAt adds a suspend trigger at the specified percentage threshold.

func (*ResourceMonitorAlterBuilder) SuspendImmediatelyAt added in v0.55.0

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

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

func (*ResourceMonitorAlterBuilder) UnsetOnAccount added in v0.55.0

func (rcb *ResourceMonitorAlterBuilder) UnsetOnAccount() string

func (*ResourceMonitorAlterBuilder) UnsetOnWarehouse added in v0.55.0

func (rcb *ResourceMonitorAlterBuilder) UnsetOnWarehouse(warehouse string) string

UnsetOnWarehouse returns the SQL query that will unset the resource monitor on the specified warehouse.

type ResourceMonitorBuilder added in v0.34.0

type ResourceMonitorBuilder struct {
	Builder
}

ResourceMonitorBuilder extends the generic builder to provide support for triggers.

func NewResourceMonitorBuilder added in v0.54.0

func NewResourceMonitorBuilder(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) Alter added in v0.55.0

Alter returns a pointer to a ResourceMonitorAlterBuilder.

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 Role added in v0.3.0

type Role struct {
	Name    sql.NullString `db:"name"`
	Comment sql.NullString `db:"comment"`
	Owner   sql.NullString `db:"owner"`
}

func ListRoles added in v0.43.1

func ListRoles(db *sql.DB, rolePattern string) ([]*Role, error)

type RoleBuilder added in v0.58.0

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

func NewRoleBuilder added in v0.54.0

func NewRoleBuilder(db *sql.DB, name string) *RoleBuilder

func (*RoleBuilder) ChangeTag added in v0.58.0

func (b *RoleBuilder) ChangeTag(tag TagValue) error

func (*RoleBuilder) Create added in v0.58.0

func (b *RoleBuilder) Create() error

func (*RoleBuilder) Drop added in v0.58.0

func (b *RoleBuilder) Drop() error

func (*RoleBuilder) Rename added in v0.58.0

func (b *RoleBuilder) Rename(newName string) error

func (*RoleBuilder) SetComment added in v0.58.0

func (b *RoleBuilder) SetComment(comment string) error

func (*RoleBuilder) SetTag added in v0.58.0

func (b *RoleBuilder) SetTag(tag TagValue) error

func (*RoleBuilder) Show added in v0.58.0

func (b *RoleBuilder) Show() (*Role, error)

func (*RoleBuilder) UnsetComment added in v0.58.0

func (b *RoleBuilder) UnsetComment() error

func (*RoleBuilder) UnsetTag added in v0.58.0

func (b *RoleBuilder) UnsetTag(tag TagValue) error

func (*RoleBuilder) WithComment added in v0.58.0

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

func (*RoleBuilder) WithName added in v0.58.0

func (b *RoleBuilder) WithName(name string) *RoleBuilder

func (*RoleBuilder) WithTags added in v0.58.0

func (b *RoleBuilder) WithTags(tags []TagValue) *RoleBuilder

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 RoleOwnershipGrant added in v0.34.0

type RoleOwnershipGrant struct {
	CreatedOn       sql.NullString `db:"created_on"`
	Name            sql.NullString `db:"name"`
	IsDefault       sql.NullString `db:"is_default"`
	IsCurrent       sql.NullString `db:"is_current"`
	IsInherited     sql.NullString `db:"is_inherited"`
	AssignedToUsers sql.NullString `db:"assigned_to_users"`
	GrantedToRoles  sql.NullString `db:"granted_to_roles"`
	GrantedRoles    sql.NullString `db:"granted_roles"`
	Owner           sql.NullString `db:"owner"`
	Comment         sql.NullString `db:"comment"`
}

func ScanRoleOwnershipGrant added in v0.34.0

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

type RoleOwnershipGrantBuilder added in v0.34.0

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

func NewRoleOwnershipGrantBuilder added in v0.54.0

func NewRoleOwnershipGrantBuilder(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 SCIMAccessToken added in v0.54.0

type SCIMAccessToken struct {
	Token string `db:"TOKEN"`
}

func ScanSCIMAccessToken added in v0.34.0

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

ScanSCIMAccessToken convert a result into a.

type SCIMIntegration added in v0.54.0

type SCIMIntegration struct {
	Name            sql.NullString `db:"name"`
	Category        sql.NullString `db:"category"`
	IntegrationType sql.NullString `db:"type"`
	CreatedOn       sql.NullString `db:"created_on"`
}

func ScanScimIntegration added in v0.34.0

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

type SFUserMappingAttribute added in v0.62.0

type SFUserMappingAttribute string
const (
	LoginName    SFUserMappingAttribute = "LOGIN_NAME"
	EmailAddress SFUserMappingAttribute = "EMAIL_ADDRESS"
)

type SQLBuilder added in v0.62.0

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

func (*SQLBuilder) Alter added in v0.62.0

func (b *SQLBuilder) Alter(obj Identifier) (string, error)

func (*SQLBuilder) Create added in v0.62.0

func (b *SQLBuilder) Create(obj Identifier) (string, error)

func (*SQLBuilder) Describe added in v0.62.0

func (b *SQLBuilder) Describe(obj Identifier) (string, error)

func (*SQLBuilder) Drop added in v0.62.0

func (b *SQLBuilder) Drop(obj Identifier) (string, error)

func (*SQLBuilder) ParseDescribe added in v0.62.0

func (b *SQLBuilder) ParseDescribe(rows *sql.Rows, obj Identifier) error

func (*SQLBuilder) ShowLike added in v0.62.0

func (b *SQLBuilder) ShowLike(obj Identifier) (string, error)

func (*SQLBuilder) Unset added in v0.62.0

func (b *SQLBuilder) Unset(obj Identifier) (string, error)

type SQLBuilderConfig added in v0.62.0

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

type SQLParameter added in v0.62.0

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

type SamlIntegration added in v0.34.0

type SamlIntegration struct {
	Name            sql.NullString `db:"name"`
	Category        sql.NullString `db:"category"`
	IntegrationType sql.NullString `db:"type"`
	CreatedOn       sql.NullString `db:"created_on"`
	Enabled         sql.NullBool   `db:"enabled"`
}

func ScanSamlIntegration added in v0.34.0

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

type Schema added in v0.34.0

type Schema struct {
	Name          sql.NullString `db:"name"`
	DatabaseName  sql.NullString `db:"database_name"`
	Comment       sql.NullString `db:"comment"`
	Options       sql.NullString `db:"options"`
	RetentionTime sql.NullString `db:"retention_time"`
}

func ListSchemas added in v0.34.0

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

func ScanSchema added in v0.34.0

func ScanSchema(row *sqlx.Row) (*Schema, 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 NewSchemaBuilder added in v0.54.0

func NewSchemaBuilder(name string) *SchemaBuilder

NewSchemaBuilder 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 SchemaIdentifier added in v0.62.0

type SchemaIdentifier struct {
	Database string
	Schema   string
}

func SchemaIdentifierFromQualifiedName added in v0.62.0

func SchemaIdentifierFromQualifiedName(name string) *SchemaIdentifier

func (*SchemaIdentifier) QualifiedName added in v0.62.0

func (i *SchemaIdentifier) QualifiedName() string

type SchemaObjectIdentifier added in v0.62.0

type SchemaObjectIdentifier struct {
	Database   string
	Schema     string
	ObjectName string `db:"NAME"`
}

func SchemaObjectIdentifierFromQualifiedName added in v0.62.0

func SchemaObjectIdentifierFromQualifiedName(name string) *SchemaObjectIdentifier

func (*SchemaObjectIdentifier) QualifiedName added in v0.62.0

func (i *SchemaObjectIdentifier) QualifiedName() string

type Sequence added in v0.34.0

type Sequence struct {
	Name       sql.NullString `db:"name"`
	DBName     sql.NullString `db:"database_name"`
	SchemaName sql.NullString `db:"schema_name"`
	NextValue  sql.NullString `db:"next_value"`
	Increment  sql.NullString `db:"interval"`
	CreatedOn  sql.NullString `db:"created_on"`
	Owner      sql.NullString `db:"owner"`
	Comment    sql.NullString `db:"comment"`
}

func ListSequences added in v0.34.0

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

func ScanSequence added in v0.34.0

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

type SequenceBuilder added in v0.34.0

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

func NewSequenceBuilder added in v0.54.0

func NewSequenceBuilder(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 SessionParameterBuilder added in v0.61.0

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

SessionParameterBuilder abstracts the creation of SQL queries for Snowflake session parameters.

func NewSessionParameter added in v0.61.0

func NewSessionParameter(key, value string, db *sql.DB) *SessionParameterBuilder

func (*SessionParameterBuilder) SetOnAccount added in v0.61.0

func (v *SessionParameterBuilder) SetOnAccount(onAccount bool) *SessionParameterBuilder

func (*SessionParameterBuilder) SetParameter added in v0.61.0

func (v *SessionParameterBuilder) SetParameter() error

func (*SessionParameterBuilder) SetUser added in v0.61.0

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 Share added in v0.34.0

type Share struct {
	Name    sql.NullString `db:"name"`
	To      sql.NullString `db:"to"`
	Comment sql.NullString `db:"comment"`
	Kind    sql.NullString `db:"kind"`
	Owner   sql.NullString `db:"owner"`
}

func ListShares added in v0.62.0

func ListShares(db *sql.DB, sharePattern string) ([]*Share, error)

func ScanShare added in v0.34.0

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

type Stage added in v0.34.0

type Stage struct {
	Name               *string `db:"name"`
	DatabaseName       *string `db:"database_name"`
	SchemaName         *string `db:"schema_name"`
	Comment            *string `db:"comment"`
	StorageIntegration *string `db:"storage_integration"`
}

func ListStages added in v0.34.0

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

func ScanStageShow added in v0.34.0

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

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 NewStageBuilder added in v0.54.0

func NewStageBuilder(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 StorageIntegration added in v0.34.0

type StorageIntegration struct {
	Name            sql.NullString `db:"name"`
	Category        sql.NullString `db:"category"`
	IntegrationType sql.NullString `db:"type"`
	CreatedOn       sql.NullString `db:"created_on"`
	Enabled         sql.NullBool   `db:"enabled"`
	Comment         sql.NullString `db:"comment"`
}

func ListStorageIntegrations added in v0.34.0

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

func ScanStorageIntegration added in v0.34.0

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

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) WithOnStage added in v0.59.0

func (sb *StreamBuilder) WithOnStage(d string, s string, t string) *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 NewSystemGenerateSCIMAccessTokenBuilder added in v0.54.0

func NewSystemGenerateSCIMAccessTokenBuilder(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 NewSystemGetAWSSNSIAMPolicyBuilder added in v0.54.0

func NewSystemGetAWSSNSIAMPolicyBuilder(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 Table added in v0.34.0

type Table struct {
	CreatedOn           sql.NullString `db:"created_on"`
	TableName           sql.NullString `db:"name"`
	DatabaseName        sql.NullString `db:"database_name"`
	SchemaName          sql.NullString `db:"schema_name"`
	Kind                sql.NullString `db:"kind"`
	Comment             sql.NullString `db:"comment"`
	ClusterBy           sql.NullString `db:"cluster_by"`
	Rows                sql.NullString `db:"row"`
	Bytes               sql.NullString `db:"bytes"`
	Owner               sql.NullString `db:"owner"`
	RetentionTime       sql.NullInt32  `db:"retention_time"`
	AutomaticClustering sql.NullString `db:"automatic_clustering"`
	ChangeTracking      sql.NullString `db:"change_tracking"`
	IsExternal          sql.NullString `db:"is_external"`
}

func ListTables added in v0.34.0

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

func ScanTable added in v0.34.0

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

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 NewTableBuilder added in v0.54.0

func NewTableBuilder(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 NewTableWithColumnDefinitionsBuilder added in v0.54.0

func NewTableWithColumnDefinitionsBuilder(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, maskingPolicy 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) ChangeColumnMaskingPolicy added in v0.49.0

func (tb *TableBuilder) ChangeColumnMaskingPolicy(name string, maskingPolicy 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 TableColumn added in v0.63.0

type TableColumn struct {
	Table  *SchemaObjectIdentifier
	Column string
}

type TableColumnMaskingPolicyApplication added in v0.63.0

type TableColumnMaskingPolicyApplication struct {
	Table         *SchemaObjectIdentifier
	Column        string
	MaskingPolicy *SchemaObjectIdentifier
}

type TableColumnMaskingPolicyApplicationCreateInput added in v0.63.0

type TableColumnMaskingPolicyApplicationCreateInput struct {
	TableColumnMaskingPolicyApplication
}

type TableColumnMaskingPolicyApplicationDeleteInput added in v0.63.0

type TableColumnMaskingPolicyApplicationDeleteInput struct {
	TableColumn
}

type TableColumnMaskingPolicyApplicationManager added in v0.63.0

type TableColumnMaskingPolicyApplicationManager struct{}

func NewTableColumnMaskingPolicyApplicationManager added in v0.63.0

func NewTableColumnMaskingPolicyApplicationManager() *TableColumnMaskingPolicyApplicationManager

func (*TableColumnMaskingPolicyApplicationManager) Create added in v0.63.0

func (*TableColumnMaskingPolicyApplicationManager) Delete added in v0.63.0

func (*TableColumnMaskingPolicyApplicationManager) Parse added in v0.63.0

func (*TableColumnMaskingPolicyApplicationManager) Read added in v0.63.0

type TableColumnMaskingPolicyApplicationReadInput added in v0.63.0

type TableColumnMaskingPolicyApplicationReadInput = TableColumn

type TableConstraint added in v0.47.0

type TableConstraint struct {
	ConstraintCatalog sql.NullString `db:"CONSTRAINT_CATALOG"`
	ConstraintSchema  sql.NullString `db:"CONSTRAINT_SCHEMA"`
	ConstraintName    sql.NullString `db:"CONSTRAINT_NAME"`
	TableCatalog      sql.NullString `db:"TABLE_CATALOG"`
	TableSchema       sql.NullString `db:"TABLE_SCHEMA"`
	TableName         sql.NullString `db:"TABLE_NAME"`
	ConstraintType    sql.NullString `db:"CONSTRAINT_TYPE"`
	IsDeferrable      sql.NullString `db:"IS_DEFERRABLE"`
	InitiallyDeferred sql.NullString `db:"INITIALLY_DEFERRED"`
	Enforced          sql.NullString `db:"ENFORCED"`
	Comment           sql.NullString `db:"COMMENT"`
}

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.

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 NewTableConstraintBuilder added in v0.54.0

func NewTableConstraintBuilder(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 TableDescription added in v0.54.0

type TableDescription struct {
	Name          sql.NullString `db:"name"`
	Type          sql.NullString `db:"type"`
	Kind          sql.NullString `db:"kind"`
	Nullable      sql.NullString `db:"null?"`
	Default       sql.NullString `db:"default"`
	Comment       sql.NullString `db:"comment"`
	MaskingPolicy sql.NullString `db:"policy name"`
}

func ScanTableDescription added in v0.34.0

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

func (*TableDescription) ColumnDefault added in v0.54.0

func (td *TableDescription) ColumnDefault() *ColumnDefault

func (*TableDescription) ColumnIdentity added in v0.54.0

func (td *TableDescription) ColumnIdentity() *ColumnIdentity

func (*TableDescription) IsNullable added in v0.54.0

func (td *TableDescription) IsNullable() bool

type Tag added in v0.34.0

type Tag struct {
	Name          sql.NullString `db:"name"`
	DatabaseName  sql.NullString `db:"database_name"`
	SchemaName    sql.NullString `db:"schema_name"`
	Comment       sql.NullString `db:"comment"`
	AllowedValues sql.NullString `db:"allowed_values"`
}

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 ScanTag added in v0.34.0

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

type TagAssociation added in v0.42.0

type TagAssociation struct {
	TagValue sql.NullString `db:"TAG_VALUE"`
}

func ListTagAssociations added in v0.42.0

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

func ScanTagAssociation added in v0.48.0

func ScanTagAssociation(row *sqlx.Row) (*TagAssociation, error)

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 NewTagAssociationBuilder added in v0.54.0

func NewTagAssociationBuilder(tagID string) *TagAssociationBuilder

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

Supported DDL operations are:

  • ALTER <object_type> SET TAG
  • ALTER <object_type> UNSET TAG
  • SYSTEM$GET_TAG (get current tag value)

[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) GetTableAndColumnName added in v0.56.2

func (tb *TagAssociationBuilder) GetTableAndColumnName() (string, string)

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) Show added in v0.48.0

func (tb *TagAssociationBuilder) Show() string

Show returns the SQL query that will show the current tag value on an object.

func (*TagAssociationBuilder) WithObjectIdentifier added in v0.48.0

func (tb *TagAssociationBuilder) WithObjectIdentifier(objectIdentifier string) *TagAssociationBuilder

WithObjectIdentifier 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 NewTagBuilder added in v0.54.0

func NewTagBuilder(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 TagPolicyAttachment added in v0.54.0

type TagPolicyAttachment struct {
	PolicyDB        sql.NullString `db:"POLICY_DB"`
	PolicySchema    sql.NullString `db:"POLICY_SCHEMA"`
	PolicyName      sql.NullString `db:"POLICY_NAME"`
	PolicyKind      sql.NullString `db:"POLICY_KIND"`
	RefDB           sql.NullString `db:"REF_DATABASE_NAME"`
	RefSchema       sql.NullString `db:"REF_SCHEMA_NAME"`
	RefEntity       sql.NullString `db:"REF_ENTITY_NAME"`
	RefEntityDomain sql.NullString `db:"REF_ENTITY_DOMAIN"`
}

func ScanTagPolicy added in v0.43.0

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

type TagValue added in v0.34.0

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

type Task added in v0.34.0

type Task struct {
	ID                        string         `db:"id"`
	CreatedOn                 string         `db:"created_on"`
	Name                      string         `db:"name"`
	DatabaseName              string         `db:"database_name"`
	SchemaName                string         `db:"schema_name"`
	Owner                     string         `db:"owner"`
	Comment                   *string        `db:"comment"`
	Warehouse                 *string        `db:"warehouse"`
	Schedule                  *string        `db:"schedule"`
	Predecessors              *string        `db:"predecessors"`
	State                     string         `db:"state"`
	Definition                string         `db:"definition"`
	Condition                 *string        `db:"condition"`
	ErrorIntegration          sql.NullString `db:"error_integration"`
	AllowOverlappingExecution sql.NullString `db:"allow_overlapping_execution"`
}

func GetRootTasks added in v0.50.0

func GetRootTasks(name string, databaseName string, schemaName string, db *sql.DB) ([]*Task, error)

GetRootTasks tries to retrieve the root of current task or returns the current (standalone) task.

func ListTasks added in v0.34.0

func ListTasks(databaseName string, schemaName string, db *sql.DB) ([]Task, 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 (*Task) GetPredecessors added in v0.54.0

func (t *Task) GetPredecessors() ([]string, error)

func (*Task) IsEnabled added in v0.54.0

func (t *Task) IsEnabled() bool

func (*Task) QualifiedName added in v0.54.0

func (t *Task) QualifiedName() string

func (*Task) Resume added in v0.54.0

func (t *Task) Resume() string

func (*Task) Suspend added in v0.54.0

func (t *Task) Suspend() 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 NewTaskBuilder added in v0.54.0

func NewTaskBuilder(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) AddAfter added in v0.50.0

func (tb *TaskBuilder) AddAfter(after []string) string

AddAfter 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(name string) string

GetFullName prepends db and schema to in parameter.

func (*TaskBuilder) IsAllowOverlappingExecution added in v0.49.0

func (tb *TaskBuilder) IsAllowOverlappingExecution() bool

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) RemoveAfter added in v0.50.0

func (tb *TaskBuilder) RemoveAfter(after []string) string

RemoveAfter returns the sql that will remove the after dependency for the task.

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) 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) SetAllowOverlappingExecution added in v0.49.0

func (tb *TaskBuilder) SetAllowOverlappingExecution() *TaskBuilder

func (*TaskBuilder) SetAllowOverlappingExecutionParameter added in v0.49.0

func (tb *TaskBuilder) SetAllowOverlappingExecutionParameter() string

SetAllowOverlappingExecutionParameter returns the sql that will change the ALLOW_OVERLAPPING_EXECUTION for 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) UnsetAllowOverlappingExecutionParameter added in v0.49.0

func (tb *TaskBuilder) UnsetAllowOverlappingExecutionParameter() string

UnsetAllowOverlappingExecutionParameter returns the sql that will unset the ALLOW_OVERLAPPING_EXECUTION for the task.

func (*TaskBuilder) WithAfter added in v0.50.0

func (tb *TaskBuilder) WithAfter(after []string) *TaskBuilder

WithAfter adds after task dependencies to the TaskBuilder.

func (*TaskBuilder) WithAllowOverlappingExecution added in v0.49.0

func (tb *TaskBuilder) WithAllowOverlappingExecution(flag bool) *TaskBuilder

WithAllowOverlappingExecution set the ALLOW_OVERLAPPING_EXECUTION on the TaskBuilder.

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) 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 TaskParams added in v0.54.0

type TaskParams struct {
	Key          string `db:"key"`
	Value        string `db:"value"`
	DefaultValue string `db:"default"`
	Level        string `db:"level"`
	Description  string `db:"description"`
}

TaskParams struct to represent a row of parameters.

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.

type TimeFormat added in v0.54.0

type TimeFormat string
const (
	TimeFormatISO TimeFormat = "TimeFormatISO"
	TimeFormatRFC TimeFormat = "TimeFormatRFC"
	TimeFormatAny TimeFormat = "TimeFormatAny"
)

type TimeStampFormat added in v0.54.0

type TimeStampFormat string
const (
	TimeStampFormatISO   TimeStampFormat = "TimeStampFormatISO"
	TimeStampFormatRFC   TimeStampFormat = "TimeStampFormatRFC"
	TimeStampFormatOther TimeStampFormat = "TimeStampFormatOther"
	TimeStampFormatAny   TimeStampFormat = "TimeStampFormatAny"
)

type TopLevelIdentifier added in v0.62.0

type TopLevelIdentifier struct {
	Name string
}

func TopLevelIdentifierFromQualifiedName added in v0.62.0

func TopLevelIdentifierFromQualifiedName(name string) *TopLevelIdentifier

func (*TopLevelIdentifier) QualifiedName added in v0.62.0

func (i *TopLevelIdentifier) QualifiedName() string

type User added in v0.3.0

type User struct {
	Comment               sql.NullString `db:"comment"`
	DefaultNamespace      sql.NullString `db:"default_namespace"`
	DefaultRole           sql.NullString `db:"default_role"`
	DefaultSecondaryRoles sql.NullString `db:"default_secondary_roles"`
	DefaultWarehouse      sql.NullString `db:"default_warehouse"`
	Disabled              bool           `db:"disabled"`
	DisplayName           sql.NullString `db:"display_name"`
	Email                 sql.NullString `db:"email"`
	FirstName             sql.NullString `db:"first_name"`
	HasRsaPublicKey       bool           `db:"has_rsa_public_key"`
	LastName              sql.NullString `db:"last_name"`
	LoginName             sql.NullString `db:"login_name"`
	Name                  sql.NullString `db:"name"`
}

func ListUsers added in v0.34.0

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

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)

type UserFunctions added in v0.54.0

type UserFunctions struct {
	Name        sql.NullString `db:"name"`
	Arguments   sql.NullString `db:"arguments"`
	Description sql.NullString `db:"description"`
	Language    sql.NullString `db:"language"`
}

func ListUserFunctions added in v0.54.0

func ListUserFunctions(databaseName string, schemaName string, db *sql.DB) ([]UserFunctions, error)

type UserOwnershipGrant added in v0.34.0

type UserOwnershipGrant struct {
	Name                  sql.NullString `db:"name"`
	CreatedOn             sql.NullString `db:"created_on"`
	LoginName             sql.NullString `db:"login_name"`
	DisplayName           sql.NullString `db:"display_name"`
	FirstName             sql.NullString `db:"first_name"`
	LastName              sql.NullString `db:"last_name"`
	Email                 sql.NullString `db:"email"`
	MinsToUnlock          sql.NullString `db:"mins_to_unlock"`
	DaysToExpiry          sql.NullString `db:"days_to_expiry"`
	Comment               sql.NullString `db:"comment"`
	Disabled              sql.NullString `db:"disabled"`
	MustChangePassword    sql.NullString `db:"must_change_password"`
	SnowflakeLock         sql.NullString `db:"snowflake_lock"`
	DefaultWarehouse      sql.NullString `db:"default_warehouse"`
	DefaultNamespace      sql.NullString `db:"default_namespace"`
	DefaultRole           sql.NullString `db:"default_role"`
	DefaultSecondaryRoles sql.NullString `db:"default_secondary_roles"`
	ExtAuthnDuo           sql.NullString `db:"ext_authn_duo"`
	ExtAuthnUID           sql.NullString `db:"ext_authn_uid"`
	MinsToBypassMFA       sql.NullString `db:"mins_to_bypass_mfa"`
	Owner                 sql.NullString `db:"owner"`
	LastSuccessLogin      sql.NullString `db:"last_success_login"`
	ExpiresAtTime         sql.NullString `db:"expires_at_time"`
	LockedUntilTime       sql.NullString `db:"locked_until_time"`
	HasPassword           sql.NullString `db:"has_password"`
	HasRsaPublicKey       sql.NullString `db:"has_rsa_public_key"`
}

func ScanUserOwnershipGrant added in v0.34.0

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

type UserOwnershipGrantBuilder added in v0.34.0

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

func NewUserOwnershipGrantBuilder added in v0.54.0

func NewUserOwnershipGrantBuilder(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 View added in v0.34.0

type View struct {
	Comment      sql.NullString `db:"comment"`
	IsSecure     bool           `db:"is_secure"`
	Name         sql.NullString `db:"name"`
	SchemaName   sql.NullString `db:"schema_name"`
	Text         sql.NullString `db:"text"`
	DatabaseName sql.NullString `db:"database_name"`
}

func ListViews added in v0.34.0

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

func ScanView added in v0.34.0

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

func (*View) HasCopyGrants added in v0.61.0

func (v *View) HasCopyGrants() bool

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 NewViewBuilder added in v0.54.0

func NewViewBuilder(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) WithCopyGrants added in v0.61.0

func (vb *ViewBuilder) WithCopyGrants() *ViewBuilder

WithCopyGrants adds the "COPY GRANTS" option 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 Warehouse added in v0.3.0

type Warehouse struct {
	Name                            string        `db:"name"`
	State                           string        `db:"state"`
	Type                            string        `db:"type"`
	Size                            string        `db:"size"`
	MinClusterCount                 int64         `db:"min_cluster_count"`
	MaxClusterCount                 int64         `db:"max_cluster_count"`
	StartedClusters                 int64         `db:"started_clusters"`
	Running                         int64         `db:"running"`
	Queued                          int64         `db:"queued"`
	IsDefault                       string        `db:"is_default"`
	IsCurrent                       string        `db:"is_current"`
	AutoSuspend                     sql.NullInt64 `db:"auto_suspend"`
	AutoResume                      bool          `db:"auto_resume"`
	Available                       string        `db:"available"`
	Provisioning                    string        `db:"provisioning"`
	Quiescing                       string        `db:"quiescing"`
	Other                           string        `db:"other"`
	CreatedOn                       time.Time     `db:"created_on"`
	ResumedOn                       time.Time     `db:"resumed_on"`
	UpdatedOn                       time.Time     `db:"updated_on"`
	Owner                           string        `db:"owner"`
	Comment                         string        `db:"comment"`
	EnableQueryAcceleration         bool          `db:"enable_query_acceleration"`
	QueryAccelerationMaxScaleFactor int           `db:"query_acceleration_max_scale_factor"`
	ResourceMonitor                 string        `db:"resource_monitor"`
	Actives                         int64         `db:"actives"`
	Pendings                        int64         `db:"pendings"`
	Failed                          int64         `db:"failed"`
	Suspended                       int64         `db:"suspended"`
	UUID                            string        `db:"uuid"`
	ScalingPolicy                   string        `db:"scaling_policy"`
	WarehouseType                   string        `db:"warehouse_type"`
}

warehouse is a go representation of a grant that can be used in conjunction with github.com/jmoiron/sqlx.

func ListWarehouses added in v0.34.0

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

func ScanWarehouse added in v0.34.0

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

type WarehouseBuilder added in v0.34.0

type WarehouseBuilder struct {
	*Builder
}

func NewWarehouseBuilder added in v0.54.0

func NewWarehouseBuilder(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.

type WarehouseParams added in v0.54.0

type WarehouseParams struct {
	Key          string `db:"key"`
	Value        string `db:"value"`
	DefaultValue string `db:"default"`
	Level        string `db:"level"`
	Description  string `db:"description"`
	Type         string `db:"type"`
}

warehouseParams struct to represent a row of parameters.

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.

Jump to

Keyboard shortcuts

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