Skip to content

Commit

Permalink
fixing issue cannot connect to db which was due to the decoded connec…
Browse files Browse the repository at this point in the history
…tion_uri being url encoded and it needs to be url decoded to be consume by SQLAlchemy engine (#129)
  • Loading branch information
rmaroun authored Aug 30, 2023
1 parent e80941d commit 4af9fb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dataherald/sql_database/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import re
from typing import Any, List
from urllib.parse import unquote

from langchain.sql_database import SQLDatabase as LangchainSQLDatabase
from sqlalchemy import MetaData, create_engine, text
Expand Down Expand Up @@ -70,7 +71,7 @@ def get_sql_engine(cls, database_info: DatabaseConnection) -> "SQLDatabase":
engine = cls.from_uri_ssh(database_info)
DBConnections.add(database_info.alias, engine)
return engine
engine = cls.from_uri(fernet_encrypt.decrypt(database_info.uri))
engine = cls.from_uri(unquote(fernet_encrypt.decrypt(database_info.uri)))
DBConnections.add(database_info.alias, engine)
return engine

Expand Down

0 comments on commit 4af9fb5

Please sign in to comment.