03/04/2021, 10:54 AM
Hey, I'm writing a set of new tasks to interact with MongoDB. looking at other database provider I can see they are no consistency and I want to have the community input 1. Password : Some task like postgresql or mysql are passing the password as a param to the task, whereas Redis for example is getting the password out of the Prefect secret. What is the recommended way of doing it ? 2. db connection string vs individual params : With Mongo I use usually only a single parameter connection string which looking like mongo://,, for example. However all the db tasks are using distinct params. Any recommendation ? Anything else I need to be aware about ?
🚀 1


03/04/2021, 3:45 PM
Hey David, I think using a Secret is the best way to handle a password. However, taking a string kwarg allows the user to pass a literal or a
that will be resolved at runtime. I think the key here is not accepting a password at init time. I think individual parameters can feel more usable than a connection string. Depending on the complexity, I'd probably design it to take both and put the logic in a simple function
that will ignore individual parameters if the connection string is set. The init logic should throw an exception if they've provided an individual parameter and a connection string.