Created
May 8, 2023 20:17
-
-
Save Evan-Kim2028/6e616e54603f80c9d70deb0b6839116e 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"True" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from dotenv import load_dotenv\n", | |
"import os\n", | |
"from subgrounds import Subgrounds\n", | |
"\n", | |
"load_dotenv()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"sg = Subgrounds(headers={\"Playgrounds-Api-Key\": os.environ.get('PG_KEY')})\n", | |
"\n", | |
"# https://gateway.thegraph.com/api/[api-key]/subgraphs/id/ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH6123cr7\n", | |
"# look at header behavior with hosted vs decentralized queries\n", | |
"\n", | |
"# instantiate Dex class with subgraph key\n", | |
"univ2 = '2szAn45skWZFLPUbxFEtjiEzT1FMW8Ff5ReUPbZbQxtt'\n", | |
"\n", | |
"subgraph = sg.load_subgraph(\n", | |
" f\"https://api.playgrounds.network/v1/proxy/subgraphs/id/{univ2}\" \n", | |
")\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"my_fp = subgraph.Query.swaps(\n", | |
" first=125,\n", | |
" where ={'pair_id': '0xa43fe16908251ee70ef74718545e4fe6c5ccec9f'}\n", | |
" )" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# relevant links\n", | |
"# https://thegraph.com/explorer/subgraphs/2szAn45skWZFLPUbxFEtjiEzT1FMW8Ff5ReUPbZbQxtt?view=Playground&chain=mainnet \n", | |
"# https://v2.info.uniswap.org/pair/0xa43fe16908251ee70ef74718545e4fe6c5ccec9f" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "KeyError", | |
"evalue": "'TypeMeta.InputObjectMeta.type_of_input_field: no input field named pair_id for input object Swap_filter'", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/schema.py:309\u001b[0m, in \u001b[0;36mTypeMeta.InputObjectMeta.type_of_input_field\u001b[0;34m(self, fname)\u001b[0m\n\u001b[1;32m 308\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[0;32m--> 309\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mnext\u001b[39;49m(\n\u001b[1;32m 310\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49minput_fields\n\u001b[1;32m 311\u001b[0m \u001b[39m|\u001b[39;49m where(\u001b[39mlambda\u001b[39;49;00m infield: infield\u001b[39m.\u001b[39;49mname \u001b[39m==\u001b[39;49m fname)\n\u001b[1;32m 312\u001b[0m \u001b[39m|\u001b[39;49m \u001b[39mmap\u001b[39;49m(\u001b[39mlambda\u001b[39;49;00m infield: infield\u001b[39m.\u001b[39;49mtype_)\n\u001b[1;32m 313\u001b[0m )\n\u001b[1;32m 314\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mStopIteration\u001b[39;00m:\n", | |
"\u001b[0;31mStopIteration\u001b[0m: ", | |
"\nDuring handling of the above exception, another exception occurred:\n", | |
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", | |
"Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m sg\u001b[39m.\u001b[39;49mquery_df(my_fp)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgrounds.py:414\u001b[0m, in \u001b[0;36mSubgrounds.query_df\u001b[0;34m(self, fpaths, columns, concat, pagination_strategy)\u001b[0m\n\u001b[1;32m 347\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"Same as :func:`Subgrounds.query` but formats the response data into a\u001b[39;00m\n\u001b[1;32m 348\u001b[0m \u001b[39mPandas DataFrame. If the response data cannot be flattened to a single query\u001b[39;00m\n\u001b[1;32m 349\u001b[0m \u001b[39m(e.g.: when querying multiple list fields that return different entities),\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 410\u001b[0m \u001b[39m 9 1643213196 2610.686563\u001b[39;00m\n\u001b[1;32m 411\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 413\u001b[0m fpaths \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m([fpaths] \u001b[39m|\u001b[39m traverse \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(FieldPath\u001b[39m.\u001b[39m_auto_select) \u001b[39m|\u001b[39m traverse)\n\u001b[0;32m--> 414\u001b[0m json_data \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mquery_json(fpaths, pagination_strategy\u001b[39m=\u001b[39;49mpagination_strategy)\n\u001b[1;32m 415\u001b[0m \u001b[39mreturn\u001b[39;00m df_of_json(json_data, fpaths, columns, concat)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgrounds.py:315\u001b[0m, in \u001b[0;36mSubgrounds.query_json\u001b[0;34m(self, fpaths, pagination_strategy)\u001b[0m\n\u001b[1;32m 301\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"Equivalent to ``Subgrounds.execute(Subgrounds.mk_request(fpaths), pagination_strategy)``.\u001b[39;00m\n\u001b[1;32m 302\u001b[0m \n\u001b[1;32m 303\u001b[0m \u001b[39mArgs:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[39m list[dict[str, Any]]: The reponse data\u001b[39;00m\n\u001b[1;32m 312\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 314\u001b[0m fpaths \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m([fpaths] \u001b[39m|\u001b[39m traverse \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(FieldPath\u001b[39m.\u001b[39m_auto_select) \u001b[39m|\u001b[39m traverse)\n\u001b[0;32m--> 315\u001b[0m req \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mmk_request(fpaths)\n\u001b[1;32m 316\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mexecute(req, pagination_strategy\u001b[39m=\u001b[39mpagination_strategy)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgrounds.py:148\u001b[0m, in \u001b[0;36mSubgrounds.mk_request\u001b[0;34m(self, fpaths)\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"Creates a :class:`DataRequest` object by combining one or more\u001b[39;00m\n\u001b[1;32m 135\u001b[0m \u001b[39m:class:`FieldPath` objects.\u001b[39;00m\n\u001b[1;32m 136\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 142\u001b[0m \u001b[39m DataRequest: A new :class:`DataRequest` object\u001b[39;00m\n\u001b[1;32m 143\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 145\u001b[0m fpaths \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m([fpaths] \u001b[39m|\u001b[39m traverse \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(FieldPath\u001b[39m.\u001b[39m_auto_select) \u001b[39m|\u001b[39m traverse)\n\u001b[1;32m 147\u001b[0m \u001b[39mreturn\u001b[39;00m DataRequest(\n\u001b[0;32m--> 148\u001b[0m documents\u001b[39m=\u001b[39m\u001b[39mlist\u001b[39;49m(\n\u001b[1;32m 149\u001b[0m fpaths\n\u001b[1;32m 150\u001b[0m \u001b[39m|\u001b[39;49m groupby(\u001b[39mlambda\u001b[39;49;00m fpath: fpath\u001b[39m.\u001b[39;49m_subgraph\u001b[39m.\u001b[39;49m_url)\n\u001b[1;32m 151\u001b[0m \u001b[39m|\u001b[39;49m \u001b[39mmap\u001b[39;49m(\n\u001b[1;32m 152\u001b[0m \u001b[39mlambda\u001b[39;49;00m group: Document(\n\u001b[1;32m 153\u001b[0m url\u001b[39m=\u001b[39;49mgroup[\u001b[39m0\u001b[39;49m],\n\u001b[1;32m 154\u001b[0m query\u001b[39m=\u001b[39;49mreduce(\n\u001b[1;32m 155\u001b[0m Query\u001b[39m.\u001b[39;49madd, group[\u001b[39m1\u001b[39;49m] \u001b[39m|\u001b[39;49m \u001b[39mmap\u001b[39;49m(FieldPath\u001b[39m.\u001b[39;49m_selection), Query()\n\u001b[1;32m 156\u001b[0m ),\n\u001b[1;32m 157\u001b[0m )\n\u001b[1;32m 158\u001b[0m )\n\u001b[1;32m 159\u001b[0m )\n\u001b[1;32m 160\u001b[0m )\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgrounds.py:154\u001b[0m, in \u001b[0;36mSubgrounds.mk_request.<locals>.<lambda>\u001b[0;34m(group)\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"Creates a :class:`DataRequest` object by combining one or more\u001b[39;00m\n\u001b[1;32m 135\u001b[0m \u001b[39m:class:`FieldPath` objects.\u001b[39;00m\n\u001b[1;32m 136\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 142\u001b[0m \u001b[39m DataRequest: A new :class:`DataRequest` object\u001b[39;00m\n\u001b[1;32m 143\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 145\u001b[0m fpaths \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m([fpaths] \u001b[39m|\u001b[39m traverse \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(FieldPath\u001b[39m.\u001b[39m_auto_select) \u001b[39m|\u001b[39m traverse)\n\u001b[1;32m 147\u001b[0m \u001b[39mreturn\u001b[39;00m DataRequest(\n\u001b[1;32m 148\u001b[0m documents\u001b[39m=\u001b[39m\u001b[39mlist\u001b[39m(\n\u001b[1;32m 149\u001b[0m fpaths\n\u001b[1;32m 150\u001b[0m \u001b[39m|\u001b[39m groupby(\u001b[39mlambda\u001b[39;00m fpath: fpath\u001b[39m.\u001b[39m_subgraph\u001b[39m.\u001b[39m_url)\n\u001b[1;32m 151\u001b[0m \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(\n\u001b[1;32m 152\u001b[0m \u001b[39mlambda\u001b[39;00m group: Document(\n\u001b[1;32m 153\u001b[0m url\u001b[39m=\u001b[39mgroup[\u001b[39m0\u001b[39m],\n\u001b[0;32m--> 154\u001b[0m query\u001b[39m=\u001b[39mreduce(\n\u001b[1;32m 155\u001b[0m Query\u001b[39m.\u001b[39;49madd, group[\u001b[39m1\u001b[39;49m] \u001b[39m|\u001b[39;49m \u001b[39mmap\u001b[39;49m(FieldPath\u001b[39m.\u001b[39;49m_selection), Query()\n\u001b[1;32m 156\u001b[0m ),\n\u001b[1;32m 157\u001b[0m )\n\u001b[1;32m 158\u001b[0m )\n\u001b[1;32m 159\u001b[0m )\n\u001b[1;32m 160\u001b[0m )\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgraph/fieldpath.py:438\u001b[0m, in \u001b[0;36mFieldPath._selection\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 434\u001b[0m \u001b[39mreturn\u001b[39;00m []\n\u001b[1;32m 436\u001b[0m \u001b[39massert\u001b[39;00m \u001b[39mFalse\u001b[39;00m \u001b[39m# Suppress mypy missing return statement warning\u001b[39;00m\n\u001b[0;32m--> 438\u001b[0m \u001b[39mreturn\u001b[39;00m f(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_path)[\u001b[39m0\u001b[39m]\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/subgraph/fieldpath.py:426\u001b[0m, in \u001b[0;36mFieldPath._selection.<locals>.f\u001b[0;34m(path)\u001b[0m\n\u001b[1;32m 418\u001b[0m \u001b[39mreturn\u001b[39;00m [Selection(fmeta, selection\u001b[39m=\u001b[39mf(rest))]\n\u001b[1;32m 420\u001b[0m \u001b[39mcase\u001b[39;00m [(args, TypeMeta\u001b[39m.\u001b[39mFieldMeta() \u001b[39mas\u001b[39;00m fmeta), \u001b[39m*\u001b[39mrest]:\n\u001b[1;32m 421\u001b[0m \u001b[39mreturn\u001b[39;00m [\n\u001b[1;32m 422\u001b[0m Selection(\n\u001b[1;32m 423\u001b[0m fmeta,\n\u001b[1;32m 424\u001b[0m \u001b[39m# TODO: Revisit this\u001b[39;00m\n\u001b[1;32m 425\u001b[0m alias\u001b[39m=\u001b[39mFieldPath\u001b[39m.\u001b[39m_hash(fmeta\u001b[39m.\u001b[39mname \u001b[39m+\u001b[39m \u001b[39mstr\u001b[39m(args)),\n\u001b[0;32m--> 426\u001b[0m arguments\u001b[39m=\u001b[39marguments_of_field_args(\n\u001b[1;32m 427\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_subgraph\u001b[39m.\u001b[39;49m_schema, fmeta, args\n\u001b[1;32m 428\u001b[0m ),\n\u001b[1;32m 429\u001b[0m selection\u001b[39m=\u001b[39mf(rest),\n\u001b[1;32m 430\u001b[0m )\n\u001b[1;32m 431\u001b[0m ]\n\u001b[1;32m 433\u001b[0m \u001b[39mcase\u001b[39;00m []:\n\u001b[1;32m 434\u001b[0m \u001b[39mreturn\u001b[39;00m []\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1856\u001b[0m, in \u001b[0;36marguments_of_field_args\u001b[0;34m(schema, field, args)\u001b[0m\n\u001b[1;32m 1854\u001b[0m \u001b[39mmatch\u001b[39;00m field:\n\u001b[1;32m 1855\u001b[0m \u001b[39mcase\u001b[39;00m TypeMeta\u001b[39m.\u001b[39mFieldMeta() \u001b[39mas\u001b[39;00m field:\n\u001b[0;32m-> 1856\u001b[0m args \u001b[39m=\u001b[39m [f(arg_meta) \u001b[39mfor\u001b[39;00m arg_meta \u001b[39min\u001b[39;00m field\u001b[39m.\u001b[39marguments]\n\u001b[1;32m 1857\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mlist\u001b[39m(\u001b[39mfilter\u001b[39m(\u001b[39mlambda\u001b[39;00m arg: arg \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m, args))\n\u001b[1;32m 1858\u001b[0m \u001b[39mcase\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m_\u001b[39;00m:\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1856\u001b[0m, in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 1854\u001b[0m \u001b[39mmatch\u001b[39;00m field:\n\u001b[1;32m 1855\u001b[0m \u001b[39mcase\u001b[39;00m TypeMeta\u001b[39m.\u001b[39mFieldMeta() \u001b[39mas\u001b[39;00m field:\n\u001b[0;32m-> 1856\u001b[0m args \u001b[39m=\u001b[39m [f(arg_meta) \u001b[39mfor\u001b[39;00m arg_meta \u001b[39min\u001b[39;00m field\u001b[39m.\u001b[39marguments]\n\u001b[1;32m 1857\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mlist\u001b[39m(\u001b[39mfilter\u001b[39m(\u001b[39mlambda\u001b[39;00m arg: arg \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m, args))\n\u001b[1;32m 1858\u001b[0m \u001b[39mcase\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m_\u001b[39;00m:\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1842\u001b[0m, in \u001b[0;36marguments_of_field_args.<locals>.f\u001b[0;34m(arg_meta)\u001b[0m\n\u001b[1;32m 1838\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mf\u001b[39m(arg_meta: TypeMeta\u001b[39m.\u001b[39mArgumentMeta) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Optional[Argument]:\n\u001b[1;32m 1839\u001b[0m \u001b[39mif\u001b[39;00m arg_meta\u001b[39m.\u001b[39mname \u001b[39min\u001b[39;00m args:\n\u001b[1;32m 1840\u001b[0m \u001b[39mreturn\u001b[39;00m Argument(\n\u001b[1;32m 1841\u001b[0m arg_meta\u001b[39m.\u001b[39mname,\n\u001b[0;32m-> 1842\u001b[0m input_value_of_argument(schema, arg_meta, args[arg_meta\u001b[39m.\u001b[39;49mname]),\n\u001b[1;32m 1843\u001b[0m )\n\u001b[1;32m 1844\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m 1845\u001b[0m \u001b[39mif\u001b[39;00m (arg_meta\u001b[39m.\u001b[39mdefault_value) \u001b[39mor\u001b[39;00m (\u001b[39mnot\u001b[39;00m TypeRef\u001b[39m.\u001b[39mis_non_null(arg_meta\u001b[39m.\u001b[39mtype_)):\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1829\u001b[0m, in \u001b[0;36minput_value_of_argument\u001b[0;34m(schema, argmeta, value)\u001b[0m\n\u001b[1;32m 1826\u001b[0m \u001b[39mcase\u001b[39;00m (value, typ, non_null):\n\u001b[1;32m 1827\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mmk_input_value(\u001b[39m\u001b[39m{\u001b[39;00mvalue\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mtyp\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mnon_null\u001b[39m}\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m-> 1829\u001b[0m \u001b[39mreturn\u001b[39;00m fmt_value(argmeta\u001b[39m.\u001b[39;49mtype_, value)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1818\u001b[0m, in \u001b[0;36minput_value_of_argument.<locals>.fmt_value\u001b[0;34m(type_ref, value, non_null)\u001b[0m\n\u001b[1;32m 1814\u001b[0m \u001b[39mreturn\u001b[39;00m InputValue\u001b[39m.\u001b[39mList([fmt_value(t, val, non_null) \u001b[39mfor\u001b[39;00m val \u001b[39min\u001b[39;00m value])\n\u001b[1;32m 1816\u001b[0m \u001b[39mcase\u001b[39;00m (TypeRef\u001b[39m.\u001b[39mNamed(), TypeMeta\u001b[39m.\u001b[39mInputObjectMeta() \u001b[39mas\u001b[39;00m input_object, \u001b[39mdict\u001b[39m()):\n\u001b[1;32m 1817\u001b[0m \u001b[39mreturn\u001b[39;00m InputValue\u001b[39m.\u001b[39mObject(\n\u001b[0;32m-> 1818\u001b[0m {\n\u001b[1;32m 1819\u001b[0m key: fmt_value(\n\u001b[1;32m 1820\u001b[0m input_object\u001b[39m.\u001b[39mtype_of_input_field(key), val, non_null\n\u001b[1;32m 1821\u001b[0m )\n\u001b[1;32m 1822\u001b[0m \u001b[39mfor\u001b[39;00m key, val \u001b[39min\u001b[39;00m value\u001b[39m.\u001b[39mitems()\n\u001b[1;32m 1823\u001b[0m }\n\u001b[1;32m 1824\u001b[0m )\n\u001b[1;32m 1826\u001b[0m \u001b[39mcase\u001b[39;00m (value, typ, non_null):\n\u001b[1;32m 1827\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mmk_input_value(\u001b[39m\u001b[39m{\u001b[39;00mvalue\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mtyp\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mnon_null\u001b[39m}\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m\"\u001b[39m)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/query.py:1820\u001b[0m, in \u001b[0;36m<dictcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 1814\u001b[0m \u001b[39mreturn\u001b[39;00m InputValue\u001b[39m.\u001b[39mList([fmt_value(t, val, non_null) \u001b[39mfor\u001b[39;00m val \u001b[39min\u001b[39;00m value])\n\u001b[1;32m 1816\u001b[0m \u001b[39mcase\u001b[39;00m (TypeRef\u001b[39m.\u001b[39mNamed(), TypeMeta\u001b[39m.\u001b[39mInputObjectMeta() \u001b[39mas\u001b[39;00m input_object, \u001b[39mdict\u001b[39m()):\n\u001b[1;32m 1817\u001b[0m \u001b[39mreturn\u001b[39;00m InputValue\u001b[39m.\u001b[39mObject(\n\u001b[1;32m 1818\u001b[0m {\n\u001b[1;32m 1819\u001b[0m key: fmt_value(\n\u001b[0;32m-> 1820\u001b[0m input_object\u001b[39m.\u001b[39;49mtype_of_input_field(key), val, non_null\n\u001b[1;32m 1821\u001b[0m )\n\u001b[1;32m 1822\u001b[0m \u001b[39mfor\u001b[39;00m key, val \u001b[39min\u001b[39;00m value\u001b[39m.\u001b[39mitems()\n\u001b[1;32m 1823\u001b[0m }\n\u001b[1;32m 1824\u001b[0m )\n\u001b[1;32m 1826\u001b[0m \u001b[39mcase\u001b[39;00m (value, typ, non_null):\n\u001b[1;32m 1827\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mmk_input_value(\u001b[39m\u001b[39m{\u001b[39;00mvalue\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mtyp\u001b[39m}\u001b[39;00m\u001b[39m, \u001b[39m\u001b[39m{\u001b[39;00mnon_null\u001b[39m}\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m\"\u001b[39m)\n", | |
"File \u001b[0;32m~/Documents/github/subgraph-query-portal/.venv/lib/python3.10/site-packages/subgrounds/schema.py:315\u001b[0m, in \u001b[0;36mTypeMeta.InputObjectMeta.type_of_input_field\u001b[0;34m(self, fname)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mnext\u001b[39m(\n\u001b[1;32m 310\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39minput_fields\n\u001b[1;32m 311\u001b[0m \u001b[39m|\u001b[39m where(\u001b[39mlambda\u001b[39;00m infield: infield\u001b[39m.\u001b[39mname \u001b[39m==\u001b[39m fname)\n\u001b[1;32m 312\u001b[0m \u001b[39m|\u001b[39m \u001b[39mmap\u001b[39m(\u001b[39mlambda\u001b[39;00m infield: infield\u001b[39m.\u001b[39mtype_)\n\u001b[1;32m 313\u001b[0m )\n\u001b[1;32m 314\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mStopIteration\u001b[39;00m:\n\u001b[0;32m--> 315\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mKeyError\u001b[39;00m(\n\u001b[1;32m 316\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mTypeMeta.InputObjectMeta.type_of_input_field: no input field named \u001b[39m\u001b[39m{\u001b[39;00mfname\u001b[39m}\u001b[39;00m\u001b[39m for input object \u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mname\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\n\u001b[1;32m 317\u001b[0m )\n", | |
"\u001b[0;31mKeyError\u001b[0m: 'TypeMeta.InputObjectMeta.type_of_input_field: no input field named pair_id for input object Swap_filter'" | |
] | |
} | |
], | |
"source": [ | |
"sg.query_df(my_fp)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": ".venv", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.6" | |
}, | |
"orig_nbformat": 4 | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment