snowflake

package
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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 IsResourceNotExistOrNotAuthorized added in v0.44.0

func IsResourceNotExistOrNotAuthorized(errorString string, resourceType string) bool

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 QuoteStringList added in v0.86.0

func QuoteStringList(instrings []string) []string

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.

Types

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 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 (agb *AllGrantBuilder) GrantType() string

func (*AllGrantBuilder) Name added in v0.61.0

func (agb *AllGrantBuilder) Name() string

Name returns the object name for this FutureGrantBuilder.

func (*AllGrantBuilder) Role added in v0.61.0

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

Role returns a pointer to a AllGrantExecutable for a role.

func (*AllGrantBuilder) Share added in v0.61.0

func (agb *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 (agb *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 (ege *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 (ege *AllGrantExecutable) Revoke(p string) []string

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

func (*AllGrantExecutable) RevokeOwnership added in v0.65.0

func (ege *AllGrantExecutable) RevokeOwnership(r string) []string

Revoke returns the SQL that will revoke ownership privileges on the grant from the grantee. Note: returns the same SQL as Revoke.

func (*AllGrantExecutable) Show added in v0.64.0

func (ege *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 (
	AllAccountGrantAccount       AllGrantType = "ACCOUNT"
	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 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 (*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 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 CreateBuilder added in v0.3.0

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

func (*CreateBuilder) GetTagValueString added in v0.34.0

func (b *CreateBuilder) GetTagValueString() string

func (*CreateBuilder) SetBool added in v0.3.0

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

func (*CreateBuilder) SetFloat added in v0.34.0

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

func (*CreateBuilder) SetInt added in v0.3.0

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

func (*CreateBuilder) SetRaw added in v0.34.0

func (b *CreateBuilder) SetRaw(rawStatement string)

func (*CreateBuilder) SetString added in v0.3.0

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

func (*CreateBuilder) SetStringList added in v0.34.0

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

func (*CreateBuilder) SetTags added in v0.34.0

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

func (*CreateBuilder) Statement added in v0.3.0

func (b *CreateBuilder) Statement() string

type CurrentGrantBuilder added in v0.34.0

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

CurrentGrantBuilder abstracts the creation of GrantExecutables.

func (*CurrentGrantBuilder) GrantType added in v0.34.0

func (gb *CurrentGrantBuilder) GrantType() string

func (*CurrentGrantBuilder) Name added in v0.34.0

func (gb *CurrentGrantBuilder) Name() string

Name returns the object name for this CurrentGrantBuilder.

func (*CurrentGrantBuilder) Role added in v0.34.0

Role returns a pointer to a CurrentGrantExecutable for a role.

func (*CurrentGrantBuilder) Share added in v0.34.0

Share returns a pointer to a CurrentGrantExecutable for a share.

func (*CurrentGrantBuilder) Show added in v0.34.0

func (gb *CurrentGrantBuilder) Show() string

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

type CurrentGrantExecutable added in v0.34.0

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

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

func (*CurrentGrantExecutable) Grant added in v0.34.0

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

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

func (*CurrentGrantExecutable) Revoke added in v0.34.0

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

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

func (*CurrentGrantExecutable) RevokeOwnership added in v0.65.0

func (ge *CurrentGrantExecutable) RevokeOwnership(r string) []string

Revoke returns the SQL that will revoke ownership privileges on the grant from the grantee. Since 10/2020 Snowflake dropped support for REVOKE OWNERSHIP. It's only possible to transfer it to another role now, so we grant it to role r.

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

type EntityType string
const (
	SecurityIntegrationType EntityType = "SECURITY INTEGRATION"
)

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   sql.NullString `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 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) RevokeOwnership added in v0.65.0

func (fge *FutureGrantExecutable) RevokeOwnership(r string) []string

Revoke returns the SQL that will revoke ownership privileges on the grant from the grantee. Note: returns the same SQL as Revoke.

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 FailoverGroupGrant added in v0.65.0

func FailoverGroupGrant(failoverGroup string) GrantBuilder

FailoverGroupGrant returns a pointer to a CurrentGrantBuilder for a failover group.

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
	RevokeOwnership(r 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 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 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 ParamType added in v0.62.0

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

type PlatformInfo added in v0.54.0

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

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 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 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) 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

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

type SchemaIdentifier struct {
	Database string
	Schema   string
}

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 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 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) ChangeStorageIntegrationAndUrl added in v0.70.0

func (sb *StageBuilder) ChangeStorageIntegrationAndUrl(s string, url string) string

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) 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) 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 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 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 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 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

RemoveMaskingPolicy 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 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 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 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) ExtractDynamicTable added in v0.86.0

func (e *ViewSelectStatementExtractor) ExtractDynamicTable() (string, error)

func (*ViewSelectStatementExtractor) ExtractMaterializedView added in v0.34.0

func (e *ViewSelectStatementExtractor) ExtractMaterializedView() (string, error)

Jump to

Keyboard shortcuts

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