Skip to content

Conversation

@soerenreichardt
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Mar 26, 2025

Deploy Preview for neo4j-graph-data-science-client canceled.

Name Link
🔨 Latest commit 9ecde90
🔍 Latest deploy log https://app.netlify.com/sites/neo4j-graph-data-science-client/deploys/67ee3c02eee3590008e78844

@soerenreichardt soerenreichardt force-pushed the standalone-session-creation branch 3 times, most recently from 48bad4b to ef4cdbe Compare March 26, 2025 15:34
@soerenreichardt soerenreichardt marked this pull request as ready for review March 27, 2025 13:04
@DarthMax DarthMax self-assigned this Mar 28, 2025
Copy link
Contributor

@DarthMax DarthMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good but I wonder if we need to consider some implications to some functionality that requires a database. What happens if the user for example would run a write query?

show_progress=False,
database=db_endpoint.database,
return cls(
query_runner=session_bolt_query_runner,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only use the bolt query runner in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would lead to run_cypher being forwarded to the session wouldnt it? I think we should throw a unsupported operation error or something in such cases

@soerenreichardt
Copy link
Contributor Author

Good points, I implemented a dedicated query runner now that blocks all database related operations

Copy link
Contributor

@FlorentinD FlorentinD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

only would like to have an integration test as well. Maybe in test_remote_graph_ops.py but with a graph construct.

  • a changelog entry

@soerenreichardt
Copy link
Contributor Author

soerenreichardt commented Mar 28, 2025

only would like to have an integration test as well

To test what exactly? :) I don't see what an integration test would give us that the unit test didn't capture in this case.

@soerenreichardt soerenreichardt force-pushed the standalone-session-creation branch from ceefe91 to 4856fd2 Compare March 28, 2025 13:50
@FlorentinD
Copy link
Contributor

only would like to have an integration test as well

To test what exactly? :) I don't see what an integration test would give us that the unit test didn't capture in this case.

I was thinking of making sure its wired up correctly (i.e. such as the previous error in the query runner).

@soerenreichardt soerenreichardt force-pushed the standalone-session-creation branch from 4856fd2 to a480d02 Compare April 1, 2025 08:02
@soerenreichardt soerenreichardt force-pushed the standalone-session-creation branch from 4113949 to ce2932f Compare April 1, 2025 11:17
raise NotImplementedError

def database(self) -> Optional[str]:
raise NotImplementedError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats accessed on graph projection .. makes me wonder if there is a bug for sessions in general as this database can be viewed as either the db database or the session database (which doesnt make sense as its fixed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not a bug in sessions. The code that uses the db information looks like this:

        if len(info) == 0:
            raise ValueError(f"There is no projected graph named '{self.name()}'")
        if len(info) > 1:
            # for multiple dbs we can have the same graph name. But db + graph name is unique
            info = info[info["database"] == self._db]

So only when we are getting more than one result back from graph.list where we specify a graph name we will check the db. That could in theory be failing as we are using the database name from the db query runner, however on a session we cannot have the same graphName on multiple projections so we should be safe here 🤞.
We could do better though by maybe having a special Graph implementation for sessions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we can split the database method into gds_database and db_database.

With its usage only on list this should never be an issue for the session case.

For sessions we anyway plan to rewrite quite a bit of the client and maybe we will endup with a different Graph implementation as well 🤔

@soerenreichardt soerenreichardt force-pushed the standalone-session-creation branch from 82c0b0d to b9ab7d1 Compare April 2, 2025 12:19
@soerenreichardt soerenreichardt merged commit 0b2e986 into neo4j:main Apr 3, 2025
8 checks passed
@soerenreichardt soerenreichardt deleted the standalone-session-creation branch April 3, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants