Skip to content

Instantly share code, notes, and snippets.

@Lahannin
Last active March 11, 2022 10:18
Show Gist options
  • Save Lahannin/4cd26ad49d9999437864a18e5aa3e933 to your computer and use it in GitHub Desktop.
Save Lahannin/4cd26ad49d9999437864a18e5aa3e933 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "a4d70b4f",
"metadata": {},
"outputs": [],
"source": [
"# Install required modules\n",
"import sys\n",
"!{sys.executable} -m pip install ipython-sql"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "281ad67c",
"metadata": {},
"outputs": [],
"source": [
"%load_ext sql\n",
"%sql postgresql://gooddata:gooddata123@localhost:2543/gooddata"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "c625142a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" * postgresql://gooddata:***@localhost:2543/gooddata\n",
"5 rows affected.\n",
"+------------------+-----------+\n",
"| customers_region | revenue |\n",
"+------------------+-----------+\n",
"| Midwest | 88967.05 |\n",
"| Northeast | 51163.35 |\n",
"| South | 203868.55 |\n",
"| Unknown | 18.70 |\n",
"| West | 119397.28 |\n",
"+------------------+-----------+\n"
]
}
],
"source": [
"demo_data = %sql SELECT customers_region, revenue FROM demo.compute;\n",
"print(demo_data)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment