I'd like to branch on whether an asset is partitio...
# ask-community
d
I'd like to branch on whether an asset is partitioned by time or not in my
IOManager
. Here's my current implementation:
Copy code
if context.has_partition_key:
            had_it = False
            try:
                had_it = context.asset_partitions_time_window
            except:
                pass
            if had_it:
                raise NotImplementedError(
                    "Time partitioning not implemented in IO Manager"
                )
Is there any way to check if the asset is time window partitioned without a try except block?
j
In our IO managers, we do
isinstance
checks
Copy code
if context.has_asset_partitions:
    if isinstance(context.asset_partitions_def, MultiPartitionsDefinition):
         # handle multi partition case 
     elif isinstance(context.asset_partitions_def, TimeWindowPartitionsDefinition):
         # handle time partitions case
     else:
         # handle static partition case
❤️ 1