Skip to content

Commit

Permalink
Fix deferred connection in HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Jan 18, 2024
1 parent 75fe35c commit ed13cf5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions singlestoredb/http/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,6 @@ class Connection(connection.Connection):

def __init__(self, **kwargs: Any):
from .. import __version__ as client_version

connection.Connection.__init__(self, **kwargs)

host = kwargs.get('host', get_option('host'))
Expand Down Expand Up @@ -990,6 +989,8 @@ def _sync_connection(self, kwargs: Dict[str, Any]) -> None:

url = os.environ.get('SINGLESTOREDB_URL')
if not url:
if self._url and self._url.split('://', 1)[-1].startswith('singlestore.com'):
raise InterfaceError(0, 'Connection URL has not been established')
return

out = {}
Expand All @@ -1013,7 +1014,10 @@ def _sync_connection(self, kwargs: Dict[str, Any]) -> None:

# Get current connection attributes
curr_url = urlparse(self._url, scheme='singlestoredb', allow_fragments=True)
auth = tuple(self._sess.auth) # type: ignore
if self._sess.auth is not None:
auth = tuple(self._sess.auth) # type: ignore
else:
auth = (None, None) # type: ignore

# If it's just a password change, we don't need to reconnect
if (curr_url.hostname, curr_url.port, auth[0], self._database) == \
Expand Down

0 comments on commit ed13cf5

Please sign in to comment.