diff --git a/credentials.json b/credentials.json new file mode 100644 index 0000000..0e0bec7 --- /dev/null +++ b/credentials.json @@ -0,0 +1,4 @@ +{ + "username":"db_user", + "password":"db_pass" +} \ No newline at end of file diff --git a/diabetes_redsamurai_db.ipynb b/diabetes_redsamurai_db.ipynb new file mode 100644 index 0000000..e3f3d58 --- /dev/null +++ b/diabetes_redsamurai_db.ipynb @@ -0,0 +1,270 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import cx_Oracle\n", + "\n", + "%load_ext sql" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'Connected: hr@'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with open('credentials.json') as f:\n", + " data = json.load(f)\n", + " username = data['username']\n", + " password = data['password']\n", + "\n", + "%sql oracle+cx_oracle://$username:$password@dbhost:1521/?service_name=ORCLPDB1.localdomain" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " * oracle+cx_oracle://hr:***@dbhost:1521/?service_name=ORCLPDB1.localdomain\n", + "0 rows affected.\n", + "Returning data to local variable result\n" + ] + } + ], + "source": [ + "%%sql result <<\n", + "select TIMES_PREGNANT \"TIMES_PREGNANT\", GLUCOSE \"GLUCOSE\", BLOOD_PRESSURE \"BLOOD_PRESSURE\", SKIN_FOLD_THICK \"SKIN_FOLD_THICK\",\n", + " SERUM_INSULIN \"SERUM_INSULING\", MASS_INDEX \"MASS_INDEX\", DIABETES_PEDIGREE \"DIABETES_PEDIGREE\", \n", + " AGE \"AGE\", CLASS_VAR \"CLASS_VAR\" from PIMA_INDIANS_DIABETES" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | times_pregnant | \n", + "glucose | \n", + "blood_pressure | \n", + "skin_fold_thick | \n", + "serum_insuling | \n", + "mass_index | \n", + "diabetes_pedigree | \n", + "age | \n", + "class_var | \n", + "
---|---|---|---|---|---|---|---|---|---|
0 | \n", + "1 | \n", + "106 | \n", + "70 | \n", + "28 | \n", + "135 | \n", + "34.2 | \n", + "0.142 | \n", + "22 | \n", + "0 | \n", + "
1 | \n", + "2 | \n", + "155 | \n", + "52 | \n", + "27 | \n", + "540 | \n", + "38.7 | \n", + "0.24 | \n", + "25 | \n", + "1 | \n", + "
2 | \n", + "2 | \n", + "101 | \n", + "58 | \n", + "35 | \n", + "90 | \n", + "21.8 | \n", + "0.155 | \n", + "22 | \n", + "0 | \n", + "
3 | \n", + "1 | \n", + "120 | \n", + "80 | \n", + "48 | \n", + "200 | \n", + "38.9 | \n", + "1.162 | \n", + "41 | \n", + "0 | \n", + "
4 | \n", + "11 | \n", + "127 | \n", + "106 | \n", + "0 | \n", + "0 | \n", + "39 | \n", + "0.19 | \n", + "51 | \n", + "0 | \n", + "