| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Napkin.Spec.Yaml.Types.Tables
Synopsis
- data CSVTableStrategy
- type SpecProgramForYaml b = SpecProgramReferenceForYaml (SpecProgram b)
- newtype YamlRange a = YamlRange {}
- type BackendMetaConstraints b = (MaybeDefault (YamlBackendTableMeta b), MaybeDefault (YamlBackendViewMeta b), MaybeDefault (YamlBackendMaterializedViewMeta b), FromJSON (YamlBackendTableMeta b), FromJSON (YamlBackendViewMeta b), FromJSON (YamlBackendMaterializedViewMeta b), CSVImport b)
- parseTargetType :: forall b. BackendMetaConstraints b => Value -> Parser (SpecTarget b)
- external :: forall b. SpecProgramForYaml b
- sql_query :: forall b. BackendMetaConstraints b => SpecProgramForYaml b
- sql_file :: forall b. BackendMetaConstraints b => SpecProgramForYaml b
- csv_file :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b
- csv_file_bq :: forall b. (Typeable b, BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b
- copy :: forall b. BackendMetaConstraints b => SpecProgramForYaml b
- incremental_by_pk :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b), SqlConcat b) => SpecProgramForYaml b
- incremental_by_time :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b
- long_to_wide :: forall b. BackendMetaConstraints b => SpecProgramForYaml b
- sql_file_insert :: forall b. BackendMetaConstraints b => SpecProgramForYaml b
Documentation
data CSVTableStrategy #
csv importing options
Instances
type SpecProgramForYaml b = SpecProgramReferenceForYaml (SpecProgram b) #
type BackendMetaConstraints b = (MaybeDefault (YamlBackendTableMeta b), MaybeDefault (YamlBackendViewMeta b), MaybeDefault (YamlBackendMaterializedViewMeta b), FromJSON (YamlBackendTableMeta b), FromJSON (YamlBackendViewMeta b), FromJSON (YamlBackendMaterializedViewMeta b), CSVImport b) #
parseTargetType :: forall b. BackendMetaConstraints b => Value -> Parser (SpecTarget b) #
external :: forall b. SpecProgramForYaml b #
Define table with external shell script or command with arguments
external:
shell: ./import_table.sh --from "{{{db_url}}}" --table "{{{table.db}}}"or > external: > command: ./import_table.sh > arguments: > - --from "{{{db_url}}}" > - --table "{{{table.db}}}"
sql_query :: forall b. BackendMetaConstraints b => SpecProgramForYaml b #
Define table with SQL query specified directly in YAML
sql_query: query: SELECT * FROM foo
sql_file :: forall b. BackendMetaConstraints b => SpecProgramForYaml b #
Define table with SQL query specified directly in YAML.
vars is an optional object used to specify variables used in mustache interpolation.
sql_file:
source: some_file.sql
vars:
agg: sumcsv_file :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b #
Create a table from yaml schema specification and load content from a given CSV file.
source CSV file path
type can be int, double, text, day, datetime
header CSV header is present in source file
columns ordered (as in CSV source file columns) list of column name-type association
create create table by default is true
chunks optional chunks size in which source file is loaded
csv_separator optional character providing the csv separator character (',' by default)
csv_quote_char optional character providing quotes character ('"' by default)
csv_file:
source: input.csv
chunks: 50
header: true
create: false
csv_separator: ','
csv_quote_char: '"'
columns:
- field1: type1
..
- fieldn: typencsv_file_bq :: forall b. (Typeable b, BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b #
copy :: forall b. BackendMetaConstraints b => SpecProgramForYaml b #
Copy a table
copy: table: table_to_be_copied if_exists: append
incremental_by_pk :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b), SqlConcat b) => SpecProgramForYaml b #
incremental_by_time :: forall b. (BackendMetaConstraints b, Default (BackendTableMeta b)) => SpecProgramForYaml b #
long_to_wide :: forall b. BackendMetaConstraints b => SpecProgramForYaml b #
sql_file_insert :: forall b. BackendMetaConstraints b => SpecProgramForYaml b #
Insert into a table (or create if non-existent) with SQL query specified directly in YAML. The data is appended to the table, and the table is never truncated.
vars is an optional object used to specify variables used in mustache interpolation.