Safe Haskell | None |
---|---|
Language | GHC2024 |
Napkin.Run.Effects.Programs
Synopsis
- splitIfUnionBy :: forall b (r :: EffectRow) a. Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, RecreateTable b :: (Type -> Type) -> Type -> Type] r => Int -> Sem r a -> Sem r a
- incrementalInsertByPK :: forall b (r :: EffectRow). Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Reader TargetName, Reader HiddenDependencies, RecreateTable b :: (Type -> Type) -> Type -> Type] r => (Day -> Sem r Query) -> SExp -> Day -> Integer -> BackendTableMeta b -> Sem r ()
- incrementalByTimeRawSql :: forall b (r :: EffectRow). (Default (BackendTableMeta b), HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Reader TargetName, Reader HiddenDependencies, Reader HiddenArtifacts, RecreateTable b :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlRender :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Input MetaArguments :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) => FilePath -> SqlTemplateVariables -> [ColumnName] -> SExp -> Day -> Integer -> BackendTableMeta b -> Sem r ()
- incrementalByTimeCreateAction :: forall b (r :: EffectRow). (Default (BackendTableMeta b), HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Reader TargetName, Input MetaArguments :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader HiddenArtifacts, RecreateTable b :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) => [ColumnName] -> (Day -> Sem r Query) -> Day -> (Day -> SExp) -> Integer -> BackendTableMeta b -> Sem r ()
- loadSqlFileWithCutoff :: forall (r :: EffectRow). Members '[SqlParse :: (Type -> Type) -> Type -> Type, SqlRender :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => FilePath -> SqlTemplateVariables -> Day -> Sem r Query
- copyData :: forall b (r :: EffectRow). Member (SqlWrite b :: (Type -> Type) -> Type -> Type) r => CopySource -> CopyDestination -> Sem r ()
- copyData' :: forall b (r :: EffectRow). Member (SqlWrite b :: (Type -> Type) -> Type -> Type) r => InsertColumnsList -> CopySource -> CopyDestination -> Sem r ()
- longToWideAuto :: forall b (r :: EffectRow). Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader TargetName, RecreateTable b :: (Type -> Type) -> Type -> Type] r => Ref Table -> (SExp -> SExp) -> [Alias SExp] -> SExp -> SExp -> (Value -> Ref SExp) -> SpecTarget b -> Sem r ()
- combineTables :: forall b (r :: EffectRow). (HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader TargetName, RecreateTable b :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Reader QueryTransformer] r) => SpecTarget b -> (Query -> Query) -> [Relation] -> Sem r ()
- external :: forall {k} (b :: k) (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, External :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Input MetaArguments :: (Type -> Type) -> Type -> Type] r => Set (Ref Table) -> ExternalCommand -> Sem r ()
- createRawSql :: forall b (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader QueryTransformer, RecreateTable b :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type] r => FilePath -> SqlTemplateVariables -> ExtraDependencies -> HiddenDependencies -> SpecTarget b -> Sem r ()
- createWithQuery :: forall b (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader QueryTransformer, RecreateTable b :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type] r => NonEmpty Query -> SpecTarget b -> ExtraDependencies -> HiddenDependencies -> Sem r ()
- recreateTarget :: forall b (r :: EffectRow). Members '[RecreateTable b :: (Type -> Type) -> Type -> Type, Reader TargetName, SqlWrite b :: (Type -> Type) -> Type -> Type] r => SpecTarget b -> NonEmpty Query -> Sem r ()
- pattern IncrementalReset :: (Eq a, IsString a) => a
- enforceSchema :: forall b (r :: EffectRow). (Eq (BackendSchemaField b), HasBackendSchemaField b, Members '[Input TemporaryTableName :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) => SchemaMigrationOptions -> Ref Table -> [BackendSchemaField b] -> Sem r ()
- data SchemaMigrationOptions = SchemaMigrationOptions {}
- forbidSchemaMigrationOptions :: SchemaMigrationOptions
- askSchemaMigrationOptions :: forall (r :: EffectRow). Members '[Input MetaArguments :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => Ref Table -> Sem r SchemaMigrationOptions
- data AddedColumnPolicy
- data DroppedColumnPolicy
- mkDefaultPolicy :: a -> ColumnPolicy a
- data ColumnPolicy a = ColumnPolicy {
- defaultPolicy :: a
- columnOverrides :: Map Text a
- pattern AddColumnsList :: (Eq a, IsString a) => a
- pattern AddColumnsPolicy :: (Eq a, IsString a) => a
- pattern DropColumnsList :: (Eq a, IsString a) => a
- pattern DropColumnsPolicy :: (Eq a, IsString a) => a
Documentation
splitIfUnionBy :: forall b (r :: EffectRow) a. Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, RecreateTable b :: (Type -> Type) -> Type -> Type] r => Int -> Sem r a -> Sem r a #
Intercept CreateTableAs calls and try to split queries into CreateTableAs + multiple InsertInto when query contains unions
Arguments
:: forall b (r :: EffectRow). Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Reader TargetName, Reader HiddenDependencies, RecreateTable b :: (Type -> Type) -> Type -> Type] 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 () |
Arguments
:: forall b (r :: EffectRow). (Default (BackendTableMeta b), HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Reader TargetName, Reader HiddenDependencies, Reader HiddenArtifacts, RecreateTable b :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlRender :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Input MetaArguments :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) | |
=> FilePath | Local SQL file |
-> SqlTemplateVariables | Any additional variables you want to bind |
-> [ColumnName] | Names of columns to keep on schema change |
-> SExp | Timestamp column in the destination table |
-> Day | Start time when creating table fresh |
-> Integer | N days to go back |
-> BackendTableMeta b | |
-> Sem r () |
incrementalByTimeCreateAction #
Arguments
:: forall b (r :: EffectRow). (Default (BackendTableMeta b), HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Time :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Reader TargetName, Input MetaArguments :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader HiddenArtifacts, RecreateTable b :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) | |
=> [ColumnName] | Names of columns to keep on schema change |
-> (Day -> Sem r Query) | Table query |
-> Day | Start time when creating table fresh |
-> (Day -> SExp) | Cutoff SExp |
-> Integer | N days to go back |
-> BackendTableMeta b | |
-> Sem r () |
loadSqlFileWithCutoff :: forall (r :: EffectRow). Members '[SqlParse :: (Type -> Type) -> Type -> Type, SqlRender :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => FilePath -> SqlTemplateVariables -> Day -> Sem r Query #
copyData :: forall b (r :: EffectRow). Member (SqlWrite b :: (Type -> Type) -> Type -> Type) r => CopySource -> CopyDestination -> Sem r () #
copyData' :: forall b (r :: EffectRow). Member (SqlWrite b :: (Type -> Type) -> Type -> Type) r => InsertColumnsList -> CopySource -> CopyDestination -> Sem r () #
Arguments
:: forall b (r :: EffectRow). Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader TargetName, RecreateTable b :: (Type -> Type) -> Type -> Type] 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 () |
Arguments
:: forall b (r :: EffectRow). (HasBackendSchemaField b, Members '[SqlWrite b :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader TargetName, RecreateTable b :: (Type -> Type) -> Type -> Type, Input TemporaryTableName :: (Type -> Type) -> Type -> Type, Reader QueryTransformer] r) | |
=> SpecTarget b | |
-> (Query -> Query) | Any final optional query modification |
-> [Relation] | List of sources to combine |
-> Sem r () |
external :: forall {k} (b :: k) (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, External :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Input MetaArguments :: (Type -> Type) -> Type -> Type] r => Set (Ref Table) -> ExternalCommand -> Sem r () #
createRawSql :: forall b (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader QueryTransformer, RecreateTable b :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type] r => FilePath -> SqlTemplateVariables -> ExtraDependencies -> HiddenDependencies -> SpecTarget b -> Sem r () #
createWithQuery :: forall b (r :: EffectRow). Members '[FatalError :: (Type -> Type) -> Type -> Type, Reader TargetName, Output ExtraDependencies :: (Type -> Type) -> Type -> Type, Reader HiddenDependencies, Reader QueryTransformer, RecreateTable b :: (Type -> Type) -> Type -> Type, LoadQuery :: (Type -> Type) -> Type -> Type, SqlParse :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type] r => NonEmpty Query -> SpecTarget b -> ExtraDependencies -> HiddenDependencies -> Sem r () #
recreateTarget :: forall b (r :: EffectRow). Members '[RecreateTable b :: (Type -> Type) -> Type -> Type, Reader TargetName, SqlWrite b :: (Type -> Type) -> Type -> Type] r => SpecTarget b -> NonEmpty Query -> Sem r () #
pattern IncrementalReset :: (Eq a, IsString a) => a #
enforceSchema :: forall b (r :: EffectRow). (Eq (BackendSchemaField b), HasBackendSchemaField b, Members '[Input TemporaryTableName :: (Type -> Type) -> Type -> Type, SqlRead b :: (Type -> Type) -> Type -> Type, SqlWrite b :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r) => SchemaMigrationOptions -> Ref Table -> [BackendSchemaField b] -> Sem r () #
data SchemaMigrationOptions #
Constructors
SchemaMigrationOptions | |
Instances
askSchemaMigrationOptions :: forall (r :: EffectRow). Members '[Input MetaArguments :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type, Log :: (Type -> Type) -> Type -> Type] r => Ref Table -> Sem r SchemaMigrationOptions #
data AddedColumnPolicy #
Constructors
ForbidAdding | |
AllowAdding |
Instances
Bounded AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs | |||||
Enum AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods succ :: AddedColumnPolicy -> AddedColumnPolicy # pred :: AddedColumnPolicy -> AddedColumnPolicy # toEnum :: Int -> AddedColumnPolicy # fromEnum :: AddedColumnPolicy -> Int # enumFrom :: AddedColumnPolicy -> [AddedColumnPolicy] # enumFromThen :: AddedColumnPolicy -> AddedColumnPolicy -> [AddedColumnPolicy] # enumFromTo :: AddedColumnPolicy -> AddedColumnPolicy -> [AddedColumnPolicy] # enumFromThenTo :: AddedColumnPolicy -> AddedColumnPolicy -> AddedColumnPolicy -> [AddedColumnPolicy] # | |||||
Generic AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Associated Types
Methods from :: AddedColumnPolicy -> Rep AddedColumnPolicy x # to :: Rep AddedColumnPolicy x -> AddedColumnPolicy # | |||||
Show AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods showsPrec :: Int -> AddedColumnPolicy -> ShowS # show :: AddedColumnPolicy -> String # showList :: [AddedColumnPolicy] -> ShowS # | |||||
Eq AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods (==) :: AddedColumnPolicy -> AddedColumnPolicy -> Bool # (/=) :: AddedColumnPolicy -> AddedColumnPolicy -> Bool # | |||||
type Rep AddedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs |
data DroppedColumnPolicy #
Constructors
ForbidDropping | |
KeepDropped | |
AllowDropping |
Instances
Bounded DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs | |||||
Enum DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods succ :: DroppedColumnPolicy -> DroppedColumnPolicy # pred :: DroppedColumnPolicy -> DroppedColumnPolicy # toEnum :: Int -> DroppedColumnPolicy # fromEnum :: DroppedColumnPolicy -> Int # enumFrom :: DroppedColumnPolicy -> [DroppedColumnPolicy] # enumFromThen :: DroppedColumnPolicy -> DroppedColumnPolicy -> [DroppedColumnPolicy] # enumFromTo :: DroppedColumnPolicy -> DroppedColumnPolicy -> [DroppedColumnPolicy] # enumFromThenTo :: DroppedColumnPolicy -> DroppedColumnPolicy -> DroppedColumnPolicy -> [DroppedColumnPolicy] # | |||||
Generic DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Associated Types
Methods from :: DroppedColumnPolicy -> Rep DroppedColumnPolicy x # to :: Rep DroppedColumnPolicy x -> DroppedColumnPolicy # | |||||
Show DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods showsPrec :: Int -> DroppedColumnPolicy -> ShowS # show :: DroppedColumnPolicy -> String # showList :: [DroppedColumnPolicy] -> ShowS # | |||||
Eq DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs Methods (==) :: DroppedColumnPolicy -> DroppedColumnPolicy -> Bool # (/=) :: DroppedColumnPolicy -> DroppedColumnPolicy -> Bool # | |||||
type Rep DroppedColumnPolicy # | |||||
Defined in Napkin.Run.Effects.Programs type Rep DroppedColumnPolicy = D1 ('MetaData "DroppedColumnPolicy" "Napkin.Run.Effects.Programs" "napkin-api-2.0.0-GKif1wVpGtsJEy6X9JqPgn" 'False) (C1 ('MetaCons "ForbidDropping" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "KeepDropped" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AllowDropping" 'PrefixI 'False) (U1 :: Type -> Type))) |
mkDefaultPolicy :: a -> ColumnPolicy a #
data ColumnPolicy a #
Constructors
ColumnPolicy | |
Fields
|
Instances
Generic (ColumnPolicy a) # | |||||
Defined in Napkin.Run.Effects.Programs Associated Types
Methods from :: ColumnPolicy a -> Rep (ColumnPolicy a) x # to :: Rep (ColumnPolicy a) x -> ColumnPolicy a # | |||||
Show a => Show (ColumnPolicy a) # | |||||
Defined in Napkin.Run.Effects.Programs Methods showsPrec :: Int -> ColumnPolicy a -> ShowS # show :: ColumnPolicy a -> String # showList :: [ColumnPolicy a] -> ShowS # | |||||
Eq a => Eq (ColumnPolicy a) # | |||||
Defined in Napkin.Run.Effects.Programs Methods (==) :: ColumnPolicy a -> ColumnPolicy a -> Bool # (/=) :: ColumnPolicy a -> ColumnPolicy a -> Bool # | |||||
type Rep (ColumnPolicy a) # | |||||
Defined in Napkin.Run.Effects.Programs type Rep (ColumnPolicy a) = D1 ('MetaData "ColumnPolicy" "Napkin.Run.Effects.Programs" "napkin-api-2.0.0-GKif1wVpGtsJEy6X9JqPgn" 'False) (C1 ('MetaCons "ColumnPolicy" 'PrefixI 'True) (S1 ('MetaSel ('Just "defaultPolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "columnOverrides") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text a)))) |
pattern AddColumnsList :: (Eq a, IsString a) => a #
pattern AddColumnsPolicy :: (Eq a, IsString a) => a #
pattern DropColumnsList :: (Eq a, IsString a) => a #
pattern DropColumnsPolicy :: (Eq a, IsString a) => a #