Documentation
¶
Index ¶
- Variables
- func BacktickQuoteIdentifier(identifier string) string
- func BigQueryDateSpine(datepart, startDate, endDate string) string
- func BigQueryQuoteIdentifier(identifier string) string
- func BigQueryURLHelpers() map[string]any
- func BigQueryWidthBucket(expr, minValue, maxValue, numBuckets string) string
- func BracketQuoteIdentifier(identifier string) string
- func BuiltinFunctions(platform ...Platform) map[string]any
- func ClickHouseDateSpine(datepart, startDate, endDate string) string
- func ClickHouseURLHelpers() map[string]any
- func ClickHouseWidthBucket(expr, minValue, maxValue, numBuckets string) string
- func ConcatFunction(parts []string) string
- func ConcatOperator(parts []string) string
- func DateSpineWithDateAdd(dateAddFn func(datepart, n, start string) string) func(string, string, string) string
- func DateSpineWithDateAddAndDateDiff(withRecursive bool, suffix string, ...) func(string, string, string) string
- func DateSpineWithRecursiveDateAdd(withRecursive bool, suffix string, ...) func(string, string, string) string
- func DoubleQuoteIdentifier(identifier string) string
- func DuckDBDateSpine(datepart, startDate, endDate string) string
- func DuckDBGenerateSeries(upperBound int) string
- func HaversineDistanceWithRadians(radiansFn func(expr string) string) func(*exec.VarArgs) (*exec.Value, error)
- func IntervalStepLiteral(datepart string) string
- func IsTimestampDatepart(datepart string) bool
- func LoadMacros(fs afero.Fs, macrosPath string) (string, error)
- func MergeBuiltinOverrides(overrides ...map[string]any) map[string]any
- func MySQLDateSpine(datepart, startDate, endDate string) string
- func MySQLURLHelpers() map[string]any
- func NativeWidthBucket(expr, minValue, maxValue, numBuckets string) string
- func OracleDateSpine(datepart, startDate, endDate string) string
- func OracleURLHelpers() map[string]any
- func PivotWithIdentifierQuote(quoteIdentifier func(string) string) func(*exec.VarArgs) *exec.Value
- func PostgresDateSpine(datepart, startDate, endDate string) string
- func PrestoDateSpine(datepart, startDate, endDate string) string
- func PrestoURLHelpers() map[string]any
- func PythonEnvVariables(startDate, endDate, executionDate *time.Time, pipelineName, runID string, ...) map[string]string
- func RegisterPlatformOverrides(platform Platform, overrides map[string]any)
- func SparkDateSpine(datepart, startDate, endDate string) string
- func SparkURLHelpers() map[string]any
- func SplitPartURLHelpers(castType string) map[string]any
- func SurrogateKeyNullValue() string
- func SurrogateKeyWith(castType string, hashFn func(concatExpr string) string) func(*exec.VarArgs) *exec.Value
- func SurrogateKeyWithCoalesceExpr(valueFn func(field string) string, concatFn func(parts []string) string, ...) func(*exec.VarArgs) *exec.Value
- func SurrogateKeyWithConcat(castType string, concatFn func(parts []string) string, ...) func(*exec.VarArgs) *exec.Value
- func TSQLDateSpine(datepart, startDate, endDate string) string
- func TSQLDateSpineWithTally(datepart, startDate, endDate string) string
- func TSQLURLHelpers() map[string]any
- func TSQLWidthBucket(expr, minValue, maxValue, numBuckets string) string
- func VariantRendererFactory(vars map[string]any, variantName string) pipeline.RenderFunc
- type Context
- type FileSystemLoader
- type Platform
- type Renderer
- func NewRenderer(context Context) *Renderer
- func NewRendererWithMacros(context Context, macroContent string) *Renderer
- func NewRendererWithStartEndDates(startDate, endDate, executionDate *time.Time, pipelineName, runID string, ...) *Renderer
- func NewRendererWithStartEndDatesAndMacros(startDate, endDate, executionDate *time.Time, pipelineName, runID string, ...) *Renderer
- func NewRendererWithYesterday(pipelineName, runID string) *Renderer
- type RendererInterface
Constants ¶
This section is empty.
Variables ¶
var Filters *exec.FilterSet
Functions ¶
func BacktickQuoteIdentifier ¶ added in v0.11.598
BacktickQuoteIdentifier quotes an identifier with backticks.
func BigQueryDateSpine ¶ added in v0.11.598
BigQueryDateSpine builds date_spine using BigQuery's array generators.
func BigQueryQuoteIdentifier ¶ added in v0.11.598
BigQueryQuoteIdentifier quotes a GoogleSQL identifier with backticks and backslash-escaped backticks.
func BigQueryURLHelpers ¶ added in v0.11.598
BigQueryURLHelpers returns URL helpers using BigQuery regex functions.
func BigQueryWidthBucket ¶ added in v0.11.598
BigQueryWidthBucket builds standard width_bucket behavior for BigQuery, which has no native function.
func BracketQuoteIdentifier ¶ added in v0.11.598
BracketQuoteIdentifier quotes an identifier with SQL Server square brackets.
func BuiltinFunctions ¶ added in v0.11.598
BuiltinFunctions returns a map of built-in SQL helper functions for use in Jinja templates. When a platform is specified, any registered overrides for that platform are merged on top of defaults.
func ClickHouseDateSpine ¶ added in v0.11.598
ClickHouseDateSpine builds date_spine using numbers and dateDiff/dateAdd.
func ClickHouseURLHelpers ¶ added in v0.11.598
ClickHouseURLHelpers returns URL helpers using ClickHouse regex functions.
func ClickHouseWidthBucket ¶ added in v0.11.598
ClickHouseWidthBucket builds standard width_bucket behavior for ClickHouse.
func ConcatFunction ¶ added in v0.11.598
ConcatFunction joins expressions with a variadic concat function, returning the expression unchanged for one part.
func ConcatOperator ¶ added in v0.11.598
ConcatOperator joins expressions with the ANSI string concatenation operator.
func DateSpineWithDateAdd ¶ added in v0.11.598
func DateSpineWithDateAdd(dateAddFn func(datepart, n, start string) string) func(string, string, string) string
DateSpineWithDateAdd builds a date_spine function using the given date-addition expression builder.
func DateSpineWithDateAddAndDateDiff ¶ added in v0.11.598
func DateSpineWithDateAddAndDateDiff(withRecursive bool, suffix string, dateAddFn, dateDiffFn func(datepart, start, end string) string) func(string, string, string) string
DateSpineWithDateAddAndDateDiff builds a recursive date_spine function using an interval count.
func DateSpineWithRecursiveDateAdd ¶ added in v0.11.598
func DateSpineWithRecursiveDateAdd(withRecursive bool, suffix string, dateAddFn func(datepart, n, start string) string) func(string, string, string) string
DateSpineWithRecursiveDateAdd builds a recursive CTE date_spine function.
func DoubleQuoteIdentifier ¶ added in v0.11.598
DoubleQuoteIdentifier quotes an identifier with ANSI double quotes.
func DuckDBDateSpine ¶ added in v0.11.598
DuckDBDateSpine builds date_spine using DuckDB's generate_series table function.
func DuckDBGenerateSeries ¶ added in v0.11.598
DuckDBGenerateSeries uses DuckDB's native integer series generator.
func HaversineDistanceWithRadians ¶ added in v0.11.598
func HaversineDistanceWithRadians(radiansFn func(expr string) string) func(*exec.VarArgs) (*exec.Value, error)
HaversineDistanceWithRadians builds a haversine_distance function using the given radians conversion.
func IntervalStepLiteral ¶ added in v0.11.598
IntervalStepLiteral returns a SQL interval literal body for dateparts that are not universally accepted as interval units.
func IsTimestampDatepart ¶ added in v0.11.598
IsTimestampDatepart reports whether a date_spine datepart needs timestamp rather than date values.
func LoadMacros ¶ added in v0.11.320
LoadMacros loads all macro files from the given directory and returns them as a single string.
func MergeBuiltinOverrides ¶ added in v0.11.598
MergeBuiltinOverrides combines override maps left-to-right.
func MySQLDateSpine ¶ added in v0.11.598
MySQLDateSpine builds a recursive date_spine with MySQL casts and a per-query recursion-depth hint.
func MySQLURLHelpers ¶ added in v0.11.598
MySQLURLHelpers returns URL helpers using MySQL string functions.
func NativeWidthBucket ¶ added in v0.11.598
NativeWidthBucket returns a platform-native width_bucket implementation.
func OracleDateSpine ¶ added in v0.11.598
OracleDateSpine builds date_spine using CONNECT BY LEVEL.
func OracleURLHelpers ¶ added in v0.11.598
OracleURLHelpers returns URL helpers using Oracle regex functions.
func PivotWithIdentifierQuote ¶ added in v0.11.598
PivotWithIdentifierQuote builds a pivot function using platform-specific quoted identifier syntax.
func PostgresDateSpine ¶ added in v0.11.598
PostgresDateSpine builds date_spine using Postgres generate_series.
func PrestoDateSpine ¶ added in v0.11.598
PrestoDateSpine builds date_spine for Trino/Athena using sequence + unnest.
func PrestoURLHelpers ¶ added in v0.11.598
PrestoURLHelpers returns URL helpers for Trino/Athena.
func PythonEnvVariables ¶ added in v0.5.7
func RegisterPlatformOverrides ¶ added in v0.11.598
RegisterPlatformOverrides registers platform-specific function overrides. Platform packages call this in their init() to replace default built-in functions with platform-appropriate SQL generation. The platform package must be imported (directly or transitively) for its init() to execute.
func SparkDateSpine ¶ added in v0.11.598
SparkDateSpine builds date_spine using Spark/Databricks sequence + explode.
func SparkURLHelpers ¶ added in v0.11.598
SparkURLHelpers returns URL helpers using Spark/Databricks regex functions.
func SplitPartURLHelpers ¶ added in v0.11.598
SplitPartURLHelpers returns URL helpers for dialects that support split_part, position, right, and SQL-standard casts.
func SurrogateKeyNullValue ¶ added in v0.11.598
func SurrogateKeyNullValue() string
SurrogateKeyNullValue returns the sentinel used to preserve null positions while hashing.
func SurrogateKeyWith ¶ added in v0.11.598
func SurrogateKeyWith(castType string, hashFn func(concatExpr string) string) func(*exec.VarArgs) *exec.Value
SurrogateKeyWith builds a generate_surrogate_key function using the given cast type and hash wrapper.
func SurrogateKeyWithCoalesceExpr ¶ added in v0.11.598
func SurrogateKeyWithCoalesceExpr(valueFn func(field string) string, concatFn func(parts []string) string, hashFn func(concatExpr string) string) func(*exec.VarArgs) *exec.Value
SurrogateKeyWithCoalesceExpr builds a generate_surrogate_key function using a caller-provided per-field expression.
func SurrogateKeyWithConcat ¶ added in v0.11.598
func SurrogateKeyWithConcat(castType string, concatFn func(parts []string) string, hashFn func(concatExpr string) string) func(*exec.VarArgs) *exec.Value
SurrogateKeyWithConcat builds a generate_surrogate_key function using platform-specific concat and hash syntax.
func TSQLDateSpine ¶ added in v0.11.598
TSQLDateSpine builds date_spine for SQL Server-family dialects.
func TSQLDateSpineWithTally ¶ added in v0.11.598
TSQLDateSpineWithTally builds date_spine without recursive CTEs for Synapse/Fabric.
func TSQLURLHelpers ¶ added in v0.11.598
TSQLURLHelpers returns URL helpers for SQL Server-family dialects.
func TSQLWidthBucket ¶ added in v0.11.598
TSQLWidthBucket builds standard width_bucket behavior using T-SQL math functions.
func VariantRendererFactory ¶ added in v0.11.557
func VariantRendererFactory(vars map[string]any, variantName string) pipeline.RenderFunc
VariantRendererFactory satisfies pipeline.VariantRendererFactory using a fresh Jinja renderer per call. Pass it into pipeline.NewBuilder so WithVariant / CreatePipelinesFromPath can materialize variants without callers having to construct a renderer.
The renderer's context exposes only `var` (the merged variable values) and `variant` (the variant name). Run-time variables like start_date / end_date / this are deliberately absent — variant materialization is only meant to resolve identity and structural fields.
Types ¶
type FileSystemLoader ¶ added in v0.11.320
type FileSystemLoader struct {
// contains filtered or unexported fields
}
FileSystemLoader loads templates from a file system directory.
func NewFileSystemLoader ¶ added in v0.11.320
func NewFileSystemLoader(fs afero.Fs, baseDir string) *FileSystemLoader
NewFileSystemLoader creates a new FileSystemLoader for the given base directory.
func (*FileSystemLoader) Inherit ¶ added in v0.11.320
func (l *FileSystemLoader) Inherit(from string) (interface{}, error)
Inherit creates a new loader relative to the given path.
type Platform ¶ added in v0.11.598
type Platform string
Platform represents a target database platform for SQL generation.
const ( PlatformDefault Platform = "" PlatformBigQuery Platform = "bigquery" PlatformSnowflake Platform = "snowflake" PlatformPostgres Platform = "postgres" PlatformRedshift Platform = "redshift" PlatformMySQL Platform = "mysql" PlatformDuckDB Platform = "duckdb" PlatformDatabricks Platform = "databricks" PlatformMSSQL Platform = "mssql" PlatformClickhouse Platform = "clickhouse" PlatformAthena Platform = "athena" PlatformTrino Platform = "trino" PlatformSynapse Platform = "synapse" PlatformOracle Platform = "oracle" PlatformFabric Platform = "fabric" PlatformVertica Platform = "vertica" )
func PlatformForAssetType ¶ added in v0.11.598
PlatformForAssetType resolves the SQL generation platform for the given asset type.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func NewRenderer ¶
func NewRendererWithMacros ¶ added in v0.11.320
NewRendererWithMacros creates a new Renderer with the given context and macro content.
func NewRendererWithStartEndDatesAndMacros ¶ added in v0.11.320
func NewRendererWithStartEndDatesAndMacros(startDate, endDate, executionDate *time.Time, pipelineName, runID string, vars Context, macroContent string) *Renderer
NewRendererWithStartEndDatesAndMacros creates a new Renderer with the given dates, context, and macro content.
func NewRendererWithYesterday ¶ added in v0.5.3
func (*Renderer) CloneForAsset ¶ added in v0.11.209
func (*Renderer) SetContextValue ¶ added in v0.11.488
SetContextValue sets a top-level variable in the Jinja rendering context. Note: values set this way are NOT preserved across CloneForAsset calls; callers must re-apply them on the cloned renderer.
type RendererInterface ¶ added in v0.11.209
type RendererInterface interface {
Render(query string) (string, error)
CloneForAsset(ctx context.Context, pipeline *pipeline.Pipeline, asset *pipeline.Asset) (RendererInterface, error)
}
this ugly interface is needed to avoid circular dependencies and the ability to create different renderer instances per asset.