Created
April 15, 2019 13:57
-
-
Save chrismaddalena/351ed4ce1ccca4a12e3743488be4d293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def execute_query(driver, user, enabled=True): | |
"""Execute the provided query using the current Neo4j database connection.""" | |
if enabled: | |
query = """ | |
MATCH (u:User) | |
WHERE u.name =~ UPPER('%s@.*') AND (u.enabled = True) | |
RETURN u.enabled, u.pwdlastset, u.domain | |
""" % user | |
else: | |
query = """ | |
MATCH (u:User) | |
WHERE u.name =~ UPPER('%s@.*') | |
RETURN u.enabled, u.pwdlastset, u.domain | |
""" % user | |
with driver.session() as session: | |
results = session.run(query) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment