We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
According to document, we'll implement an custom I/O manager to handle partitions
class MyPartitionedIOManager(IOManager): def _get_path(self, context) -> str: if context.has_partition_key: return "/".join(context.asset_key.path + [context.asset_partition_key]) else: return "/".join(context.asset_key.path) def handle_output(self, context: OutputContext, obj): write_csv(self._get_path(context), obj) def load_input(self, context: InputContext): return read_csv(self._get_path(context))
If both partitioned asset and un-partitioned asset materialize at the same time, the code above will introduce error:
partitioned asset
un-partitioned asset
context.has_partition_key=True
context.asset_partition_key
Instead of context.has_partition_key to check whether an asset has partitions or not, we should use context.has_asset_partitions
context.has_partition_key
context.has_asset_partitions
class MyPartitionedIOManager(IOManager): def _get_path(self, context) -> str: if context.has_asset_partitions: return "/".join(context.asset_key.path + [context.asset_partition_key]) else: return "/".join(context.asset_key.path) def handle_output(self, context: OutputContext, obj): write_csv(self._get_path(context), obj) def load_input(self, context: InputContext): return read_csv(self._get_path(context))
Dagster versioin: 1.9.3
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What's the issue or suggestion?
Issue
According to document, we'll implement an custom I/O manager to handle partitions
If both
partitioned asset
andun-partitioned asset
materialize at the same time, the code above will introduce error:partitioned asset
can work normally because it has bothcontext.has_partition_key=True
and value forcontext.asset_partition_key
un-partitioned asset
will be crashed because it hascontext.has_partition_key=True
, but has no value forcontext.asset_partition_key
Suggestion
Instead of
context.has_partition_key
to check whether an asset has partitions or not, we should usecontext.has_asset_partitions
Additional information
Dagster versioin: 1.9.3
Message from the maintainers
Impacted by this issue? Give it a 👍! We factor engagement into prioritization.
The text was updated successfully, but these errors were encountered: