napkin-0.5.14
Safe HaskellSafe-Inferred
LanguageGHC2021

Napkin.Run.Effects.Programs

Synopsis

Documentation

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

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

incrementalInsertByPK #

Arguments

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

Query with cutoff

-> SExp

Primary key column

-> Day

Starting timestamp value in fresh create

-> Integer

Num days to look back in each update

-> BackendTableMeta b 
-> Sem r () 

incrementalByTimeRawSql #

Arguments

:: forall b r. (Members [SqlWrite b, SqlRead b, Time, Reader TargetName, Reader HiddenDependencies, Reader HiddenArtifacts, RecreateTable b, SqlParse, SqlRender, LoadQuery, FatalError, Output ExtraDependencies, Input TemporaryTableName, Input MetaArguments, Log] r, Default (BackendTableMeta b)) 
=> 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

-> BackendTableMeta b 
-> Sem r () 

copyData :: forall b r. Member (SqlWrite b) r => Ref Table -> Ref Table -> Sem r () #

longToWideAuto #

Arguments

:: forall b r. Members [SqlWrite b, SqlRead b, Reader HiddenDependencies, Reader TargetName, RecreateTable b] r 
=> 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 b

standard table options

-> Sem r () 

combineTables #

Arguments

:: forall b r. (Members '[SqlWrite b, SqlRead b, Output ExtraDependencies, Reader TargetName, RecreateTable b, Input TemporaryTableName, Reader QueryTransformer] r, HasBackendSchemaField b) 
=> SpecTarget b 
-> (Query -> Query)

Any final optional query modification

-> [Relation]

List of sources to combine

-> Sem r () 

pattern IncrementalReset :: (Eq a, IsString a) => a #