langchain-postgres
langchain-postgres copied to clipboard
Implementation Suggestion: for creating connection string from db params method
This is the current implementation for this method def connection_string_from_db_params( cls, driver: str, host: str, port: int, database: str, user: str, password: str, ) -> str: """Return connection string from database parameters.""" if driver != "psycopg": raise NotImplementedError("Only psycopg3 driver is supported") return f"postgresql+{driver}://{user}:{password}@{host}:{port}/{database}"
But the above implementation in not handling the password properly i.e. if password contains the special characters they are not converted to there corresponding ascii value
Suggestion: we can use
from sqlalchemy import URL connection_string = URL.create( drivername="", database="", username="", password="", host="", port=, )