https://dagster.io/ logo
d

dwall

02/26/2020, 11:37 PM
is there a way to make a python class decorated with
@usable_as_dagster_type
have
required_resource_keys
?
p

prha

02/26/2020, 11:40 PM
that’s interesting… is there a specific example of when you would need those resources to be initialized?
d

dwall

02/26/2020, 11:42 PM
yeah. I could be making this more complicated than it needs to be so lmk what you think. I'm creating a
SnowflakeRelation
class that will house some useful properties/methods for snowflake objects (fully qualified object decomposition,
exists()
and
size()
methods, etc.) Ideally, I'd like to leverage the already existing
snowflake
resource to run the queries contained within the methods
p

prha

02/26/2020, 11:42 PM
I think the default
required_resource_keys
on custom dagster types are resources that need to be initialized in the type check function
d

dwall

02/26/2020, 11:42 PM
ideally I'd be able to use
SnowflakeRelation
as a dagster type for solid I/O
p

prha

02/26/2020, 11:42 PM
but the
usable_as_dagster_type
just uses the python
isinstance
call for type checking
Separately, the custom input hydration / output materialization / auto-plugin functions that are used with custom types have their own
required_resource_keys
which I believe might be the hooks you want to use for solid I/O
It’s using
PythonObjectDagsterType
instead of the decorator, but it’s the same idea
but let me know if I’m missing the mark somewhere, and there’s a different use case you’re trying to capture
d

dwall

02/26/2020, 11:51 PM
awesome - let me check this out and circle back. Thanks @prha!