I would like to fetch or query some rows from our production database. Since I don’t want to provide userid or any password directly from the python code, I’d like to encapsulate connection information thru a webhook or something safer.
What is the best way to the that? Any source code available?
I do agree with you about not letting a python script run riot on your database, one way to address this is to write APIs in front of your Database, there are plenty of docs around writing API. GraphQL is one that lets you write queries as a JSON object providing a nice interface to be integrated with the bot. GraphQL is easy to bind with the database and you would enable M2M authentication between the bot backend and your API to secure the connection hence protecting username/passwords of the DB.
You simply need to put an interface in front of your database for bot backend to communicate with.