Skip to content

Commit

Permalink
update readme links and sql example
Browse files Browse the repository at this point in the history
  • Loading branch information
doncote committed May 16, 2024
1 parent 8b98a4b commit d1393c6
Show file tree
Hide file tree
Showing 4 changed files with 423 additions and 419 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Flipside Crypto's Analytics Team has curated dozens of blockchain data sets with

## 🗝 Want access? Genrate an API Key for Free

Get your [free API key here](https://flipsidecrypto.xyz/account/api-keys)
Get your [free API key here](https://flipsidecrypto.xyz/api-keys)
<br>

## SDKs
Expand Down
246 changes: 123 additions & 123 deletions examples/python/notebooks/intro.ipynb
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
}
Loading

0 comments on commit d1393c6

Please sign in to comment.