Last active
May 28, 2018 18:54
-
-
Save satybald/ee97e1ab4c14f38312340ae70904b44c to your computer and use it in GitHub Desktop.
Revisions
-
satybald renamed this gist
May 28, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
satybald renamed this gist
May 26, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
satybald revised this gist
May 26, 2018 . No changes.There are no files selected for viewing
-
satybald created this gist
May 26, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,118 @@ { "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>node_id</th>\n", " <th>query_id</th>\n", " <th>state</th>\n", " <th>user</th>\n", " <th>source</th>\n", " <th>query</th>\n", " <th>queued_time_ms</th>\n", " <th>analysis_time_ms</th>\n", " <th>distributed_planning_time_ms</th>\n", " <th>created</th>\n", " <th>started</th>\n", " <th>last_heartbeat</th>\n", " <th>end</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>ffffffff-ffff-ffff-ffff-ffffffffffff</td>\n", " <td>20180526_115416_00010_nwiis</td>\n", " <td>RUNNING</td>\n", " <td>satybald</td>\n", " <td>pyhive</td>\n", " <td>select * from queries limit 1</td>\n", " <td>1</td>\n", " <td>17</td>\n", " <td>0</td>\n", " <td>2018-05-26 13:54:16.654</td>\n", " <td>2018-05-26 13:54:16.675</td>\n", " <td>2018-05-26 13:54:16.656</td>\n", " <td>None</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " node_id query_id state \\\n", "0 ffffffff-ffff-ffff-ffff-ffffffffffff 20180526_115416_00010_nwiis RUNNING \n", "\n", " user source query queued_time_ms \\\n", "0 satybald pyhive select * from queries limit 1 1 \n", "\n", " analysis_time_ms distributed_planning_time_ms created \\\n", "0 17 0 2018-05-26 13:54:16.654 \n", "\n", " started last_heartbeat end \n", "0 2018-05-26 13:54:16.675 2018-05-26 13:54:16.656 None " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "from sqlalchemy.engine import create_engine\n", "\n", "# Presto\n", "engine = create_engine('presto://localhost:8080/system/runtime') \n", "\n", "#Read Presto Data query into a DataFrame\n", "df = pd.read_sql('select * from queries limit 1', engine)\n", "df.head()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.12" } }, "nbformat": 4, "nbformat_minor": 2 }