Danny Steffy
08/01/2023, 2:48 PMDanny Steffy
08/01/2023, 2:48 PMclass ArangoDbResource(ConfigurableResource):
conn_strs: list[str]
user: str
password: str
_arango_client: ArangoClient
def setup_for_execution(self, context) -> None:
self._arango_client = ArangoClient(hosts=self.conn_strs)
def get_db(self, db_name: str):
return self._arango_client.db(db_name, username=self.user, password=self.password)
Serge Gekker
08/01/2023, 3:49 PMDanny Steffy
08/01/2023, 4:02 PMclass ArangoDbResource(ConfigurableResource):
conn_strs_key: str
creds_key: str
_arango_client: ArangoClient
_user: str
_password : str
def setup_for_execution(self, context) -> None:
conn_strs = kv.f_get_secret(self.conn_strs_key)
creds = kv.f_get_secret(self.creds_key)
self._arango_client = ArangoClient(hosts=conn_strs)
self._user = creds[0]
self._password = creds[1]
def get_db(self, db_name: str):
return self._arango_client.db(db_name, username=self._user, password=self._password)
arangodb_resource = ArangoDbResource(conn_strs_key=EnvVar("ARANGO_CLUSTER_KEY"), creds_key=EnvVar("ARANGO_CRED_KEY"))
Danny Steffy
08/01/2023, 4:14 PMdagster._core.errors.DagsterSubprocessError: During multiprocess execution errors occurred in child processes:
In process 33: dagster._core.errors.DagsterInvalidInvocationError: 'ArangoDbResource' is a Pythonic resource and does not support manipulating undeclared attribute '_arango_client' as it inherits from 'pydantic.BaseModel' without extra="allow". If trying to maintain state on this resource, consider building a separate, stateful client class, and provide a method on the resource to construct and return the stateful client.
Danny Steffy
08/01/2023, 4:14 PMDanny Steffy
08/01/2023, 4:33 PM