Skip to content

Instantly share code, notes, and snippets.

@agustinustheo
Created October 26, 2020 22:10
Show Gist options
  • Save agustinustheo/35d2a7669b5d46cbd40501c45a476c55 to your computer and use it in GitHub Desktop.
Save agustinustheo/35d2a7669b5d46cbd40501c45a476c55 to your computer and use it in GitHub Desktop.
Get certain documents by reference.
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