King Chung Huang
06/28/2020, 6:51 PMpath
is required, or glue_database
and glue_table
are required, but not both. columns
is optional in either case. I've been looking at Selector
for (path
or (glue_database
and glue_table
)), but I can't think of a way to set this up. Is such a thing possible?
@input_hydration_config(
Selector(
{
"parquet": Permissive({
"path": Field(ReadPathType, is_required=True, description="Path to read from."),
"glue_database": Field(String, is_required=True, description="Glue database to read from."),
"glue_table": Field(String, is_required=True, description="Glue table to read from."),
"columns": Field([String], is_required=False, description="Fields names to read in as columns."),
}),
}
)
)
alex
06/29/2020, 3:09 PM@input_hydration_config(
Selector(
{
"parquet_file": {
"path": Field(ReadPathType, is_required=True, description="Path to read from."),
"columns": Field([String], is_required=False, description="Fields names to read in as columns."),
},
"parquet_glue": {
"database": Field(String, is_required=True, description="Glue database to read from."),
"table": Field(String, is_required=True, description="Glue table to read from."),
"columns": Field([String], is_required=False, description="Fields names to read in as columns."),
}),
}
)
)
King Chung Huang
06/29/2020, 4:30 PMparquet_file
and parquet_glue
, but it's probably the way to go.alex
06/29/2020, 4:37 PMparquet:
file:
path:
parquet:
glue:
database:
King Chung Huang
06/29/2020, 6:02 PMfile
or glue
have to be specified, along with a whole bunch of optional fields like columns
under parquet
. How would I form the parquet
field in the config?
@input_hydration_config(
Selector(
{
"parquet": Permissive({
"???": Selector({
"file": …,
"glue": …,
}),
"columns": Field([String], is_required=False, description="Fields names to read in as columns."),
}),
}
)
)
parquet:
file:
path: /some/path
columns: ["a", "b"]
parquet:
glue:
database: database_a
table: table_b
columns: ["a", "b"]
alex
06/29/2020, 6:25 PMSelector
so you would have to move columns
in or add another layer:
@input_hydration_config(
Selector(
{
"parquet": Permissive({
"load_from": Selector({
"file": {...},
"glue": {...},
}),
"columns": Field([String], is_required=False, description="Fields names to read in as columns."),
}),
}
)
)
and have
parquet:
load_from:
glue:
database: ...
columns: [...]
King Chung Huang
06/29/2020, 6:46 PMload_from
. Thanks!