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

create_user_from_command_line not returning correct results #81

Open
ManishMithaiwala opened this issue Mar 10, 2022 · 0 comments
Open

Comments

@ManishMithaiwala
Copy link

When creating a user from the command line-

python ckg/graphdb_builder/builder/create_user.py -u test -d test -n test -p 1 -a self
A user node is indeed created in the graph, however the logging messages show this:

Creating user in the database
New user node created: test2. Result: <neo4j.work.result.Result object at 0x7f9fef3184d0>
Done

The function stack is as follows: create_user_from_command_line->create_user->create_user_node->create_user_from_dict->commitQuery

After adding a print message in commitQuery, one can see that the result contains the result from the query.

def commitQuery(driver, query, parameters={}):
    # result = None
    try:
        with driver.session() as session:
            result = session.run(query, parameters)
            print('Peek Result', result.peek())
            return result

Creating user in the database
Peek Result <Record User_nodes=1>

However the result object is never returned to the original call.

    for q in query.split(';')[-2:-1]:
        try:
            result = connector.commitQuery(driver, q+';', parameters=data)
            print('Peek Result', result.peek())
            logger.info("New user node created: {}. Result: {}".format(data['username'], result))
            print("New user node created: {}. Result: {}".format(data['username'], result.peek()))

This results in the final log output like this:

Creating user in the database
Peek Result <Record User_nodes=1>
Peek Result None
New user node created: test. Result: None
Done

Expected behavior
If the response is returned correctly, the second log message 'Peek Result' should also be <Record User_nodes=1>. And the log message 'New user node created: ' should not be None as well.

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

No branches or pull requests

1 participant