Unable to connect to memgraph from docker

Hi!

Following the Getting Started tutorial.

I’ve followed the instructions to run the Docker image, installed gqlalchemy and executedmemgraph = Memgraph('127.0.0.1', 7687). However, the next instruction memgraph.drop_database() errors out with the following message:

--------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/exceptions.py:231, in connection_handler.<locals>._handler(*args, **kwargs)
    230 try:
--> 231     return func(*args, **kwargs)
    232 except Exception as ex:

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/connection.py:106, in MemgraphConnection._create_connection(self)
    105 sslmode = mgclient.MG_SSLMODE_REQUIRE if self.encrypted else mgclient.MG_SSLMODE_DISABLE
--> 106 connection = mgclient.connect(
    107     host=self.host,
    108     port=self.port,
    109     username=self.username,
    110     password=self.password,
    111     sslmode=sslmode,
    112     lazy=self.lazy,
    113     client_name=self.client_name,
    114 )
    115 connection.autocommit = True

OperationalError: failed to receive handshake response

The above exception was the direct cause of the following exception:

GQLAlchemyWaitForConnectionError          Traceback (most recent call last)
Cell In [3], line 1
----> 1 memgraph.drop_database()

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/vendors/database_client.py:131, in DatabaseClient.drop_database(self)
    129 def drop_database(self):
    130     """Drops database by removing all nodes and edges."""
--> 131     self.execute("MATCH (n) DETACH DELETE n;")

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/vendors/database_client.py:61, in DatabaseClient.execute(self, query, connection)
     59 def execute(self, query: str, connection: Connection = None) -> None:
     60     """Executes Cypher query without returning any results."""
---> 61     connection = connection or self._get_cached_connection()
     62     connection.execute(query)

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/vendors/database_client.py:136, in DatabaseClient._get_cached_connection(self)
    134 """Returns cached connection if it exists, creates it otherwise."""
    135 if self._cached_connection is None or not self._cached_connection.is_active():
--> 136     self._cached_connection = self.new_connection()
    138 return self._cached_connection

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/vendors/memgraph.py:139, in Memgraph.new_connection(self)
    130 """Creates new Memgraph connection."""
    131 args = dict(
    132     host=self._host,
    133     port=self._port,
   (...)
    137     client_name=self._client_name,
    138 )
--> 139 return MemgraphConnection(**args)

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/connection.py:78, in MemgraphConnection.__init__(self, host, port, username, password, encrypted, client_name, lazy)
     74 super().__init__(
     75     host=host, port=port, username=username, password=password, encrypted=encrypted, client_name=client_name
     76 )
     77 self.lazy = lazy
---> 78 self._connection = self._create_connection()

File ~/data-science/graphs/.venv/lib/python3.9/site-packages/gqlalchemy/exceptions.py:235, in connection_handler.<locals>._handler(*args, **kwargs)
    233 time.sleep(current_delay)
    234 if time.perf_counter() - start_time >= timeout:
--> 235     raise GQLAlchemyWaitForConnectionError from ex
    237 current_delay *= backoff

GQLAlchemyWaitForConnectionError: 

Which version of GQLAlchemy are you using? @jeromeku