Documentation
¶
Index ¶
- Constants
- func CleanQuery(query string) string
- func CreateTemplate(ctx context.Context, subQueries map[string]string, ps map[string]interface{}, ...) *template.Template
- func GetConnectionStringFromParsedLayers(parsedValues *values.Values) (string, error)
- func GetConnectionStringFromSqlConnectionLayer(parsedValues *values.Values, sqlConnectionLayerName string, ...) (string, error)
- func OpenDatabaseFromDefaultSqlConnectionLayer(ctx context.Context, parsedValues *values.Values) (*sqlx.DB, error)
- func OpenDatabaseFromSqlConnectionLayer(ctx context.Context, parsedValues *values.Values, ...) (*sqlx.DB, error)
- func RenderQuery(ctx context.Context, db *sqlx.DB, query string, subQueries map[string]string, ...) (string, error)
- func RunNamedQueryIntoGlaze(dbContext context.Context, db *sqlx.DB, query string, ...) error
- func RunQuery(ctx context.Context, subQueries map[string]string, query string, ...) (string, *sqlx.Rows, error)
- func RunQueryIntoGlaze(dbContext context.Context, db *sqlx.DB, query string, parameters []interface{}, ...) error
- type DBConnectionFactory
- type DatabaseConfig
- type DbtParameterLayer
- type DbtSettings
- type Source
- type SqlConnectionParameterLayer
- type SqlConnectionSettings
Constants ¶
View Source
const DbtSlug = "dbt"
View Source
const SqlConnectionSlug = "sql-connection"
Variables ¶
This section is empty.
Functions ¶
func CleanQuery ¶ added in v0.0.21
func CreateTemplate ¶
func GetConnectionStringFromParsedLayers ¶ added in v0.1.40
GetConnectionStringFromParsedLayers extracts a connection string from parsed values. This is useful for tools like River that need a connection string directly
func GetConnectionStringFromSqlConnectionLayer ¶ added in v0.1.40
func GetConnectionStringFromSqlConnectionLayer( parsedValues *values.Values, sqlConnectionLayerName string, dbtLayerName string, ) (string, error)
GetConnectionStringFromSqlConnectionLayer extracts a connection string from specific section names
func RenderQuery ¶ added in v0.0.28
func RunNamedQueryIntoGlaze ¶
func RunQueryIntoGlaze ¶
Types ¶
type DBConnectionFactory ¶ added in v0.1.0
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `glazed:"host"`
Database string `glazed:"database"`
User string `glazed:"user"`
Password string `glazed:"password"` // #nosec G117 -- Password is part of the DB config model.
Port int `glazed:"port"`
Schema string `glazed:"schema"`
Type string `glazed:"db-type"`
DSN string `glazed:"dsn"`
Driver string `glazed:"driver"`
SSLDisable bool `glazed:"ssl-disable"`
DbtProfilesPath string `glazed:"dbt-profiles-path"`
DbtProfile string `glazed:"dbt-profile"`
UseDbtProfiles bool `glazed:"use-dbt-profiles"`
}
func NewConfigFromParsedLayers ¶
func NewConfigFromParsedLayers(parsedSections ...*values.SectionValues) (*DatabaseConfig, error)
func NewConfigFromRawParsedLayers ¶ added in v0.1.32
func NewConfigFromRawParsedLayers(parsedValues *values.Values) (*DatabaseConfig, error)
func (*DatabaseConfig) GetConnectionString ¶ added in v0.1.40
func (c *DatabaseConfig) GetConnectionString() (string, error)
GetConnectionString returns the connection string for this database config
func (*DatabaseConfig) GetSource ¶
func (c *DatabaseConfig) GetSource() (*Source, error)
func (*DatabaseConfig) LogVerbose ¶
func (c *DatabaseConfig) LogVerbose()
LogVerbose just outputs information about the database config to the debug logging level.
func (*DatabaseConfig) ToString ¶
func (c *DatabaseConfig) ToString() string
type DbtParameterLayer ¶
type DbtParameterLayer struct {
schema.SectionImpl `yaml:",inline"`
}
func NewDbtParameterLayer ¶
func NewDbtParameterLayer( options ...schema.SectionOption, ) (*DbtParameterLayer, error)
type DbtSettings ¶ added in v0.1.0
type Source ¶
type Source struct {
Name string
Type string `yaml:"type"`
Hostname string `yaml:"server"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"` // #nosec G117 -- This struct intentionally models database credentials.
Schema string `yaml:"schema"`
Database string `yaml:"database"`
SSLDisable bool `yaml:"ssl_disable"`
}
Source is the generic structure we use to represent a database connection string
func ParseDbtProfiles ¶
ParseDbtProfiles parses a dbt profiles.yml file and returns a map of sources
func (*Source) ToConnectionString ¶
type SqlConnectionParameterLayer ¶ added in v0.1.0
type SqlConnectionParameterLayer struct {
schema.SectionImpl `yaml:",inline"`
}
func NewSqlConnectionParameterLayer ¶
func NewSqlConnectionParameterLayer( options ...schema.SectionOption, ) (*SqlConnectionParameterLayer, error)
type SqlConnectionSettings ¶ added in v0.1.0
type SqlConnectionSettings struct {
Host string `glazed:"host"`
Port int `glazed:"port"`
Database string `glazed:"database"`
User string `glazed:"user"`
Password string `glazed:"password"` // #nosec G117 -- Password is a required connection setting.
Schema string `glazed:"schema"`
DbType string `glazed:"db-type"`
Repository string `glazed:"repository"`
Dsn string `glazed:"dsn"`
Driver string `glazed:"driver"`
SSLDisable bool `glazed:"ssl-disable"`
}
Click to show internal directories.
Click to hide internal directories.