Created
October 26, 2020 22:10
-
-
Save agustinustheo/35d2a7669b5d46cbd40501c45a476c55 to your computer and use it in GitHub Desktop.
Get certain documents by reference.
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 get_by_ref_id(collection, id): | |
try: | |
serverClient = FaunaClient(secret=os.environ.get("FAUNA_SERVER_SECRET")) | |
res = serverClient.query(q.get(q.ref(q.collection(collection), id))) | |
res["data"]["ref_id"] = res["ref"].id() | |
return res["data"] | |
except Exception as ex: | |
raise ex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment