Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
dump Specs as dot or SQL files
Synopsis
- type OutputDirectory = FilePath
- type Force = Bool
- runDump :: forall b. (ValidateAndPreprocess b, SpecToSQLDir b) => RuntimeEnv -> b -> RawInterpretedSpec b -> OutputDirectory -> SqlFileType -> IncludeUnmanagedTables -> Force -> IO (Either (NonEmpty ValidationError) ())
- data SqlFileType
- type SpecToSQLDir b = (RenderSql (CreateTableAs (BackendTableMeta b)) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, Default (BackendTableMeta b), ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b)
- specToSQLDir :: SpecToSQLDir b => RuntimeEnv -> b -> ValidatedInterpretedSpec b -> IncludeUnmanagedTables -> SqlFileType -> FilePath -> IO ()
- specGraphAsDot :: SpecDepGraph -> DotGraph Int
- tableau10Colors :: [Color]
- tableau20Colors :: [Color]
- specGraphAsDotText :: SpecDepGraph -> Text
- specGraphAsSQLDirectory :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, BackendTableMeta b ~ d, Default d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> FilePath -> IO ()
- specGraphAsSQL :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> IO [(Ref Table, ([String], Maybe [String]))]
- data GenerateInserts
- renderTableSpec :: forall b d. (RenderSql Query b, RenderSql CreateViewAs b, RenderSql (CreateTableAs d) b, ParseSQL b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> TableSpec b -> GenerateInserts -> IO ([String], Maybe [String])
Documentation
type OutputDirectory = FilePath #
runDump :: forall b. (ValidateAndPreprocess b, SpecToSQLDir b) => RuntimeEnv -> b -> RawInterpretedSpec b -> OutputDirectory -> SqlFileType -> IncludeUnmanagedTables -> Force -> IO (Either (NonEmpty ValidationError) ()) #
data SqlFileType #
Instances
Eq SqlFileType # | |
Defined in Napkin.Spec.Dump (==) :: SqlFileType -> SqlFileType -> Bool # (/=) :: SqlFileType -> SqlFileType -> Bool # | |
Read SqlFileType # | |
Defined in Napkin.Spec.Dump readsPrec :: Int -> ReadS SqlFileType # readList :: ReadS [SqlFileType] # readPrec :: ReadPrec SqlFileType # readListPrec :: ReadPrec [SqlFileType] # | |
Show SqlFileType # | |
Defined in Napkin.Spec.Dump showsPrec :: Int -> SqlFileType -> ShowS # show :: SqlFileType -> String # showList :: [SqlFileType] -> ShowS # |
type SpecToSQLDir b = (RenderSql (CreateTableAs (BackendTableMeta b)) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, Default (BackendTableMeta b), ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) #
specToSQLDir :: SpecToSQLDir b => RuntimeEnv -> b -> ValidatedInterpretedSpec b -> IncludeUnmanagedTables -> SqlFileType -> FilePath -> IO () #
Main entrypoint into SQL directory generation.
specGraphAsDot :: SpecDepGraph -> DotGraph Int #
tableau10Colors :: [Color] #
tableau20Colors :: [Color] #
specGraphAsDotText :: SpecDepGraph -> Text #
specGraphAsSQLDirectory :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, BackendTableMeta b ~ d, Default d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> FilePath -> IO () #
specGraphAsSQL :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, ParseSQL b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> IO [(Ref Table, ([String], Maybe [String]))] #
Returns a list of SQL sources which can be used to construct the database in order of dependency.
data GenerateInserts #
Instances
Default GenerateInserts # | |
Defined in Napkin.Spec.Dump def :: GenerateInserts # |
renderTableSpec :: forall b d. (RenderSql Query b, RenderSql CreateViewAs b, RenderSql (CreateTableAs d) b, ParseSQL b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b) => RuntimeEnv -> ExternMacros -> b -> TableSpec b -> GenerateInserts -> IO ([String], Maybe [String]) #
Render a TableSpec using a BigQuery backend. Requires IO to
perform Raw SQL file reading. GenerateInserts
can indicate
whether the generated SQL files should include INSERT
statements. This is used for breaking up BigQuery statements which
would otherwise be too long to execute.