snowflake

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SfAccount           = "sf-account"
	SfUser              = "sf-user"
	SfPassword          = "sf-password"
	SfRole              = "sf-role"
	SfExcludedDatabases = "sf-excluded-databases"
	SfExcludedSchemas   = "sf-excluded-schemas"
	SfExcludedOwners    = "sf-excluded-owners"
)
View Source
const ROLE_SEPARATOR = "_"
View Source
const SfLimit = 10000

Variables

View Source
var ACCEPTED_TYPES = map[string]struct{}{"ACCOUNT": {}, "WAREHOUSE": {}, "DATABASE": {}, "SCHEMA": {}, "TABLE": {}, "COLUMN": {}, "SHARED-DATABASE": {}}
View Source
var PermissionMap = map[string]PermissionTarget{
	"READ":  {/* contains filtered or unexported fields */},
	"WRITE": {/* contains filtered or unexported fields */},
}
View Source
var ROLES_NOTINTERNALIZABLE = []string{"ORGADMIN", "ACCOUNTADMIN", "SECURITYADMIN", "USERADMIN", "SYSADMIN", "PUBLIC"}

Functions

func CheckSFLimitExceeded

func CheckSFLimitExceeded(query string, size int) error

func ConnectAndQuery

func ConnectAndQuery(params map[string]interface{}, role, query string) (*sql.Rows, error)

func ConnectToSnowflake

func ConnectToSnowflake(params map[string]interface{}, role string) (*sql.DB, error)

func QuerySnowflake

func QuerySnowflake(conn *sql.DB, query string) (*sql.Rows, error)

Types

type AccessSyncer

type AccessSyncer struct {
}

func (*AccessSyncer) SyncFromTarget

func (*AccessSyncer) SyncToTarget

type DataSourceSyncer

type DataSourceSyncer struct {
}

func (*DataSourceSyncer) GetMetaData

func (s *DataSourceSyncer) GetMetaData() ds.MetaData

func (*DataSourceSyncer) SyncDataSource

func (s *DataSourceSyncer) SyncDataSource(config *ds.DataSourceSyncConfig) ds.DataSourceSyncResult

type DataUsageSyncer

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

func NewDataUsageSyncer

func NewDataUsageSyncer() *DataUsageSyncer

func (*DataUsageSyncer) SyncDataUsage

func (s *DataUsageSyncer) SyncDataUsage(ctx context.Context, fileCreator wrappers.DataUsageStatementHandler, configParams *config.ConfigMap) error

type EnrichedAccess

type EnrichedAccess struct {
	Access         *importer.Access
	AccessProvider *importer.AccessProvider
}

type Grant

type Grant struct {
	Permissions string
	On          string
}

type IdentityStoreSyncer

type IdentityStoreSyncer struct {
}

func (*IdentityStoreSyncer) SyncIdentityStore

type NullString

type NullString sql.NullString

Implementation of Scanner interface for NullString

func (*NullString) Scan

func (nullString *NullString) Scan(value interface{}) error

type PermissionTarget

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

PermissionTarget is used as value for the PermissionMap to map a Raito permission to a list of snowflake permissions and a string to use in the role name to represent the permission

type QueryDbEntities

type QueryDbEntities struct {
	ExternalId            string     `db:"QUERY_ID" useColumnName:"true"`
	Status                string     `db:"EXECUTION_STATUS" useColumnName:"true"`
	Query                 string     `db:"QUERY_TEXT" useColumnName:"true"`
	ErrorMessage          NullString `db:"ERROR_MESSAGE" useColumnName:"true"`
	DatabaseName          NullString `db:"DATABASE_NAME" useColumnName:"true"`
	SchemaName            NullString `db:"SCHEMA_NAME" useColumnName:"true"`
	User                  string     `db:"USER_NAME" useColumnName:"true"`
	Role                  string     `db:"ROLE_NAME" useColumnName:"true"`
	StartTime             string     `db:"START_TIME" useColumnName:"true"`
	EndTime               string     `db:"END_TIME" useColumnName:"true"`
	BytesTranferred       int        `db:"OUTBOUND_DATA_TRANSFER_BYTES" useColumnName:"true"`
	RowsReturned          int        `db:"EXTERNAL_FUNCTION_TOTAL_SENT_ROWS" useColumnName:"true"`
	CloudCreditsUsed      float32    `db:"CREDITS_USED_CLOUD_SERVICES" useColumnName:"true"`
	AccessId              NullString `db:"QID"`
	DirectObjectsAccessed *string    `db:"DIRECT_OBJECTS_ACCESSED"`
	BaseObjectsAccessed   *string    `db:"BASE_OBJECTS_ACCESSED"`
	ObjectsModified       *string    `db:"OBJECTS_MODIFIED"`
}

func (QueryDbEntities) String

func (entity QueryDbEntities) String() string

type SnowflakeRepository

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

func NewSnowflakeRepository

func NewSnowflakeRepository(params map[string]interface{}, role string) (*SnowflakeRepository, error)

func (*SnowflakeRepository) BatchingInformation

func (repo *SnowflakeRepository) BatchingInformation(startDate *time.Time, historyTable string) (*string, *string, int, error)

func (*SnowflakeRepository) Close

func (repo *SnowflakeRepository) Close() error

func (*SnowflakeRepository) DataUsage

func (repo *SnowflakeRepository) DataUsage(columns []string, limit int, offset int, historyTable string, minTime, maxTime *string, accessHistoryAvailable bool) ([]QueryDbEntities, error)

func (*SnowflakeRepository) TotalQueryTime

func (repo *SnowflakeRepository) TotalQueryTime() time.Duration

Jump to

Keyboard shortcuts

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