https://dagster.io/ logo
#integration-snowflake
Title
# integration-snowflake
j

jamie

03/21/2023, 1:50 PM
❄️ New for the Snowflake I/O manager in 0.18.2 ❄️ This release highlight comes to you a few days late, but here’s a rundown from last week’s release The Snowflake I/O manager supports self-dependent assets! If you have a partitioned asset that depends on a prior partition of itself, the Snowflake I/O manager will load that partition as a DataFrame. For the first partition in the series, an empty DataFrame will be returned
Copy code
@asset(
    partitions_def=DailyPartitionsDefinition(start_date="2023-01-01"),
    ins={
        "self_dependent_asset": AssetIn(
            key=AssetKey(["self_dependent_asset"]),
            partition_mapping=TimeWindowPartitionMapping(start_offset=-1, end_offset=-1),
        ),
    },
    metadata={
        "partition_expr": "date",
    },
)
def self_dependent_asset(context, self_dependent_asset: pd.DataFrame) -> pd.DataFrame:
    date = pd.Timestamp(context.asset_partition_key_for_output())

    if self_dependent_asset.empty:
        return pd.DataFrame({"date": [date], "value": [1]})
    return pd.DataFrame({"date": [date], "value": [self_dependent_asset["value"][0] + 1]})
This release also includes a bugfix. In a previous release, we updated the Snowflake I/O manager to create schemas if they did not exist. However, for accounts with restricted permissions, this would cause the I/O manager to error. The Snowflake I/O manager will still attempt to create a schema if it does not exist, but we’ve updated how we check if a schema exists so that accounts with restricted permissions do not error.
❄️ 1
2 Views