napkin-0.5.9
Safe HaskellNone
LanguageHaskell2010

Napkin.Run.Effects.Programs

Synopsis

Documentation

splitIfUnionBy :: forall effs a. Members [SqlWrite, RecreateTable] effs => Int -> Sem effs a -> Sem effs a #

Intercept CreateTableAs calls and try to split queries into CreateTableAs + multiple InsertIntoQuery when query contains unions

incrementalInsertByPK #

Arguments

:: forall effs. Members [SqlWrite, SqlRead, Time, Reader TargetName, Reader HiddenDependencies, RecreateTable] effs 
=> (Day -> Sem effs Query)

Query with cutoff

-> SExp

Primary key column

-> Day

Starting timestamp value in fresh create

-> Integer

Num days to look back in each update

-> Sem effs () 

incrementalByTimeRawSql #

Arguments

:: Members [SqlWrite, SqlRead, Time, Reader TargetName, Reader HiddenDependencies, RecreateTable, SqlParse, SqlRender, LocalFile, FatalError, Reader ExtraDependencies, Input RandomToken, Reader MetaArguments, Reader DynamicMeta] r 
=> FilePath

Local SQL file

-> SqlTemplateVariables

Any additional variables you want to bind

-> SExp

Timestamp column in the destination table

-> Day

Start time when creating table fresh

-> Integer

N days to go bac

-> Sem r () 

copyData :: forall effs. Members '[SqlWrite] effs => Ref Table -> Ref Table -> Sem effs () #

longToWideAuto #

Arguments

:: forall effs. Members [SqlWrite, SqlRead, Input RandomToken, Reader HiddenDependencies, Reader TargetName, RecreateTable] effs 
=> Ref Table

the long table from which this table will be derived- make sure it is also listed in the dependencies

-> (SExp -> SExp)

Aggregate function to use

-> [Alias SExp]

the key columns which will remain in the resultant wide version as-is

-> SExp

the column name in the long table which will be split into multiple columns in the wide version

-> SExp

the column in the long table which will be emitted from matching on the new columns

-> (Value -> Ref SExp)

a function to generate column names from the values found in the database

-> SpecTarget

standard table options

-> Sem effs () 

combineTables #

Arguments

:: forall effs. Members '[SqlWrite, SqlRead, Reader ExtraDependencies, Reader TargetName, RecreateTable] effs 
=> SpecTarget 
-> (Query -> Query)

Any final optional query modification

-> [Relation]

List of sources to combine

-> Sem effs ()