Could someone explain why we have both blocks and ...
# ask-community
j
Could someone explain why we have both blocks and variables? I get that I can't use a variable when I need a block for encryption, but why not just use custom-blocks for your variables so that all your config is in one spot in the UI?
n
hi @Janet Carson! there's no absolute reason you cannot use a custom block in situations where you have some simple JSON-ish value, its just that blocks come with a lot of machinery (server-stored schema, server-stored type etc) that amounts to quite a bit of overhead if you just want, say, a JSON object you want to load in your flows if you use a custom block type for the same thing, you need to then make sure that custom block type is available everywhere you want to load an instance of that custom block type
id summarize it like this • use blocks when ◦ you want to perform validation on get/set of the value with python code (since blocks are BaseModel subclasses and pydantic does validation nicely) ◦ you have a secret value you want to be encrypted etc • use variables when ◦ you just have a JSON value you want to load in your flows / read a lot
j
Thanks Nate. It's more like, the system config scatter is annoying, the fewer object pages I have to visit the better. From a programming point of view, my only simple custom block was pretty easy to do. If I could just "find everything with project name <tag>" and have the search bring up all my variables and blocks (which can't be tagged - why???) and flows and deployments in one spot instead of having to click around to understand all the connected "things", life would be easier. And naming conventions! Why do blocks always have dashes and variables only accept underscores? Makes remembering spellings harder... I also suspect that I'm not using any of this stuff quite right -- My flows have parameters with block and variable names and look up the contents when they kick off. But, that means it's hard to draw a dependency graph between what flows depend on what. Is that level of indirection how folks normally do it? Or is there a way to directly have a project bucket where all your objects live together?
n
the fewer object pages I have to visit the better.
100% agree! i am sometimes frustrated by the UI in that sense today
If I could just "find everything with project name <tag>" and have the search bring up all my variables and blocks (which can't be tagged - why???) and flows and deployments in one spot instead of having to click around to understand all the connected "things", life would be easier.
sounds like a great github discussion topic, i don't immediately see why we wouldn't/couldn't allow tagging these entities
And naming conventions! Why do blocks always have dashes and variables only accept underscores?
definitely, i think we have relaxed this a bit but definitely has been a rough edge in the past and worth auditing if we can further relax things i'll send off a claude to find prior discussion on this before suggesting that we open any new issues/discussions but i'd love to get some of this in github so we can take some concrete steps thanks for taking the time to write this out!
j
n
sweet, thank you!!