hello everyone - I've been watching some youtube t...
# ask-community
p
hello everyone - I've been watching some youtube tutorials on setting up dagster for the first time and they use solids. I read through the documentation and it seems like solids are now ops. Is this correct?
I think I found my answer by searching Slack, but if anyone has any other insight on this subject, please let me know! https://dagster.slack.com/archives/C01U954MEER/p1677612014659859?thread_ts=1677610614.269959&cid=C01U954MEER
dagster spin 1
t
Hi! Yes that is correct. However, we do recommend using Assets, which sit on top of ops and provide more functionality like lineage, metadata, etc. If you'd like, you can follow our official tutorial to understand the recommended path of learning Dagster concepts: https://docs.dagster.io/tutorial
👍 1
❤️ 1
f
Also you will find more up-to-date starter tutorials in the Dagster docs and on the Dagster blog ( http://dagster.io/blog )
❤️ 1
p
thank you both for your replies! Would an asset be the correct place to create a read_csv and the corresponding to_sql functions for reading a csv file into sql? Or would is it best practice to separate out that functionality?
t
Yes! It'd be the best place.
In terms of how many assets, that'll be dependent on how much robustness you'd want to build into your project. Let's say you want to do two things: 1. Load a CSV into a database 2. Clean that table up afterward with SQL It could make sense to put both actions in one asset function. But if you'd like to separate it so that the loading doesn't fail if the cleaning fails, then you can separate them out into two assets: 1.
raw_table_from_csv
2.
cleaned_table
p
that makes sense! In your example, where would ops come into play?
t
In this case, they don't 😁 Ops are a more granular concept for when you need more control over how an asset is built, or if your action doesn't produce any data assets (files, tables, etc.) I could type something out, but I would be doing you a disservice because there's a doc about the when to use Ops vs Assets and I'd probably butcher a summary.
p
awesome - thank you Tim!
I have another question if you don't mind! is it possible to create an asset that takes parameters? like an asset that expects a server name, database name, and table name or query to execute as strings?
t
The short answer is "yes it depends". If you're trying to do it at runtime, then Run Configuration will likely be your best bet. If you're trying to generate the assets at "buildtime", then you'd use a factory pattern to return back an asset wrapped and configured as you'd need it. However, I'd like to also highlight that things like your connections to external services (server name, creds, db name) can be managed and reused as Resources.