{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Fauna\n", "\n", ">[Fauna](https://fauna.com/) is a Document Database.\n", "\n", "Query `Fauna` documents" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#!pip install fauna" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Query data example" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from langchain.document_loaders.fauna import FaunaLoader\n", "\n", "secret = \"\"\n", "query = \"Item.all()\" # Fauna query. Assumes that the collection is called \"Item\"\n", "field = \"text\" # The field that contains the page content. Assumes that the field is called \"text\"\n", "\n", "loader = FaunaLoader(query, field, secret)\n", "docs = loader.lazy_load()\n", "\n", "for value in docs:\n", " print(value)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Query with Pagination\n", "You get a `after` value if there are more data. You can get values after the curcor by passing in the `after` string in query. \n", "\n", "To learn more following [this link](https://fqlx-beta--fauna-docs.netlify.app/fqlx/beta/reference/schema_entities/set/static-paginate)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "query = \"\"\"\n", "Item.paginate(\"hs+DzoPOg ... aY1hOohozrV7A\")\n", "Item.all()\n", "\"\"\"\n", "loader = FaunaLoader(query, field, secret)" ] } ], "metadata": { "language_info": { "name": "python" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }