Hello and happy Friday! Question, is there current...
# ask-community
p
Hello and happy Friday! Question, is there currently a way to define assets dynamically? i.e can I write a function that parses through config files and defines assets? Thanks!
g
I believe the answer is "yes": have your code build a list of
AssetsDefinition
objects, and give that to the
Definitions
object
j
Hey @Peter Lim yeah that should totally work. this isn’t an example for assets, but here’s a code snippet showing how to do something similar with ops https://docs.dagster.io/concepts/ops-jobs-graphs/ops#op-factory
p
Thank you for your replies! I’ve been reading about the op factory above. How do you implement that? Do I need an op or a job to call the op factory function to dynamically create the ops?
j
you would just call the function X number of times in your python file and store the returned ops/assets in a list. then you could add that list to your Definitions object to see them in dagit
p
Got it, thank you! The ops factory worked but I’ll try the asset one next.
^worked with assets as well. Thanks! dagster yay