Safe Haskell | None |
---|---|
Language | GHC2024 |
Synopsis
- spec :: SpecTableName -> TableSpec b
- ctaToSpec :: CreateTableAs b -> TableSpec b
- tableWithQueryAndMeta :: BackendTableMeta b -> SpecTableName -> Query -> TableSpec b
- tableWithQuery :: Default (BackendTableMeta b) => SpecTableName -> Query -> TableSpec b
- programToSpec :: SpecTableName -> SpecProgram b -> TableSpec b
- viewWithQuery :: Default (BackendViewMeta b) => SpecTableName -> Query -> TableSpec b
- specSplitIfUnion :: TableSpec b0 -> TableSpec b0
- specSplitIfUnionBy :: Int -> TableSpec b0 -> TableSpec b0
- specIncrementalByPK :: (Day -> CreateTableAs b) -> SExp -> Day -> Integer -> TableSpec b
- specIncrementalByTime :: Default (BackendTableMeta b) => (Day -> CreateTableAs b) -> (Day -> SExp) -> Day -> Integer -> [Ref Table] -> TableSpec b
- specIncrementalByTimeRawSql :: Default (BackendTableMeta b) => SpecTableName -> BackendTableMeta b -> [Ref Table] -> FilePath -> SqlTemplateVariables -> SExp -> Day -> Integer -> TableSpec b
- rawSqlSpec :: SpecTableName -> SpecTarget b -> FilePath -> [Ref Table] -> TableSpec b
- rawSqlMustacheSpec :: SpecTableName -> SpecTarget b -> FilePath -> SqlTemplateVariables -> [Ref Table] -> TableSpec b
- longToWideAutoSpec :: SpecTableName -> Ref Table -> (SExp -> SExp) -> [Alias SExp] -> SExp -> SExp -> (Value -> Ref SExp) -> SpecTarget b -> [Ref Table] -> TableSpec b
- commandSpec :: SpecTableName -> Text -> [Text] -> [Ref Table] -> TableSpec b
- shellSpec :: SpecTableName -> Text -> [Ref Table] -> TableSpec b
- combineTablesSpec :: HasBackendSchemaField b => SpecTableName -> SpecTarget b -> (Query -> Query) -> [Relation] -> TableSpec b
- addHooks :: [(Text, [SpecTableName], PureGlobalHookProgram b)] -> Spec b ()
- addHooks' :: [(Text, [SpecTableName], SpecGlobalHook b)] -> Spec b ()
- addIOHooks :: [(Text, [SpecTableName], IOGlobalHookProgram b)] -> Spec b ()
- addTags :: [TableSpecTag] -> Spec b a -> Spec b a
- withParsedMetaArg :: (FromJSON a, Typeable a) => (a -> Spec b c) -> Spec b c
- module Napkin.Spec.Types
- module Napkin.Spec.Types.CreateTableAs
- newtype SqlTemplateVariables = SqlTemplateVariables {}
- sqlTemplate :: [(Text, Value)] -> SqlTemplateVariables
- sqlVar :: ToJSON a => Text -> a -> (Text, Value)
Documentation
spec :: SpecTableName -> TableSpec b #
shorthand for starting specs, use lenses to then update parts
ctaToSpec :: CreateTableAs b -> TableSpec b #
tableWithQueryAndMeta :: BackendTableMeta b -> SpecTableName -> Query -> TableSpec b #
tableWithQuery :: Default (BackendTableMeta b) => SpecTableName -> Query -> TableSpec b #
programToSpec :: SpecTableName -> SpecProgram b -> TableSpec b #
viewWithQuery :: Default (BackendViewMeta b) => SpecTableName -> Query -> TableSpec b #
specSplitIfUnion :: TableSpec b0 -> TableSpec b0 #
Split UNION queries and insert each individually.
specSplitIfUnionBy :: Int -> TableSpec b0 -> TableSpec b0 #
Split a top level UNION based query table definition into individual insert-based queries in chunks of n.
:: Default (BackendTableMeta b) | |
=> (Day -> CreateTableAs b) | How to create/form the target table with data newer than the given cutoff date |
-> (Day -> SExp) | Filter in (DELETE WHERE) to be used when deleting data newer than the given cutoff date in the target table. |
-> Day | Overall start date to use when starting fresh |
-> Integer | Number of days to go back and refresh each time update is run |
-> [Ref Table] | Custom additional dependencies to be included (legacy) |
-> TableSpec b |
:: Default (BackendTableMeta b) | |
=> SpecTableName | Name of the backend, required for sql rendering |
-> BackendTableMeta b | Any backend specific table options |
-> [Ref Table] | Table's dependencies |
-> 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 |
-> TableSpec b |
rawSqlSpec :: SpecTableName -> SpecTarget b -> FilePath -> [Ref Table] -> TableSpec b #
Read a file that contains raw SQL query code that can be used to instantiate a table.
rawSqlMustacheSpec :: SpecTableName -> SpecTarget b -> FilePath -> SqlTemplateVariables -> [Ref Table] -> TableSpec b #
Same as rawSqlSpec
but allows for mustache templating inside of
the raw SQL file.
:: SpecTableName | the new table to create |
-> 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 |
-> [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 |
-> [Ref Table] | create a view or table | this table's dependencies (include the long table) |
-> TableSpec b |
Query the "long" version of the table to determine what columns to put in the "wide" version. This function does not support mustache templates.
:: SpecTableName | the name of the new table |
-> Text | command |
-> [Text] | arguments |
-> [Ref Table] | the list of dependencies - these cannot be deduced |
-> TableSpec b |
A custom Spec which runs a command to create a table
:: SpecTableName | the name of the new table |
-> Text | command |
-> [Ref Table] | the list of dependencies - these cannot be deduced |
-> TableSpec b |
A custom Spec which runs a shell script to create a table
:: HasBackendSchemaField b | |
=> SpecTableName | |
-> SpecTarget b | |
-> (Query -> Query) | Any final optional query modification |
-> [Relation] | List of sources to combine |
-> TableSpec b |
Specialized convenience for UNION-ing several tables and queries,
even for cases where the list of fields available in each table is
not known at compile time. This will introspect list of fields for
cases where a bare table name is given instead of a QueryRelation
.
addHooks :: [(Text, [SpecTableName], PureGlobalHookProgram b)] -> Spec b () #
addHooks' :: [(Text, [SpecTableName], SpecGlobalHook b)] -> Spec b () #
addIOHooks :: [(Text, [SpecTableName], IOGlobalHookProgram b)] -> Spec b () #
Adds global hook, description, dependencies and hook's specification
addTags :: [TableSpecTag] -> Spec b a -> Spec b a #
module Napkin.Spec.Types
newtype SqlTemplateVariables #
Instances
sqlTemplate :: [(Text, Value)] -> SqlTemplateVariables #