Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does NOT work with Neo4J Community Edition #839

Open
sp-yang opened this issue Oct 25, 2024 · 7 comments
Open

Does NOT work with Neo4J Community Edition #839

sp-yang opened this issue Oct 25, 2024 · 7 comments
Assignees

Comments

@sp-yang
Copy link

sp-yang commented Oct 25, 2024

The current up-to-date version of graph builder does not work with Neo4J Community Edition, e.g. some commands are not supported by Neo4j community edition. Please adapt it to neo4j community editon as much as you can. Thanks!

@jexp
Copy link
Contributor

jexp commented Oct 28, 2024

@sp-yang can you provide more details on what's not working? I'm don't think we use any EE only features right now. Most of the work is done in the python code anyhow.

@sp-yang
Copy link
Author

sp-yang commented Oct 28, 2024

@jexp For example, in backend/src/graphDB_dataAccess.py, the function check_account_access() uses command "
SHOW USER PRIVILEGES
YIELD *
WHERE graph = $database AND action IN ['read']
RETURN COUNT(*) AS readAccessCount",
which is only supported by Neo4j EE version. CE version will throw an exception.

@olaoluthomas
Copy link

@jexp For example, in backend/src/graphDB_dataAccess.py, the function check_account_access() uses command " SHOW USER PRIVILEGES YIELD * WHERE graph = $database AND action IN ['read'] RETURN COUNT(*) AS readAccessCount", which is only supported by Neo4j EE version. CE version will throw an exception.

I have the same error message with the current version. When I revert to a working tree that has the previous version, no errors.

@bamalburg
Copy link

I agree this would be nice to have! I suspect maybe it's somehow inferring that the user doesn't have edit permissions in the community edition, because the roles show as null, but in reality, per this documentation, "In Neo4j Community Edition there are no roles, but all users have implied administrator privileges."

@jexp
Copy link
Contributor

jexp commented Oct 31, 2024

Good point. This is a recent addition that we can fix.

@icejean
Copy link

icejean commented Nov 9, 2024

The workaround is just return true when Exception occured.

    def check_account_access(self, database):
        query = """
        SHOW USER PRIVILEGES 
        YIELD * 
        WHERE graph = $database AND action IN ['read'] 
        RETURN COUNT(*) AS readAccessCount
        """
        try:
            logging.info(f"Checking access for database: {database}")

            result = self.graph.query(query, params={"database": database})
            read_access_count = result[0]["readAccessCount"] if result else 0

            logging.info(f"Read access count: {read_access_count}")

            if read_access_count > 0:
                logging.info("The account has read access.")
                return False
            else:
                logging.info("The account has write access.")
                return True

        except Exception as e:
            logging.error(f"Error checking account access: {e}")
            return True # False

Neo4j KGBuilder-1

@simons2wyn
Copy link

The workaround is just return true when Exception occured.

    def check_account_access(self, database):
        query = """
        SHOW USER PRIVILEGES 
        YIELD * 
        WHERE graph = $database AND action IN ['read'] 
        RETURN COUNT(*) AS readAccessCount
        """
        try:
            logging.info(f"Checking access for database: {database}")

            result = self.graph.query(query, params={"database": database})
            read_access_count = result[0]["readAccessCount"] if result else 0

            logging.info(f"Read access count: {read_access_count}")

            if read_access_count > 0:
                logging.info("The account has read access.")
                return False
            else:
                logging.info("The account has write access.")
                return True

        except Exception as e:
            logging.error(f"Error checking account access: {e}")
            return True # False

Neo4j KGBuilder-1

are you using the CE version deployed locally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants