How to use encrypted password in connection string of sqlalchemy?

Solution 1:

You could encode the string, but encoding is not encrypting as Gord Thompson mentioned in the comments. Anyone with a bit of knowledge about base64 can reverse it.

import base64
password = "yourpassword".encode("utf-8")
encoded = base64.b64encode(password)
print(encoded)

Decoding it is a matter of

decoded = base64.decodebytes(encoded).decode('utf-8')
print(decoded)