slurm-2sql.ipynb 1.45 KB
Newer Older
1
2
3
4
{
 "cells": [
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
5
   "execution_count": null,
6
7
8
9
10
11
12
13
14
15
   "metadata": {},
   "outputs": [],
   "source": [
    "import sqlite3\n",
    "import slurm2sql\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
16
   "execution_count": null,
17
   "metadata": {},
William Monroe's avatar
William Monroe committed
18
   "outputs": [],
19
20
21
22
23
24
25
   "source": [
    "db = sqlite3.connect('test.db')\n",
    "slurm2sql.slurm2sql(db, ['-S', '2020-03-18', '-a'])"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
26
   "execution_count": null,
27
28
29
30
31
32
33
34
35
   "metadata": {},
   "outputs": [],
   "source": [
    "# For example, you can then convert to a dataframe:\n",
    "df1 = pd.read_sql('SELECT * FROM slurm', db)"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
36
   "execution_count": null,
37
   "metadata": {},
William Monroe's avatar
William Monroe committed
38
   "outputs": [],
39
40
41
42
   "source": [
    "df1.head(5)"
   ]
  },
William Monroe's avatar
William Monroe committed
43
44
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
45
   "execution_count": null,
William Monroe's avatar
William Monroe committed
46
   "metadata": {},
William Monroe's avatar
William Monroe committed
47
   "outputs": [],
William Monroe's avatar
William Monroe committed
48
49
50
51
   "source": [
    "print(\"more plots to come\")"
   ]
  },
52
53
54
55
56
57
58
59
60
61
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
William Monroe's avatar
William Monroe committed
62
   "display_name": "Python 3",
63
   "language": "python",
William Monroe's avatar
William Monroe committed
64
   "name": "python3"
65
66
67
68
69
70
71
72
73
74
75
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
William Monroe's avatar
William Monroe committed
76
   "version": "3.7.5"
77
78
79
80
81
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}