-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
423 additions
and
419 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,126 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Intro to Flipside SDK/API: Getting Started\n", | ||
"\n", | ||
"<em>install Flipside with pip</em><br/>\n", | ||
"`pip install flipside`" | ||
] | ||
"cells": [ | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Intro to Flipside SDK/API: Getting Started\n", | ||
"\n", | ||
"<em>install Flipside with pip</em><br/>\n", | ||
"`pip install flipside`" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Import the package" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from flipside import Flipside" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Run your first query<br/>\n", | ||
"<em>Remember to copy/paste your API Key from https://flipsidecrypto.xyz/api-keys below.</em>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"YOUR_API_KEY = os.environ.get(\"FLIPSIDE_API_KEY\")\n", | ||
"\n", | ||
"# Invoke the ShroomDK class to create an instance of the SDK\n", | ||
"sdk = Flipside(YOUR_API_KEY)\n", | ||
"\n", | ||
"# Run a query\n", | ||
"query_result_set = sdk.query(\"\"\"\n", | ||
" SELECT * FROM ethereum.core.ez_eth_transfers \n", | ||
" WHERE \n", | ||
" block_timestamp > GETDATE() - interval'90 days'\n", | ||
" AND \n", | ||
" (eth_from_address = lower('0xc2f41b3a1ff28fd2a6eee76ee12e51482fcfd11f')\n", | ||
" OR eth_to_address = lower('0xc2f41b3a1ff28fd2a6eee76ee12e51482fcfd11f'))\n", | ||
"\"\"\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Query Result Set\n", | ||
"\n", | ||
"```python\n", | ||
"class QueryResultSet(BaseModel):\n", | ||
" query_id: Union[str, None] = Field(None, description=\"The server id of the query\")\n", | ||
" status: str = Field(False, description=\"The status of the query (`PENDING`, `FINISHED`, `ERROR`)\")\n", | ||
" columns: Union[List[str], None] = Field(None, description=\"The names of the columns in the result set\")\n", | ||
" column_types: Union[List[str], None] = Field(None, description=\"The type of the columns in the result set\")\n", | ||
" rows: Union[List[Any], None] = Field(None, description=\"The results of the query\")\n", | ||
" run_stats: Union[QueryRunStats, None] = Field(\n", | ||
" None,\n", | ||
" description=\"Summary stats on the query run (i.e. the number of rows returned, the elapsed time, etc)\",\n", | ||
" )\n", | ||
" records: Union[List[Any], None] = Field(None, description=\"The results of the query transformed as an array of objects\")\n", | ||
" error: Any\n", | ||
"\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"## Explore the result set object\n", | ||
"\n", | ||
"records = query_result_set.records\n", | ||
"\n", | ||
"print(records[0])" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.10.1 64-bit", | ||
"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.1" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1" | ||
} | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Import the package" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from flipside import Flipside" | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Run your first query<br/>\n", | ||
"<em>Remember to copy/paste your API Key from https://flipsidecrypto.xyz/account/api-keys below.</em>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"YOUR_API_KEY = os.environ.get(\"FLIPSIDE_API_KEY\")\n", | ||
"\n", | ||
"# Invoke the ShroomDK class to create an instance of the SDK\n", | ||
"sdk = Flipside(YOUR_API_KEY)\n", | ||
"\n", | ||
"# Run a query\n", | ||
"query_result_set = sdk.query(\"\"\"\n", | ||
" SELECT * FROM ethereum.core.ez_eth_transfers \n", | ||
" WHERE \n", | ||
" block_timestamp > GETDATE() - interval'90 days'\n", | ||
" AND \n", | ||
" (eth_from_address = lower('0xc2f41b3a1ff28fd2a6eee76ee12e51482fcfd11f')\n", | ||
" OR eth_to_address = lower('0xc2f41b3a1ff28fd2a6eee76ee12e51482fcfd11f'))\n", | ||
"\"\"\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Query Result Set\n", | ||
"\n", | ||
"```python\n", | ||
"class QueryResultSet(BaseModel):\n", | ||
" query_id: Union[str, None] = Field(None, description=\"The server id of the query\")\n", | ||
" status: str = Field(False, description=\"The status of the query (`PENDING`, `FINISHED`, `ERROR`)\")\n", | ||
" columns: Union[List[str], None] = Field(None, description=\"The names of the columns in the result set\")\n", | ||
" column_types: Union[List[str], None] = Field(None, description=\"The type of the columns in the result set\")\n", | ||
" rows: Union[List[Any], None] = Field(None, description=\"The results of the query\")\n", | ||
" run_stats: Union[QueryRunStats, None] = Field(\n", | ||
" None,\n", | ||
" description=\"Summary stats on the query run (i.e. the number of rows returned, the elapsed time, etc)\",\n", | ||
" )\n", | ||
" records: Union[List[Any], None] = Field(None, description=\"The results of the query transformed as an array of objects\")\n", | ||
" error: Any\n", | ||
"\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"## Explore the result set object\n", | ||
"\n", | ||
"records = query_result_set.records\n", | ||
"\n", | ||
"print(records[0])" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.10.1 64-bit", | ||
"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.1" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "949777d72b0d2535278d3dc13498b2535136f6dfe0678499012e853ee9abcab1" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.