Hi i had a doubt while working with assets without...
# ask-community
s
Hi i had a doubt while working with assets without I/O. This is the example mentioned in the documentation.. Here the both the assets are not returning anything.. just there are dependency between the assets ... import urllib.request import zipfile @asset def stopwords_zip() -> None: urllib.request.urlretrieve( "https://docs.dagster.io/assets/stopwords.zip", "stopwords.zip", ) @asset(deps=[stopwords_zip]) def stopwords_csv() -> None: with zipfile.ZipFile("stopwords.zip", "r") as zip_ref: zip_ref.extractall(".") I want to understand in the above scenario what the use of using @asset instead of @op... How do they differ from each other when there no I/O involved in assets.. Plus how they differ from normal python function. Please help me understand. @sandy @chris
o
hi @Sup -- using an asset instead of an op allows you to execute either of these assets independently, rather than need to arrange them into a job. additionally, each time these are executed, that execution will be logged in a way that makes it easier to track when these have been materialized / updated over time. in essence, the actual logic is not impacted at all by defining this as an asset, op, or regular function. what changes is how this computation gets tracked / represented in the UI as time goes on. in many cases, it's useful to be able to link a function to the persisted data that it produces, which is independent of how that data gets passed between steps
s
Thanks @owen for this explanation. I understood it well now.