Skip to content

Commit

Permalink
Note deprecated config options
Browse files Browse the repository at this point in the history
See #2872 for information
about deprecated loader and materializer config options.
  • Loading branch information
kinghuang committed Aug 31, 2020
1 parent 8bb5c33 commit 83dbf04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def _dataframe_loader_config():
Selector(read_fields),
is_required=False,
),

# https://github.com/dagster-io/dagster/issues/2872
**{
field_name: Field(
field_config,
Expand All @@ -244,11 +246,14 @@ def dataframe_loader(_context, config):
read_type, read_options = None, None
if "read" in config:
read_type, read_options = next(iter(config["read"].items()))

# https://github.com/dagster-io/dagster/issues/2872
else:
for key in DataFrameReadTypes:
if key in config:
read_type, read_options = key, config[key]
warnings.warn("Specifying {key}: is deprecated. Use read:{key}: instead.".format(key=key))

if not read_type:
raise DagsterInvariantViolationError(
"No read_type found. Expected read key in config."
Expand Down Expand Up @@ -288,6 +293,8 @@ def _dataframe_materializer_config():
Selector(to_fields),
is_required=False,
),

# https://github.com/dagster-io/dagster/issues/2872
**{
field_name: Field(
field_config,
Expand All @@ -304,6 +311,8 @@ def dataframe_materializer(_context, config, dask_df):

if "to" in config:
to_specs = config["to"]

# https://github.com/dagster-io/dagster/issues/2872
else:
to_specs = {
to_type: to_options
Expand All @@ -313,7 +322,6 @@ def dataframe_materializer(_context, config, dask_df):
for key in to_specs.keys():
warnings.warn("Specifying {key}: is deprecated. Use to:{key}: instead.".format(key=key))


for to_type, to_options in to_specs.items():
if not to_type in DataFrameToTypes:
check.failed("Unsupported to_type {to_type}".format(to_type=to_type))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_dataframe_inputs(file_type):
def return_df(_, input_df):
return input_df

# https://github.com/dagster-io/dagster/issues/2872
with pytest.warns(
UserWarning,
match=re.escape("Specifying {key}: is deprecated. Use read:{key}: instead.".format(key=file_type)),
Expand Down Expand Up @@ -67,6 +68,7 @@ def test_dataframe_outputs(file_type, read, kwargs):
def return_df(_):
return df

# https://github.com/dagster-io/dagster/issues/2872
with pytest.warns(
UserWarning,
match=re.escape("Specifying {key}: is deprecated. Use to:{key}: instead.".format(key=file_type)),
Expand Down

0 comments on commit 83dbf04

Please sign in to comment.