Session.run nodes changed type from 1.7.6 to 4.x

In the python 1.7.6 driver, we call session.run(...) for a simple MATCH query and see that the returned data has nodes where the type of the class is Node:

type(i).__name__: Node

When we do the same call in any 4.x version, the data comes back as a dict:

type(i).__name__: dict

Is this an expected change to the python driver made for version 4? I didn't find any reference to this change in the release notes https://github.com/neo4j/neo4j-python-driver/releases

If so, is there a way to have the data returned with Node class type instead of dict?

aha, yes, we're doing exactly what you guessed: result.data()

We'll switch to result.single() or similar and see how that works out.

This is a shot in the dark, but maybe you are using Result.data() (https://neo4j.com/docs/api/python-driver/4.4/api.html#neo4j.Result.data). Generally, I'd not recommend to use it for anything but prototyping and debugging. It has its limitations and is more the type of API to get you started quickly but less so to give you full control of what's going on under the hood.

Can you share a little more of your code, please?
Where exactly does i come from? I wasn't able to reproduce what you describe.

Here is a code snipped run on the 4.4 branch of the Python driver (dev snapshot, but should be the same for all of at least 4.4):

with neo4j.GraphDatabase.driver(uri, auth=auth) as driver:
    with driver.session(database="neo4j") as session:
        result = session.run("MERGE (n:Foo {bar: 'baz'}) RETURN n")
        record = result.single()
        node = record["n"]
        print(type(node))

Which prints <class 'neo4j.graph.Node'> .

Switching to result.single() solved the problem. Thanks @rouven_bauer