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, RenderSql InsertIntoQuery b) => RuntimeEnv -> b -> RawInterpretedSpec b -> OutputDirectory -> SqlFileType -> IncludeUnmanagedTables -> Force -> DumpNameMode -> IO (Either (NonEmpty ValidationError) ())
- data SqlFileType
- data DumpNameMode
- type SpecToSQLDir b = (RenderSql (CreateTableAs (BackendTableMeta b)) b, RenderSql Query b, RenderSql CreateViewAs b, Default (BackendTableMeta b), ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b)
- specToSQLDir :: (SpecToSQLDir b, RenderSql InsertIntoQuery b) => RuntimeEnv -> b -> ValidatedInterpretedSpec b -> IncludeUnmanagedTables -> SqlFileType -> FilePath -> DumpNameMode -> IO ()
- specGraphAsDot :: SpecDepGraph -> DotGraph Int
- tableau10Colors :: [Color]
- tableau20Colors :: [Color]
- specGraphAsDotText :: SpecDepGraph -> Text
- specGraphAsSQLDirectory :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, BackendTableMeta b ~ d, Default d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> FilePath -> DumpNameMode -> IO ()
- specGraphAsSQL :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> 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, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> b -> TableSpec b -> GenerateInserts -> IO ([String], Maybe [String])
Documentation
type OutputDirectory = FilePath #
runDump :: forall b. (ValidateAndPreprocess b, SpecToSQLDir b, RenderSql InsertIntoQuery b) => RuntimeEnv -> b -> RawInterpretedSpec b -> OutputDirectory -> SqlFileType -> IncludeUnmanagedTables -> Force -> DumpNameMode -> IO (Either (NonEmpty ValidationError) ()) #
data SqlFileType #
Instances
Eq SqlFileType # | |
Defined in Napkin.Spec.Dump (==) :: SqlFileType -> SqlFileType -> Bool # (/=) :: SqlFileType -> SqlFileType -> Bool # | |
Show SqlFileType # | |
Defined in Napkin.Spec.Dump showsPrec :: Int -> SqlFileType -> ShowS # show :: SqlFileType -> String # showList :: [SqlFileType] -> ShowS # |
data DumpNameMode #
Instances
Eq DumpNameMode # | |
Defined in Napkin.Spec.Dump (==) :: DumpNameMode -> DumpNameMode -> Bool # (/=) :: DumpNameMode -> DumpNameMode -> Bool # | |
Show DumpNameMode # | |
Defined in Napkin.Spec.Dump showsPrec :: Int -> DumpNameMode -> ShowS # show :: DumpNameMode -> String # showList :: [DumpNameMode] -> ShowS # |
type SpecToSQLDir b = (RenderSql (CreateTableAs (BackendTableMeta b)) b, RenderSql Query b, RenderSql CreateViewAs b, Default (BackendTableMeta b), ReifiesBackend b, MustacheBackend b, IsBackendTableMeta b, RunBackendEffect b) #
specToSQLDir :: (SpecToSQLDir b, RenderSql InsertIntoQuery b) => RuntimeEnv -> b -> ValidatedInterpretedSpec b -> IncludeUnmanagedTables -> SqlFileType -> FilePath -> DumpNameMode -> 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, BackendTableMeta b ~ d, Default d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> b -> SpecDepGraph -> SpecTableMap b -> GenerateInserts -> FilePath -> DumpNameMode -> IO () #
specGraphAsSQL :: (RenderSql (CreateTableAs d) b, RenderSql Query b, RenderSql CreateViewAs b, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> 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, BackendTableMeta b ~ d, MustacheBackend b, ReifiesBackend b, IsBackendTableMeta b, RunBackendEffect b, RenderSql InsertIntoQuery b) => RuntimeEnv -> InterpretedSpecEnvironment -> 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.