https://dagster.io/ logo
#ask-community
Title
# ask-community
m

Manish Khatri

08/23/2023, 9:55 PM
When writing our own Resource that extends a
ConfigurableResource
, what’s the recommended approach for having a field that is required to store an intermediate value? E.g.:
Copy code
class MyResource(ConfigurableResource):
  user: str
  password: str
  _session_token: str

  def authenticate(self):
    # will get a session auth token from API.
    # Will use token to fetch some data from an API
    self._session_token = some_function()
In the above example an Exception will be thrown:
AttributeError: 'MyResource' object has no attribute '_session_token'
dagster bot responded by community 1
z

Zach

08/23/2023, 10:02 PM
I think you want a PrivateAttr
ty thankyou 1
👌 1
3 Views