https://kedro.org/ logo
#questions
Title
# questions
o

Olivier Ho

04/05/2023, 1:22 PM
hello, what is the best way to i access credentials during a node run? i saw https://github.com/kedro-org/kedro/issues/575 but
get_current_session
has been deprecated for hooks
i tried to use local parameters with some success
but it broke kedro viz (characters length issues), since kedro viz reads the parameters
ok, nvm, i'll use a config loader
d

datajoely

04/05/2023, 1:51 PM
so
we intentionally make this difficult
the Nodes should be pure python functions with no knowledge of IO
credentials should be used in datasets and if you really want context and hooks
what are you trying to achieve?
o

Olivier Ho

04/05/2023, 1:53 PM
hum, if the nodes should have pure python function then I have some issues
i have to send some data to an endpoint and get the result resulting in IO
d

datajoely

04/05/2023, 1:53 PM
a custom dataset would be the right way to do that
I think
o

Olivier Ho

04/05/2023, 1:54 PM
hum, say for example, i have to send an image to an online processing platform
i fail to see how to implement such a dataset
d

datajoely

04/05/2023, 1:55 PM
hmmm good question
and that works by doing a
<http://requests.post|requests.post>
and then getting some response back right?
o

Olivier Ho

04/05/2023, 1:56 PM
yes
though, it's less complicated since there are python clients that simplies formatting
d

datajoely

04/05/2023, 1:57 PM
so that doesn’t fit nicely into our load/save abstraction for our datasets
I think your current way may be best
BUT
what I’d do is a
before_pipeline_run
hook which copies the credentials to environment variable
and then I’d use that env var as the way to pick up the credentials
feels neater than loading the config loader
o

Olivier Ho

04/05/2023, 1:58 PM
ohhhhhhhhhhhhh
yes
you've opened my eyes
it's indeed more clean
thank you
d

datajoely

04/05/2023, 2:09 PM
kedroid