From d4572cb42202bdda1cc446269c2a9ae8da6f7596 Mon Sep 17 00:00:00 2001 From: rahulkumar Date: Thu, 18 Jan 2024 16:12:35 -0800 Subject: [PATCH 1/2] Fix notebook for latest Trino connector release --- notebooks/presto/AerospikePrestoDemo.ipynb | 114 ++++++++++++++++----- 1 file changed, 88 insertions(+), 26 deletions(-) diff --git a/notebooks/presto/AerospikePrestoDemo.ipynb b/notebooks/presto/AerospikePrestoDemo.ipynb index 38cf5a8..a92a830 100644 --- a/notebooks/presto/AerospikePrestoDemo.ipynb +++ b/notebooks/presto/AerospikePrestoDemo.ipynb @@ -5,70 +5,139 @@ "metadata": {}, "source": [ "## Aerospike Connect for Presto Tutorial for Python\n", - "## Tested with Python 3.7, Java 11, Presto 343, Presto Connector (Beta), and PyHive 0.6.3" + "## Tested with Python 3.10.6, Java 17.0.5, Trino 435, Aerospike Trino Connector 4.5.0-431, and PyHive 0.18.3" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pip3 install pyhive\n", + "!pip3 install requests" + ] + }, + { + "cell_type": "code", + "execution_count": 60, "metadata": {}, "outputs": [], "source": [ "from pyhive import presto\n", + "import requests\n", + "from requests.auth import HTTPBasicAuth\n", "presto_conn = presto.connect(\n", " host='localhost',\n", " port=8080,\n", + " username='admin',\n", " catalog='aerospike',\n", - " schema='test'\n", + " schema='test',\n", + " requests_kwargs={\n", + " 'auth': HTTPBasicAuth('admin', '')\n", + " }\n", ")\n", "presto_cursor=presto_conn.cursor()" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Following examples assumes that data was created using accompanying python notebook." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Print infered schema of table `write_set`" + ] + }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('__key', 'varchar', '', '')\n", + "('name', 'varchar', '', '')\n", + "('id', 'bigint', '', '')\n", + "('salary', 'bigint', '', '')\n", + "('age', 'double', '', '')\n" + ] + } + ], + "source": [ + "query = \"DESCRIBE aerospike.test.write_set\"\n", + "presto_cursor.execute(query)\n", + "\n", + "# Fetch all the results\n", + "descriptions = presto_cursor.fetchall()\n", + "\n", + "# Print the descriptions\n", + "for col in descriptions:\n", + " print(col)\n" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "presto_cursor.execute('SELECT * FROM test.write_set LIMIT 3')" + "### Print all records of the table `write_set`" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 72, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "(234, 'Individual: 234', 33.568431516802406, 66363)\n", - "(13, 'Individual: 013', 25.752921531369164, 48610)\n", - "(79, 'Individual: 079', 25.16109674428971, 60357)\n" + "(None, 'Individual: 237', 237, 61928, 35.40459945502513)\n", + "(None, 'Individual: 145', 145, 81405, 45.02808010201396)\n", + "(None, 'Individual: 022', 22, 43865, 26.69338780386945)\n" ] } ], "source": [ + "presto_cursor.execute('SELECT * FROM aerospike.test.write_set LIMIT 3')\n", "records = presto_cursor.fetchall()\n", "for row in records:\n", " print(row)" ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "presto_cursor.execute('select name from test.write_set where age>40 and age<45')" + "### Extract records of the table `write_set` by applying filters on the column `age`" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 76, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('Individual: 176',)\n", + "('Individual: 153',)\n", + "('Individual: 111',)\n", + "('Individual: 118',)\n", + "('Individual: 151',)\n" + ] + } + ], "source": [ + "presto_cursor.execute('select name from aerospike.test.write_set where age>40 and age<45 limit 5')\n", "records1 = presto_cursor.fetchall()\n", "for row in records1:\n", " print(row)" @@ -78,20 +147,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Refer to https://www.aerospike.com/docs/connect/access/presto/examples.html for more examples." + "### Refer to https://aerospike.com/docs/connect/trino/examples for more examples." ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -105,7 +167,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.5" + "version": "3.10.6" } }, "nbformat": 4, From 2dfd24dfc5c12fe54b3d51bfc23c72afb208ecbe Mon Sep 17 00:00:00 2001 From: rahulkumar Date: Mon, 22 Jan 2024 11:44:40 -0800 Subject: [PATCH 2/2] Removed Trino notebooks --- notebooks/presto/AerospikePrestoDemo.ipynb | 175 ----- notebooks/presto/AerospikePython.ipynb | 840 --------------------- 2 files changed, 1015 deletions(-) delete mode 100644 notebooks/presto/AerospikePrestoDemo.ipynb delete mode 100644 notebooks/presto/AerospikePython.ipynb diff --git a/notebooks/presto/AerospikePrestoDemo.ipynb b/notebooks/presto/AerospikePrestoDemo.ipynb deleted file mode 100644 index a92a830..0000000 --- a/notebooks/presto/AerospikePrestoDemo.ipynb +++ /dev/null @@ -1,175 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Aerospike Connect for Presto Tutorial for Python\n", - "## Tested with Python 3.10.6, Java 17.0.5, Trino 435, Aerospike Trino Connector 4.5.0-431, and PyHive 0.18.3" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip3 install pyhive\n", - "!pip3 install requests" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "metadata": {}, - "outputs": [], - "source": [ - "from pyhive import presto\n", - "import requests\n", - "from requests.auth import HTTPBasicAuth\n", - "presto_conn = presto.connect(\n", - " host='localhost',\n", - " port=8080,\n", - " username='admin',\n", - " catalog='aerospike',\n", - " schema='test',\n", - " requests_kwargs={\n", - " 'auth': HTTPBasicAuth('admin', '')\n", - " }\n", - ")\n", - "presto_cursor=presto_conn.cursor()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Following examples assumes that data was created using accompanying python notebook." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Print infered schema of table `write_set`" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('__key', 'varchar', '', '')\n", - "('name', 'varchar', '', '')\n", - "('id', 'bigint', '', '')\n", - "('salary', 'bigint', '', '')\n", - "('age', 'double', '', '')\n" - ] - } - ], - "source": [ - "query = \"DESCRIBE aerospike.test.write_set\"\n", - "presto_cursor.execute(query)\n", - "\n", - "# Fetch all the results\n", - "descriptions = presto_cursor.fetchall()\n", - "\n", - "# Print the descriptions\n", - "for col in descriptions:\n", - " print(col)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Print all records of the table `write_set`" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(None, 'Individual: 237', 237, 61928, 35.40459945502513)\n", - "(None, 'Individual: 145', 145, 81405, 45.02808010201396)\n", - "(None, 'Individual: 022', 22, 43865, 26.69338780386945)\n" - ] - } - ], - "source": [ - "presto_cursor.execute('SELECT * FROM aerospike.test.write_set LIMIT 3')\n", - "records = presto_cursor.fetchall()\n", - "for row in records:\n", - " print(row)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Extract records of the table `write_set` by applying filters on the column `age`" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('Individual: 176',)\n", - "('Individual: 153',)\n", - "('Individual: 111',)\n", - "('Individual: 118',)\n", - "('Individual: 151',)\n" - ] - } - ], - "source": [ - "presto_cursor.execute('select name from aerospike.test.write_set where age>40 and age<45 limit 5')\n", - "records1 = presto_cursor.fetchall()\n", - "for row in records1:\n", - " print(row)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Refer to https://aerospike.com/docs/connect/trino/examples for more examples." - ] - } - ], - "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.10.6" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/notebooks/presto/AerospikePython.ipynb b/notebooks/presto/AerospikePython.ipynb deleted file mode 100644 index 207b436..0000000 --- a/notebooks/presto/AerospikePython.ipynb +++ /dev/null @@ -1,840 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Aerospike Python Client Tutorial \n", - "### Refer to https://www.aerospike.com/docs/client/python/index.html for information on installing the Aerospike Python client.\n", - "#### Tested with Python 3.7\n" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "# IP Address or DNS name for one host in your Aerospike cluster\n", - "AS_HOST =\"127.0.0.1\"\n", - "\n", - "# Please reach out to us if you do not have a feature key\n", - "AS_FEATURE_KEY_PATH = \"/etc/aerospike/features.conf\"\n", - "\n", - "AS_PORT = 3000 # Usually 3000, but change here if not" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "import aerospike" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Create Sample Data and load it into Aerospike" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Data created\n" - ] - } - ], - "source": [ - "# We create age vs salary data, using three different Gaussian distributions\n", - "import numpy as np\n", - "import pandas as pd\n", - "import math\n", - "\n", - "# Create covariance matrix from std devs + correlation\n", - "def covariance_matrix(std_dev_1,std_dev_2,correlation):\n", - " return [[std_dev_1 ** 2, correlation * std_dev_1 * std_dev_2], \n", - " [correlation * std_dev_1 * std_dev_2, std_dev_2 ** 2]]\n", - "\n", - "# Return a bivariate sample given means/std dev/correlation\n", - "def age_salary_sample(distribution_params,sample_size):\n", - " mean = [distribution_params[\"age_mean\"], distribution_params[\"salary_mean\"]]\n", - " cov = covariance_matrix(distribution_params[\"age_std_dev\"],distribution_params[\"salary_std_dev\"],\n", - " distribution_params[\"age_salary_correlation\"])\n", - " return np.random.multivariate_normal(mean, cov, sample_size).T\n", - "\n", - "# Define the characteristics of our age/salary distribution\n", - "age_salary_distribution_1 = {\"age_mean\":25,\"salary_mean\":50000,\n", - " \"age_std_dev\":1,\"salary_std_dev\":5000,\"age_salary_correlation\":0.3}\n", - "\n", - "age_salary_distribution_2 = {\"age_mean\":45,\"salary_mean\":80000,\n", - " \"age_std_dev\":4,\"salary_std_dev\":10000,\"age_salary_correlation\":0.7}\n", - "\n", - "age_salary_distribution_3 = {\"age_mean\":35,\"salary_mean\":70000,\n", - " \"age_std_dev\":2,\"salary_std_dev\":9000,\"age_salary_correlation\":0.1}\n", - "\n", - "distribution_data = [age_salary_distribution_1,age_salary_distribution_2,age_salary_distribution_3]\n", - "\n", - "# Sample age/salary data for each distributions\n", - "group_1_ages,group_1_salaries = age_salary_sample(age_salary_distribution_1,sample_size=100)\n", - "group_2_ages,group_2_salaries = age_salary_sample(age_salary_distribution_2,sample_size=120)\n", - "group_3_ages,group_3_salaries = age_salary_sample(age_salary_distribution_3,sample_size=80)\n", - "\n", - "ages=np.concatenate([group_1_ages,group_2_ages,group_3_ages])\n", - "salaries=np.concatenate([group_1_salaries,group_2_salaries,group_3_salaries])\n", - "\n", - "print(\"Data created\")" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(1, 'Individual: 001', 24.304499333848025, 46865)\n", - "(2, 'Individual: 002', 25.127370725646376, 58731)\n", - "(3, 'Individual: 003', 24.433587308486384, 39822)\n", - "(4, 'Individual: 004', 23.466317614770414, 46800)\n", - "(5, 'Individual: 005', 25.901554554617075, 44622)\n", - "(6, 'Individual: 006', 25.244089945979592, 48962)\n", - "(7, 'Individual: 007', 25.513546531713885, 54015)\n", - "(8, 'Individual: 008', 24.384542542073284, 48850)\n", - "(9, 'Individual: 009', 23.969228059245417, 49939)\n", - "(10, 'Individual: 010', 25.32659498864832, 52270)\n", - "(11, 'Individual: 011', 24.52188955913116, 56682)\n", - "(12, 'Individual: 012', 25.307831842818935, 48937)\n", - "(13, 'Individual: 013', 25.25646020804283, 54880)\n", - "(14, 'Individual: 014', 25.678511730398245, 50121)\n", - "(15, 'Individual: 015', 24.05942103892467, 60348)\n", - "(16, 'Individual: 016', 25.749046404565952, 53522)\n", - "(17, 'Individual: 017', 22.897339115317486, 41738)\n", - "(18, 'Individual: 018', 25.85659550137486, 51606)\n", - "(19, 'Individual: 019', 25.344785148917193, 47040)\n", - "(20, 'Individual: 020', 23.821932401631045, 51202)\n", - "(21, 'Individual: 021', 25.525114369502592, 48633)\n", - "(22, 'Individual: 022', 24.02621230558812, 51414)\n", - "(23, 'Individual: 023', 25.36660236909869, 53445)\n", - "(24, 'Individual: 024', 26.166761584649567, 59844)\n", - "(25, 'Individual: 025', 24.925568239677723, 55420)\n", - "(26, 'Individual: 026', 25.334241438007734, 52286)\n", - "(27, 'Individual: 027', 24.35634257798389, 47127)\n", - "(28, 'Individual: 028', 24.379764011709945, 43354)\n", - "(29, 'Individual: 029', 25.970751080494217, 58479)\n", - "(30, 'Individual: 030', 23.031631668580637, 61643)\n", - "(31, 'Individual: 031', 25.486396662028405, 46286)\n", - "(32, 'Individual: 032', 25.02768193636628, 47781)\n", - "(33, 'Individual: 033', 24.702078982456936, 46787)\n", - "(34, 'Individual: 034', 23.622632894752655, 41763)\n", - "(35, 'Individual: 035', 25.18245840193072, 44396)\n", - "(36, 'Individual: 036', 24.327072736740977, 37789)\n", - "(37, 'Individual: 037', 27.179832440998133, 55226)\n", - "(38, 'Individual: 038', 24.416278669685425, 48327)\n", - "(39, 'Individual: 039', 25.45717123985681, 51153)\n", - "(40, 'Individual: 040', 25.950506439788757, 53308)\n", - "(41, 'Individual: 041', 25.05222521590697, 52994)\n", - "(42, 'Individual: 042', 24.522624339544254, 45892)\n", - "(43, 'Individual: 043', 25.865077973388786, 47073)\n", - "(44, 'Individual: 044', 25.125544636768744, 43031)\n", - "(45, 'Individual: 045', 25.475983736889532, 54665)\n", - "(46, 'Individual: 046', 23.9603502068871, 51321)\n", - "(47, 'Individual: 047', 25.088279119759616, 50190)\n", - "(48, 'Individual: 048', 24.40922247819197, 49816)\n", - "(49, 'Individual: 049', 25.728646404457788, 49272)\n", - "(50, 'Individual: 050', 25.590778965014902, 44507)\n", - "(51, 'Individual: 051', 24.165785224719208, 50863)\n", - "(52, 'Individual: 052', 25.02524070590101, 45812)\n", - "(53, 'Individual: 053', 25.90688832187065, 50855)\n", - "(54, 'Individual: 054', 25.405612867685388, 50310)\n", - "(55, 'Individual: 055', 27.106849920099684, 58744)\n", - "(56, 'Individual: 056', 24.884981714203818, 47770)\n", - "(57, 'Individual: 057', 22.569035802223326, 53649)\n", - "(58, 'Individual: 058', 24.589150886413034, 41339)\n", - "(59, 'Individual: 059', 23.116363143771242, 54119)\n", - "(60, 'Individual: 060', 25.614449536992023, 47725)\n", - "(61, 'Individual: 061', 23.818011583570772, 50631)\n", - "(62, 'Individual: 062', 25.754418810189147, 46127)\n", - "(63, 'Individual: 063', 23.37159754146576, 42471)\n", - "(64, 'Individual: 064', 24.63858826707661, 47517)\n", - "(65, 'Individual: 065', 24.95043220241014, 49399)\n", - "(66, 'Individual: 066', 25.825723002809923, 47980)\n", - "(67, 'Individual: 067', 25.38116525590079, 47765)\n", - "(68, 'Individual: 068', 25.95619174147496, 50509)\n", - "(69, 'Individual: 069', 24.134908997669214, 51007)\n", - "(70, 'Individual: 070', 26.5048906027763, 54763)\n", - "(71, 'Individual: 071', 25.478989329342994, 48621)\n", - "(72, 'Individual: 072', 26.45845682526833, 53003)\n", - "(73, 'Individual: 073', 25.662969000311413, 45049)\n", - "(74, 'Individual: 074', 26.481196564890848, 53655)\n", - "(75, 'Individual: 075', 25.482834202787874, 55909)\n", - "(76, 'Individual: 076', 25.47922452340438, 54586)\n", - "(77, 'Individual: 077', 25.539193902306028, 54423)\n", - "(78, 'Individual: 078', 23.989370434750832, 56504)\n", - "(79, 'Individual: 079', 24.800464625800352, 49653)\n", - "(80, 'Individual: 080', 25.91745073089148, 55976)\n", - "(81, 'Individual: 081', 25.28589587554696, 50595)\n", - "(82, 'Individual: 082', 24.553207779806538, 53757)\n", - "(83, 'Individual: 083', 24.122386931080346, 51192)\n", - "(84, 'Individual: 084', 25.835178277596235, 49336)\n", - "(85, 'Individual: 085', 26.557708567837512, 49848)\n", - "(86, 'Individual: 086', 26.328168407167418, 50899)\n", - "(87, 'Individual: 087', 25.303875652836627, 49636)\n", - "(88, 'Individual: 088', 24.61552848462999, 50013)\n", - "(89, 'Individual: 089', 24.98829084149272, 51337)\n", - "(90, 'Individual: 090', 25.980273061379584, 48970)\n", - "(91, 'Individual: 091', 24.982495965765835, 36760)\n", - "(92, 'Individual: 092', 27.470143507806128, 58199)\n", - "(93, 'Individual: 093', 25.070253849853316, 44874)\n", - "(94, 'Individual: 094', 25.562313973520876, 56027)\n", - "(95, 'Individual: 095', 26.455271228221175, 51132)\n", - "(96, 'Individual: 096', 23.299087097690666, 50492)\n", - "(97, 'Individual: 097', 23.44473007409865, 46982)\n", - "(98, 'Individual: 098', 23.422271690705045, 52086)\n", - "(99, 'Individual: 099', 25.227519479773093, 46926)\n", - "(100, 'Individual: 100', 23.82188149499848, 47263)\n", - "(101, 'Individual: 101', 47.404260544110684, 82062)\n", - "(102, 'Individual: 102', 48.849100622901396, 90226)\n", - "(103, 'Individual: 103', 42.31913479741497, 83705)\n", - "(104, 'Individual: 104', 39.87179613706066, 74468)\n", - "(105, 'Individual: 105', 37.031880002591414, 60062)\n", - "(106, 'Individual: 106', 39.8639387073848, 56646)\n", - "(107, 'Individual: 107', 48.97468539060065, 89025)\n", - "(108, 'Individual: 108', 41.06202707700086, 79817)\n", - "(109, 'Individual: 109', 48.85965925586444, 75993)\n", - "(110, 'Individual: 110', 41.7052261810714, 80825)\n", - "(111, 'Individual: 111', 46.44624550330593, 93133)\n", - "(112, 'Individual: 112', 46.6970215394055, 73495)\n", - "(113, 'Individual: 113', 48.43076474144459, 98342)\n", - "(114, 'Individual: 114', 42.98301425090402, 76492)\n", - "(115, 'Individual: 115', 46.71721186607902, 87529)\n", - "(116, 'Individual: 116', 42.655728930073906, 74896)\n", - "(117, 'Individual: 117', 46.111502884684946, 88516)\n", - "(118, 'Individual: 118', 51.527792759430284, 85514)\n", - "(119, 'Individual: 119', 49.59727417914037, 94416)\n", - "(120, 'Individual: 120', 51.00041690623652, 104275)\n", - "(121, 'Individual: 121', 46.68990901522216, 83431)\n", - "(122, 'Individual: 122', 45.39539596410638, 80706)\n", - "(123, 'Individual: 123', 40.92895589491278, 76339)\n", - "(124, 'Individual: 124', 44.856459604428096, 80049)\n", - "(125, 'Individual: 125', 46.27904686514323, 82443)\n", - "(126, 'Individual: 126', 48.295284178221415, 83460)\n", - "(127, 'Individual: 127', 41.740363945016874, 80123)\n", - "(128, 'Individual: 128', 37.44332752423415, 67809)\n", - "(129, 'Individual: 129', 39.99378985151627, 79658)\n", - "(130, 'Individual: 130', 42.96677899515424, 78229)\n", - "(131, 'Individual: 131', 47.97306089837442, 83574)\n", - "(132, 'Individual: 132', 41.20898424443146, 67627)\n", - "(133, 'Individual: 133', 43.84910252640341, 91616)\n", - "(134, 'Individual: 134', 45.63161191521578, 76677)\n", - "(135, 'Individual: 135', 42.305646588838755, 75264)\n", - "(136, 'Individual: 136', 48.5952394745472, 71680)\n", - "(137, 'Individual: 137', 37.17352544608759, 68649)\n", - "(138, 'Individual: 138', 47.046044205253075, 68082)\n", - "(139, 'Individual: 139', 44.059713310749146, 82409)\n", - "(140, 'Individual: 140', 53.15257619942137, 95877)\n", - "(141, 'Individual: 141', 47.28787601265288, 80766)\n", - "(142, 'Individual: 142', 43.38128213023818, 87329)\n", - "(143, 'Individual: 143', 42.67995234013793, 71068)\n", - "(144, 'Individual: 144', 49.23052084465668, 81845)\n", - "(145, 'Individual: 145', 50.346481154337745, 90087)\n", - "(146, 'Individual: 146', 44.23402694194281, 79914)\n", - "(147, 'Individual: 147', 38.79429200311992, 70207)\n", - "(148, 'Individual: 148', 51.2116534948333, 103244)\n", - "(149, 'Individual: 149', 45.923965459314836, 82734)\n", - "(150, 'Individual: 150', 37.249816617139075, 65909)\n", - "(151, 'Individual: 151', 41.25864750495034, 66558)\n", - "(152, 'Individual: 152', 51.52587422238312, 106517)\n", - "(153, 'Individual: 153', 51.46802220962631, 104710)\n", - "(154, 'Individual: 154', 43.94384193393332, 75919)\n", - "(155, 'Individual: 155', 45.894811591634046, 71604)\n", - "(156, 'Individual: 156', 43.3094508543472, 76633)\n", - "(157, 'Individual: 157', 39.82288146636257, 67429)\n", - "(158, 'Individual: 158', 44.53925052093046, 83026)\n", - "(159, 'Individual: 159', 40.886890271237384, 85154)\n", - "(160, 'Individual: 160', 43.34937134219747, 74508)\n", - "(161, 'Individual: 161', 39.91213416083551, 72150)\n", - "(162, 'Individual: 162', 40.1983742007039, 78190)\n", - "(163, 'Individual: 163', 48.59743926272466, 83810)\n", - "(164, 'Individual: 164', 49.74750897777976, 88221)\n", - "(165, 'Individual: 165', 42.64654504779174, 84672)\n", - "(166, 'Individual: 166', 44.08353196544536, 77033)\n", - "(167, 'Individual: 167', 41.78255031764483, 73958)\n", - "(168, 'Individual: 168', 45.565399233578255, 75090)\n", - "(169, 'Individual: 169', 46.58272067939971, 80429)\n", - "(170, 'Individual: 170', 37.990972449367014, 64231)\n", - "(171, 'Individual: 171', 51.762118675058, 96494)\n", - "(172, 'Individual: 172', 49.91682043235008, 84609)\n", - "(173, 'Individual: 173', 45.44707997576431, 97364)\n", - "(174, 'Individual: 174', 39.78502260722891, 78780)\n", - "(175, 'Individual: 175', 40.03544489547708, 63982)\n", - "(176, 'Individual: 176', 39.690632810450666, 65359)\n", - "(177, 'Individual: 177', 44.81147179979179, 75839)\n", - "(178, 'Individual: 178', 47.786369924013016, 86580)\n", - "(179, 'Individual: 179', 45.63895593966375, 72824)\n", - "(180, 'Individual: 180', 46.40039832139477, 76674)\n", - "(181, 'Individual: 181', 43.31651119630133, 71132)\n", - "(182, 'Individual: 182', 44.913021362797785, 76118)\n", - "(183, 'Individual: 183', 44.13938318645851, 72143)\n", - "(184, 'Individual: 184', 50.16856442303606, 80257)\n", - "(185, 'Individual: 185', 44.52649645673774, 84435)\n", - "(186, 'Individual: 186', 42.947161065614196, 86515)\n", - "(187, 'Individual: 187', 47.92662555968543, 79512)\n", - "(188, 'Individual: 188', 42.64400488098836, 79399)\n", - "(189, 'Individual: 189', 47.40312098170525, 92675)\n", - "(190, 'Individual: 190', 41.278325511626974, 79549)\n", - "(191, 'Individual: 191', 43.43670854151717, 85657)\n", - "(192, 'Individual: 192', 44.42223653677814, 82829)\n", - "(193, 'Individual: 193', 48.683988661266106, 86467)\n", - "(194, 'Individual: 194', 45.317860747588064, 88749)\n", - "(195, 'Individual: 195', 48.12115808026187, 92202)\n", - "(196, 'Individual: 196', 48.57820489670735, 89582)\n", - "(197, 'Individual: 197', 43.01459861321762, 73901)\n", - "(198, 'Individual: 198', 41.163018056152254, 72652)\n", - "(199, 'Individual: 199', 34.94686274746908, 70491)\n", - "(200, 'Individual: 200', 39.74676175751297, 64654)\n", - "(201, 'Individual: 201', 43.913325570472814, 81504)\n", - "(202, 'Individual: 202', 42.547322585189264, 72385)\n", - "(203, 'Individual: 203', 42.100452884122454, 84812)\n", - "(204, 'Individual: 204', 41.315747999514706, 74993)\n", - "(205, 'Individual: 205', 37.51011020514996, 62669)\n", - "(206, 'Individual: 206', 45.08505107169978, 71041)\n", - "(207, 'Individual: 207', 47.07237294656676, 78040)\n", - "(208, 'Individual: 208', 53.04300243980572, 93545)\n", - "(209, 'Individual: 209', 43.834138926602165, 80655)\n", - "(210, 'Individual: 210', 46.57266322319943, 83954)\n", - "(211, 'Individual: 211', 51.230543557510124, 87634)\n", - "(212, 'Individual: 212', 42.0916637238154, 81780)\n", - "(213, 'Individual: 213', 39.519153267968804, 73012)\n", - "(214, 'Individual: 214', 49.040618242819995, 82095)\n", - "(215, 'Individual: 215', 45.31639363800543, 67403)\n", - "(216, 'Individual: 216', 38.031124335313564, 63788)\n", - "(217, 'Individual: 217', 47.9486014075113, 97173)\n", - "(218, 'Individual: 218', 48.206343312418724, 94927)\n", - "(219, 'Individual: 219', 47.32489231572965, 91604)\n", - "(220, 'Individual: 220', 46.11413770197612, 83922)\n", - "(221, 'Individual: 221', 35.301029437081255, 63627)\n", - "(222, 'Individual: 222', 35.03898881686214, 80083)\n", - "(223, 'Individual: 223', 35.00543659376893, 67421)\n", - "(224, 'Individual: 224', 38.268952445865935, 60153)\n", - "(225, 'Individual: 225', 33.91228381267188, 77378)\n", - "(226, 'Individual: 226', 38.34715952661958, 81699)\n", - "(227, 'Individual: 227', 35.5925322009585, 72465)\n", - "(228, 'Individual: 228', 34.58190977648209, 66225)\n", - "(229, 'Individual: 229', 37.68327548633769, 57314)\n", - "(230, 'Individual: 230', 36.122309523791834, 61779)\n", - "(231, 'Individual: 231', 36.10591686948013, 72038)\n", - "(232, 'Individual: 232', 32.353142028555105, 59520)\n", - "(233, 'Individual: 233', 35.68739011715068, 62823)\n", - "(234, 'Individual: 234', 36.484734910946614, 76148)\n", - "(235, 'Individual: 235', 34.24028050138242, 58137)\n", - "(236, 'Individual: 236', 36.801147645813295, 72684)\n", - "(237, 'Individual: 237', 33.975592395697944, 57193)\n", - "(238, 'Individual: 238', 35.5605656556073, 70458)\n", - "(239, 'Individual: 239', 34.6678889493235, 60965)\n", - "(240, 'Individual: 240', 35.58708372147991, 69205)\n", - "(241, 'Individual: 241', 34.10157722658814, 78920)\n", - "(242, 'Individual: 242', 36.726078511475194, 68470)\n", - "(243, 'Individual: 243', 37.98447063843578, 67520)\n", - "(244, 'Individual: 244', 36.09322432884619, 81141)\n", - "(245, 'Individual: 245', 35.41275007057748, 69158)\n", - "(246, 'Individual: 246', 36.928169946714966, 80274)\n", - "(247, 'Individual: 247', 34.70038001570242, 59869)\n", - "(248, 'Individual: 248', 33.95626263510884, 63166)\n", - "(249, 'Individual: 249', 35.78452940295166, 80699)\n", - "(250, 'Individual: 250', 34.44030127185523, 74023)\n", - "(251, 'Individual: 251', 35.13065446046275, 66182)\n", - "(252, 'Individual: 252', 33.74986844534237, 66092)\n", - "(253, 'Individual: 253', 32.643617710867694, 73349)\n", - "(254, 'Individual: 254', 33.821388333447395, 74649)\n", - "(255, 'Individual: 255', 36.82656956578252, 81205)\n", - "(256, 'Individual: 256', 35.314719715442386, 67400)\n", - "(257, 'Individual: 257', 36.87761625420699, 66684)\n", - "(258, 'Individual: 258', 34.39754679419078, 68244)\n", - "(259, 'Individual: 259', 41.816525712692396, 70526)\n", - "(260, 'Individual: 260', 32.46525588617193, 64708)\n", - "(261, 'Individual: 261', 38.44359361353193, 63331)\n", - "(262, 'Individual: 262', 31.45462183739104, 69542)\n", - "(263, 'Individual: 263', 37.27658957203023, 78385)\n", - "(264, 'Individual: 264', 38.11794848106296, 80897)\n", - "(265, 'Individual: 265', 35.0330527437047, 53686)\n", - "(266, 'Individual: 266', 32.67540495416496, 62167)\n", - "(267, 'Individual: 267', 30.624907612864487, 67915)\n", - "(268, 'Individual: 268', 36.10663656416574, 84828)\n", - "(269, 'Individual: 269', 35.26289910651095, 82618)\n", - "(270, 'Individual: 270', 36.42668440297713, 68270)\n", - "(271, 'Individual: 271', 33.33890058344479, 71534)\n", - "(272, 'Individual: 272', 35.61080963599342, 73866)\n", - "(273, 'Individual: 273', 35.32700016406549, 81075)\n", - "(274, 'Individual: 274', 34.30684902469834, 58865)\n", - "(275, 'Individual: 275', 32.437591076688896, 65597)\n", - "(276, 'Individual: 276', 37.675351964383424, 82233)\n", - "(277, 'Individual: 277', 35.36912648816337, 73042)\n", - "(278, 'Individual: 278', 33.237396086356306, 77283)\n", - "(279, 'Individual: 279', 37.76122970395246, 78407)\n", - "(280, 'Individual: 280', 34.72091607471147, 67314)\n", - "(281, 'Individual: 281', 34.47280067008884, 64555)\n", - "(282, 'Individual: 282', 36.69245718985907, 70082)\n", - "(283, 'Individual: 283', 34.76048672309016, 62628)\n", - "(284, 'Individual: 284', 36.25144906694082, 68203)\n", - "(285, 'Individual: 285', 34.04117576581565, 78593)\n", - "(286, 'Individual: 286', 38.06253723275973, 81193)\n", - "(287, 'Individual: 287', 34.37037920463491, 74054)\n", - "(288, 'Individual: 288', 35.039904593187615, 75508)\n", - "(289, 'Individual: 289', 31.170010356203505, 77544)\n", - "(290, 'Individual: 290', 33.869710865868754, 78205)\n", - "(291, 'Individual: 291', 37.157537622528665, 72579)\n", - "(292, 'Individual: 292', 34.92498073589014, 82418)\n", - "(293, 'Individual: 293', 32.46815694199189, 68784)\n", - "(294, 'Individual: 294', 32.84927148107052, 74522)\n", - "(295, 'Individual: 295', 37.30436105181069, 73248)\n", - "(296, 'Individual: 296', 33.58393392838615, 83167)\n", - "(297, 'Individual: 297', 33.30258842296932, 67112)\n", - "(298, 'Individual: 298', 38.25803588528998, 80069)\n", - "(299, 'Individual: 299', 37.63935961821646, 80799)\n", - "(300, 'Individual: 300', 35.80554909275177, 78114)\n" - ] - } - ], - "source": [ - "# Turn the above records into a Data Frame\n", - "# First of all, create an array of arrays\n", - "inputBuf = []\n", - "\n", - "for i in range(0, len(ages)) :\n", - " id = i + 1 # Avoid counting from zero\n", - " name = \"Individual: {:03d}\".format(id)\n", - " # Note we need to make sure values are typed correctly\n", - " # salary will have type numpy.float64 - if it is not cast as below, an error will be thrown\n", - " age = float(ages[i])\n", - " salary = int(salaries[i])\n", - " inputBuf.append((id, name,age,salary))\n", - "\n", - "for i in inputBuf:\n", - " print (i)\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Connect to the Aerospike" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [], - "source": [ - "# Configure the client\n", - "config = {\n", - " 'hosts': [ (AS_HOST, AS_PORT) ]\n", - "}\n", - "\n", - "# Create a client and connect it to the cluster\n", - "try:\n", - " client = aerospike.client(config).connect()\n", - "except:\n", - " import sys\n", - " print(\"failed to connect to the cluster with\", config['hosts'])\n", - " sys.exit(1)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Write Data" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "# Type 'show namespaces' at the aql prompt if you are not sure about the namespace\n", - "namespace= \"test\"\n", - "write_set= \"write_set\"\n", - "\n", - "for i in inputBuf:\n", - " _id, _name, _age, _salary = i\n", - " key = (namespace, write_set,_id)\n", - " client.put(key, {'id': _id,'name': _name,'age': _age,'salary': _salary})" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Read Data" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'id': 1, 'name': 'Individual: 001', 'age': 24.304499333848025, 'salary': 46865}\n", - "{'id': 2, 'name': 'Individual: 002', 'age': 25.127370725646376, 'salary': 58731}\n", - "{'id': 3, 'name': 'Individual: 003', 'age': 24.433587308486384, 'salary': 39822}\n", - "{'id': 4, 'name': 'Individual: 004', 'age': 23.466317614770414, 'salary': 46800}\n", - "{'id': 5, 'name': 'Individual: 005', 'age': 25.901554554617075, 'salary': 44622}\n", - "{'id': 6, 'name': 'Individual: 006', 'age': 25.244089945979592, 'salary': 48962}\n", - "{'id': 7, 'name': 'Individual: 007', 'age': 25.513546531713885, 'salary': 54015}\n", - "{'id': 8, 'name': 'Individual: 008', 'age': 24.384542542073284, 'salary': 48850}\n", - "{'id': 9, 'name': 'Individual: 009', 'age': 23.969228059245417, 'salary': 49939}\n", - "{'id': 10, 'name': 'Individual: 010', 'age': 25.32659498864832, 'salary': 52270}\n", - "{'id': 11, 'name': 'Individual: 011', 'age': 24.52188955913116, 'salary': 56682}\n", - "{'id': 12, 'name': 'Individual: 012', 'age': 25.307831842818935, 'salary': 48937}\n", - "{'id': 13, 'name': 'Individual: 013', 'age': 25.25646020804283, 'salary': 54880}\n", - "{'id': 14, 'name': 'Individual: 014', 'age': 25.678511730398245, 'salary': 50121}\n", - "{'id': 15, 'name': 'Individual: 015', 'age': 24.05942103892467, 'salary': 60348}\n", - "{'id': 16, 'name': 'Individual: 016', 'age': 25.749046404565952, 'salary': 53522}\n", - "{'id': 17, 'name': 'Individual: 017', 'age': 22.897339115317486, 'salary': 41738}\n", - "{'id': 18, 'name': 'Individual: 018', 'age': 25.85659550137486, 'salary': 51606}\n", - "{'id': 19, 'name': 'Individual: 019', 'age': 25.344785148917193, 'salary': 47040}\n", - "{'id': 20, 'name': 'Individual: 020', 'age': 23.821932401631045, 'salary': 51202}\n", - "{'id': 21, 'name': 'Individual: 021', 'age': 25.525114369502592, 'salary': 48633}\n", - "{'id': 22, 'name': 'Individual: 022', 'age': 24.02621230558812, 'salary': 51414}\n", - "{'id': 23, 'name': 'Individual: 023', 'age': 25.36660236909869, 'salary': 53445}\n", - "{'id': 24, 'name': 'Individual: 024', 'age': 26.166761584649567, 'salary': 59844}\n", - "{'id': 25, 'name': 'Individual: 025', 'age': 24.925568239677723, 'salary': 55420}\n", - "{'id': 26, 'name': 'Individual: 026', 'age': 25.334241438007734, 'salary': 52286}\n", - "{'id': 27, 'name': 'Individual: 027', 'age': 24.35634257798389, 'salary': 47127}\n", - "{'id': 28, 'name': 'Individual: 028', 'age': 24.379764011709945, 'salary': 43354}\n", - "{'id': 29, 'name': 'Individual: 029', 'age': 25.970751080494217, 'salary': 58479}\n", - "{'id': 30, 'name': 'Individual: 030', 'age': 23.031631668580637, 'salary': 61643}\n", - "{'id': 31, 'name': 'Individual: 031', 'age': 25.486396662028405, 'salary': 46286}\n", - "{'id': 32, 'name': 'Individual: 032', 'age': 25.02768193636628, 'salary': 47781}\n", - "{'id': 33, 'name': 'Individual: 033', 'age': 24.702078982456936, 'salary': 46787}\n", - "{'id': 34, 'name': 'Individual: 034', 'age': 23.622632894752655, 'salary': 41763}\n", - "{'id': 35, 'name': 'Individual: 035', 'age': 25.18245840193072, 'salary': 44396}\n", - "{'id': 36, 'name': 'Individual: 036', 'age': 24.327072736740977, 'salary': 37789}\n", - "{'id': 37, 'name': 'Individual: 037', 'age': 27.179832440998133, 'salary': 55226}\n", - "{'id': 38, 'name': 'Individual: 038', 'age': 24.416278669685425, 'salary': 48327}\n", - "{'id': 39, 'name': 'Individual: 039', 'age': 25.45717123985681, 'salary': 51153}\n", - "{'id': 40, 'name': 'Individual: 040', 'age': 25.950506439788757, 'salary': 53308}\n", - "{'id': 41, 'name': 'Individual: 041', 'age': 25.05222521590697, 'salary': 52994}\n", - "{'id': 42, 'name': 'Individual: 042', 'age': 24.522624339544254, 'salary': 45892}\n", - "{'id': 43, 'name': 'Individual: 043', 'age': 25.865077973388786, 'salary': 47073}\n", - "{'id': 44, 'name': 'Individual: 044', 'age': 25.125544636768744, 'salary': 43031}\n", - "{'id': 45, 'name': 'Individual: 045', 'age': 25.475983736889532, 'salary': 54665}\n", - "{'id': 46, 'name': 'Individual: 046', 'age': 23.9603502068871, 'salary': 51321}\n", - "{'id': 47, 'name': 'Individual: 047', 'age': 25.088279119759616, 'salary': 50190}\n", - "{'id': 48, 'name': 'Individual: 048', 'age': 24.40922247819197, 'salary': 49816}\n", - "{'id': 49, 'name': 'Individual: 049', 'age': 25.728646404457788, 'salary': 49272}\n", - "{'id': 50, 'name': 'Individual: 050', 'age': 25.590778965014902, 'salary': 44507}\n", - "{'id': 51, 'name': 'Individual: 051', 'age': 24.165785224719208, 'salary': 50863}\n", - "{'id': 52, 'name': 'Individual: 052', 'age': 25.02524070590101, 'salary': 45812}\n", - "{'id': 53, 'name': 'Individual: 053', 'age': 25.90688832187065, 'salary': 50855}\n", - "{'id': 54, 'name': 'Individual: 054', 'age': 25.405612867685388, 'salary': 50310}\n", - "{'id': 55, 'name': 'Individual: 055', 'age': 27.106849920099684, 'salary': 58744}\n", - "{'id': 56, 'name': 'Individual: 056', 'age': 24.884981714203818, 'salary': 47770}\n", - "{'id': 57, 'name': 'Individual: 057', 'age': 22.569035802223326, 'salary': 53649}\n", - "{'id': 58, 'name': 'Individual: 058', 'age': 24.589150886413034, 'salary': 41339}\n", - "{'id': 59, 'name': 'Individual: 059', 'age': 23.116363143771242, 'salary': 54119}\n", - "{'id': 60, 'name': 'Individual: 060', 'age': 25.614449536992023, 'salary': 47725}\n", - "{'id': 61, 'name': 'Individual: 061', 'age': 23.818011583570772, 'salary': 50631}\n", - "{'id': 62, 'name': 'Individual: 062', 'age': 25.754418810189147, 'salary': 46127}\n", - "{'id': 63, 'name': 'Individual: 063', 'age': 23.37159754146576, 'salary': 42471}\n", - "{'id': 64, 'name': 'Individual: 064', 'age': 24.63858826707661, 'salary': 47517}\n", - "{'id': 65, 'name': 'Individual: 065', 'age': 24.95043220241014, 'salary': 49399}\n", - "{'id': 66, 'name': 'Individual: 066', 'age': 25.825723002809923, 'salary': 47980}\n", - "{'id': 67, 'name': 'Individual: 067', 'age': 25.38116525590079, 'salary': 47765}\n", - "{'id': 68, 'name': 'Individual: 068', 'age': 25.95619174147496, 'salary': 50509}\n", - "{'id': 69, 'name': 'Individual: 069', 'age': 24.134908997669214, 'salary': 51007}\n", - "{'id': 70, 'name': 'Individual: 070', 'age': 26.5048906027763, 'salary': 54763}\n", - "{'id': 71, 'name': 'Individual: 071', 'age': 25.478989329342994, 'salary': 48621}\n", - "{'id': 72, 'name': 'Individual: 072', 'age': 26.45845682526833, 'salary': 53003}\n", - "{'id': 73, 'name': 'Individual: 073', 'age': 25.662969000311413, 'salary': 45049}\n", - "{'id': 74, 'name': 'Individual: 074', 'age': 26.481196564890848, 'salary': 53655}\n", - "{'id': 75, 'name': 'Individual: 075', 'age': 25.482834202787874, 'salary': 55909}\n", - "{'id': 76, 'name': 'Individual: 076', 'age': 25.47922452340438, 'salary': 54586}\n", - "{'id': 77, 'name': 'Individual: 077', 'age': 25.539193902306028, 'salary': 54423}\n", - "{'id': 78, 'name': 'Individual: 078', 'age': 23.989370434750832, 'salary': 56504}\n", - "{'id': 79, 'name': 'Individual: 079', 'age': 24.800464625800352, 'salary': 49653}\n", - "{'id': 80, 'name': 'Individual: 080', 'age': 25.91745073089148, 'salary': 55976}\n", - "{'id': 81, 'name': 'Individual: 081', 'age': 25.28589587554696, 'salary': 50595}\n", - "{'id': 82, 'name': 'Individual: 082', 'age': 24.553207779806538, 'salary': 53757}\n", - "{'id': 83, 'name': 'Individual: 083', 'age': 24.122386931080346, 'salary': 51192}\n", - "{'id': 84, 'name': 'Individual: 084', 'age': 25.835178277596235, 'salary': 49336}\n", - "{'id': 85, 'name': 'Individual: 085', 'age': 26.557708567837512, 'salary': 49848}\n", - "{'id': 86, 'name': 'Individual: 086', 'age': 26.328168407167418, 'salary': 50899}\n", - "{'id': 87, 'name': 'Individual: 087', 'age': 25.303875652836627, 'salary': 49636}\n", - "{'id': 88, 'name': 'Individual: 088', 'age': 24.61552848462999, 'salary': 50013}\n", - "{'id': 89, 'name': 'Individual: 089', 'age': 24.98829084149272, 'salary': 51337}\n", - "{'id': 90, 'name': 'Individual: 090', 'age': 25.980273061379584, 'salary': 48970}\n", - "{'id': 91, 'name': 'Individual: 091', 'age': 24.982495965765835, 'salary': 36760}\n", - "{'id': 92, 'name': 'Individual: 092', 'age': 27.470143507806128, 'salary': 58199}\n", - "{'id': 93, 'name': 'Individual: 093', 'age': 25.070253849853316, 'salary': 44874}\n", - "{'id': 94, 'name': 'Individual: 094', 'age': 25.562313973520876, 'salary': 56027}\n", - "{'id': 95, 'name': 'Individual: 095', 'age': 26.455271228221175, 'salary': 51132}\n", - "{'id': 96, 'name': 'Individual: 096', 'age': 23.299087097690666, 'salary': 50492}\n", - "{'id': 97, 'name': 'Individual: 097', 'age': 23.44473007409865, 'salary': 46982}\n", - "{'id': 98, 'name': 'Individual: 098', 'age': 23.422271690705045, 'salary': 52086}\n", - "{'id': 99, 'name': 'Individual: 099', 'age': 25.227519479773093, 'salary': 46926}\n", - "{'id': 100, 'name': 'Individual: 100', 'age': 23.82188149499848, 'salary': 47263}\n", - "{'id': 101, 'name': 'Individual: 101', 'age': 47.404260544110684, 'salary': 82062}\n", - "{'id': 102, 'name': 'Individual: 102', 'age': 48.849100622901396, 'salary': 90226}\n", - "{'id': 103, 'name': 'Individual: 103', 'age': 42.31913479741497, 'salary': 83705}\n", - "{'id': 104, 'name': 'Individual: 104', 'age': 39.87179613706066, 'salary': 74468}\n", - "{'id': 105, 'name': 'Individual: 105', 'age': 37.031880002591414, 'salary': 60062}\n", - "{'id': 106, 'name': 'Individual: 106', 'age': 39.8639387073848, 'salary': 56646}\n", - "{'id': 107, 'name': 'Individual: 107', 'age': 48.97468539060065, 'salary': 89025}\n", - "{'id': 108, 'name': 'Individual: 108', 'age': 41.06202707700086, 'salary': 79817}\n", - "{'id': 109, 'name': 'Individual: 109', 'age': 48.85965925586444, 'salary': 75993}\n", - "{'id': 110, 'name': 'Individual: 110', 'age': 41.7052261810714, 'salary': 80825}\n", - "{'id': 111, 'name': 'Individual: 111', 'age': 46.44624550330593, 'salary': 93133}\n", - "{'id': 112, 'name': 'Individual: 112', 'age': 46.6970215394055, 'salary': 73495}\n", - "{'id': 113, 'name': 'Individual: 113', 'age': 48.43076474144459, 'salary': 98342}\n", - "{'id': 114, 'name': 'Individual: 114', 'age': 42.98301425090402, 'salary': 76492}\n", - "{'id': 115, 'name': 'Individual: 115', 'age': 46.71721186607902, 'salary': 87529}\n", - "{'id': 116, 'name': 'Individual: 116', 'age': 42.655728930073906, 'salary': 74896}\n", - "{'id': 117, 'name': 'Individual: 117', 'age': 46.111502884684946, 'salary': 88516}\n", - "{'id': 118, 'name': 'Individual: 118', 'age': 51.527792759430284, 'salary': 85514}\n", - "{'id': 119, 'name': 'Individual: 119', 'age': 49.59727417914037, 'salary': 94416}\n", - "{'id': 120, 'name': 'Individual: 120', 'age': 51.00041690623652, 'salary': 104275}\n", - "{'id': 121, 'name': 'Individual: 121', 'age': 46.68990901522216, 'salary': 83431}\n", - "{'id': 122, 'name': 'Individual: 122', 'age': 45.39539596410638, 'salary': 80706}\n", - "{'id': 123, 'name': 'Individual: 123', 'age': 40.92895589491278, 'salary': 76339}\n", - "{'id': 124, 'name': 'Individual: 124', 'age': 44.856459604428096, 'salary': 80049}\n", - "{'id': 125, 'name': 'Individual: 125', 'age': 46.27904686514323, 'salary': 82443}\n", - "{'id': 126, 'name': 'Individual: 126', 'age': 48.295284178221415, 'salary': 83460}\n", - "{'id': 127, 'name': 'Individual: 127', 'age': 41.740363945016874, 'salary': 80123}\n", - "{'id': 128, 'name': 'Individual: 128', 'age': 37.44332752423415, 'salary': 67809}\n", - "{'id': 129, 'name': 'Individual: 129', 'age': 39.99378985151627, 'salary': 79658}\n", - "{'id': 130, 'name': 'Individual: 130', 'age': 42.96677899515424, 'salary': 78229}\n", - "{'id': 131, 'name': 'Individual: 131', 'age': 47.97306089837442, 'salary': 83574}\n", - "{'id': 132, 'name': 'Individual: 132', 'age': 41.20898424443146, 'salary': 67627}\n", - "{'id': 133, 'name': 'Individual: 133', 'age': 43.84910252640341, 'salary': 91616}\n", - "{'id': 134, 'name': 'Individual: 134', 'age': 45.63161191521578, 'salary': 76677}\n", - "{'id': 135, 'name': 'Individual: 135', 'age': 42.305646588838755, 'salary': 75264}\n", - "{'id': 136, 'name': 'Individual: 136', 'age': 48.5952394745472, 'salary': 71680}\n", - "{'id': 137, 'name': 'Individual: 137', 'age': 37.17352544608759, 'salary': 68649}\n", - "{'id': 138, 'name': 'Individual: 138', 'age': 47.046044205253075, 'salary': 68082}\n", - "{'id': 139, 'name': 'Individual: 139', 'age': 44.059713310749146, 'salary': 82409}\n", - "{'id': 140, 'name': 'Individual: 140', 'age': 53.15257619942137, 'salary': 95877}\n", - "{'id': 141, 'name': 'Individual: 141', 'age': 47.28787601265288, 'salary': 80766}\n", - "{'id': 142, 'name': 'Individual: 142', 'age': 43.38128213023818, 'salary': 87329}\n", - "{'id': 143, 'name': 'Individual: 143', 'age': 42.67995234013793, 'salary': 71068}\n", - "{'id': 144, 'name': 'Individual: 144', 'age': 49.23052084465668, 'salary': 81845}\n", - "{'id': 145, 'name': 'Individual: 145', 'age': 50.346481154337745, 'salary': 90087}\n", - "{'id': 146, 'name': 'Individual: 146', 'age': 44.23402694194281, 'salary': 79914}\n", - "{'id': 147, 'name': 'Individual: 147', 'age': 38.79429200311992, 'salary': 70207}\n", - "{'id': 148, 'name': 'Individual: 148', 'age': 51.2116534948333, 'salary': 103244}\n", - "{'id': 149, 'name': 'Individual: 149', 'age': 45.923965459314836, 'salary': 82734}\n", - "{'id': 150, 'name': 'Individual: 150', 'age': 37.249816617139075, 'salary': 65909}\n", - "{'id': 151, 'name': 'Individual: 151', 'age': 41.25864750495034, 'salary': 66558}\n", - "{'id': 152, 'name': 'Individual: 152', 'age': 51.52587422238312, 'salary': 106517}\n", - "{'id': 153, 'name': 'Individual: 153', 'age': 51.46802220962631, 'salary': 104710}\n", - "{'id': 154, 'name': 'Individual: 154', 'age': 43.94384193393332, 'salary': 75919}\n", - "{'id': 155, 'name': 'Individual: 155', 'age': 45.894811591634046, 'salary': 71604}\n", - "{'id': 156, 'name': 'Individual: 156', 'age': 43.3094508543472, 'salary': 76633}\n", - "{'id': 157, 'name': 'Individual: 157', 'age': 39.82288146636257, 'salary': 67429}\n", - "{'id': 158, 'name': 'Individual: 158', 'age': 44.53925052093046, 'salary': 83026}\n", - "{'id': 159, 'name': 'Individual: 159', 'age': 40.886890271237384, 'salary': 85154}\n", - "{'id': 160, 'name': 'Individual: 160', 'age': 43.34937134219747, 'salary': 74508}\n", - "{'id': 161, 'name': 'Individual: 161', 'age': 39.91213416083551, 'salary': 72150}\n", - "{'id': 162, 'name': 'Individual: 162', 'age': 40.1983742007039, 'salary': 78190}\n", - "{'id': 163, 'name': 'Individual: 163', 'age': 48.59743926272466, 'salary': 83810}\n", - "{'id': 164, 'name': 'Individual: 164', 'age': 49.74750897777976, 'salary': 88221}\n", - "{'id': 165, 'name': 'Individual: 165', 'age': 42.64654504779174, 'salary': 84672}\n", - "{'id': 166, 'name': 'Individual: 166', 'age': 44.08353196544536, 'salary': 77033}\n", - "{'id': 167, 'name': 'Individual: 167', 'age': 41.78255031764483, 'salary': 73958}\n", - "{'id': 168, 'name': 'Individual: 168', 'age': 45.565399233578255, 'salary': 75090}\n", - "{'id': 169, 'name': 'Individual: 169', 'age': 46.58272067939971, 'salary': 80429}\n", - "{'id': 170, 'name': 'Individual: 170', 'age': 37.990972449367014, 'salary': 64231}\n", - "{'id': 171, 'name': 'Individual: 171', 'age': 51.762118675058, 'salary': 96494}\n", - "{'id': 172, 'name': 'Individual: 172', 'age': 49.91682043235008, 'salary': 84609}\n", - "{'id': 173, 'name': 'Individual: 173', 'age': 45.44707997576431, 'salary': 97364}\n", - "{'id': 174, 'name': 'Individual: 174', 'age': 39.78502260722891, 'salary': 78780}\n", - "{'id': 175, 'name': 'Individual: 175', 'age': 40.03544489547708, 'salary': 63982}\n", - "{'id': 176, 'name': 'Individual: 176', 'age': 39.690632810450666, 'salary': 65359}\n", - "{'id': 177, 'name': 'Individual: 177', 'age': 44.81147179979179, 'salary': 75839}\n", - "{'id': 178, 'name': 'Individual: 178', 'age': 47.786369924013016, 'salary': 86580}\n", - "{'id': 179, 'name': 'Individual: 179', 'age': 45.63895593966375, 'salary': 72824}\n", - "{'id': 180, 'name': 'Individual: 180', 'age': 46.40039832139477, 'salary': 76674}\n", - "{'id': 181, 'name': 'Individual: 181', 'age': 43.31651119630133, 'salary': 71132}\n", - "{'id': 182, 'name': 'Individual: 182', 'age': 44.913021362797785, 'salary': 76118}\n", - "{'id': 183, 'name': 'Individual: 183', 'age': 44.13938318645851, 'salary': 72143}\n", - "{'id': 184, 'name': 'Individual: 184', 'age': 50.16856442303606, 'salary': 80257}\n", - "{'id': 185, 'name': 'Individual: 185', 'age': 44.52649645673774, 'salary': 84435}\n", - "{'id': 186, 'name': 'Individual: 186', 'age': 42.947161065614196, 'salary': 86515}\n", - "{'id': 187, 'name': 'Individual: 187', 'age': 47.92662555968543, 'salary': 79512}\n", - "{'id': 188, 'name': 'Individual: 188', 'age': 42.64400488098836, 'salary': 79399}\n", - "{'id': 189, 'name': 'Individual: 189', 'age': 47.40312098170525, 'salary': 92675}\n", - "{'id': 190, 'name': 'Individual: 190', 'age': 41.278325511626974, 'salary': 79549}\n", - "{'id': 191, 'name': 'Individual: 191', 'age': 43.43670854151717, 'salary': 85657}\n", - "{'id': 192, 'name': 'Individual: 192', 'age': 44.42223653677814, 'salary': 82829}\n", - "{'id': 193, 'name': 'Individual: 193', 'age': 48.683988661266106, 'salary': 86467}\n", - "{'id': 194, 'name': 'Individual: 194', 'age': 45.317860747588064, 'salary': 88749}\n", - "{'id': 195, 'name': 'Individual: 195', 'age': 48.12115808026187, 'salary': 92202}\n", - "{'id': 196, 'name': 'Individual: 196', 'age': 48.57820489670735, 'salary': 89582}\n", - "{'id': 197, 'name': 'Individual: 197', 'age': 43.01459861321762, 'salary': 73901}\n", - "{'id': 198, 'name': 'Individual: 198', 'age': 41.163018056152254, 'salary': 72652}\n", - "{'id': 199, 'name': 'Individual: 199', 'age': 34.94686274746908, 'salary': 70491}\n", - "{'id': 200, 'name': 'Individual: 200', 'age': 39.74676175751297, 'salary': 64654}\n", - "{'id': 201, 'name': 'Individual: 201', 'age': 43.913325570472814, 'salary': 81504}\n", - "{'id': 202, 'name': 'Individual: 202', 'age': 42.547322585189264, 'salary': 72385}\n", - "{'id': 203, 'name': 'Individual: 203', 'age': 42.100452884122454, 'salary': 84812}\n", - "{'id': 204, 'name': 'Individual: 204', 'age': 41.315747999514706, 'salary': 74993}\n", - "{'id': 205, 'name': 'Individual: 205', 'age': 37.51011020514996, 'salary': 62669}\n", - "{'id': 206, 'name': 'Individual: 206', 'age': 45.08505107169978, 'salary': 71041}\n", - "{'id': 207, 'name': 'Individual: 207', 'age': 47.07237294656676, 'salary': 78040}\n", - "{'id': 208, 'name': 'Individual: 208', 'age': 53.04300243980572, 'salary': 93545}\n", - "{'id': 209, 'name': 'Individual: 209', 'age': 43.834138926602165, 'salary': 80655}\n", - "{'id': 210, 'name': 'Individual: 210', 'age': 46.57266322319943, 'salary': 83954}\n", - "{'id': 211, 'name': 'Individual: 211', 'age': 51.230543557510124, 'salary': 87634}\n", - "{'id': 212, 'name': 'Individual: 212', 'age': 42.0916637238154, 'salary': 81780}\n", - "{'id': 213, 'name': 'Individual: 213', 'age': 39.519153267968804, 'salary': 73012}\n", - "{'id': 214, 'name': 'Individual: 214', 'age': 49.040618242819995, 'salary': 82095}\n", - "{'id': 215, 'name': 'Individual: 215', 'age': 45.31639363800543, 'salary': 67403}\n", - "{'id': 216, 'name': 'Individual: 216', 'age': 38.031124335313564, 'salary': 63788}\n", - "{'id': 217, 'name': 'Individual: 217', 'age': 47.9486014075113, 'salary': 97173}\n", - "{'id': 218, 'name': 'Individual: 218', 'age': 48.206343312418724, 'salary': 94927}\n", - "{'id': 219, 'name': 'Individual: 219', 'age': 47.32489231572965, 'salary': 91604}\n", - "{'id': 220, 'name': 'Individual: 220', 'age': 46.11413770197612, 'salary': 83922}\n", - "{'id': 221, 'name': 'Individual: 221', 'age': 35.301029437081255, 'salary': 63627}\n", - "{'id': 222, 'name': 'Individual: 222', 'age': 35.03898881686214, 'salary': 80083}\n", - "{'id': 223, 'name': 'Individual: 223', 'age': 35.00543659376893, 'salary': 67421}\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'id': 224, 'name': 'Individual: 224', 'age': 38.268952445865935, 'salary': 60153}\n", - "{'id': 225, 'name': 'Individual: 225', 'age': 33.91228381267188, 'salary': 77378}\n", - "{'id': 226, 'name': 'Individual: 226', 'age': 38.34715952661958, 'salary': 81699}\n", - "{'id': 227, 'name': 'Individual: 227', 'age': 35.5925322009585, 'salary': 72465}\n", - "{'id': 228, 'name': 'Individual: 228', 'age': 34.58190977648209, 'salary': 66225}\n", - "{'id': 229, 'name': 'Individual: 229', 'age': 37.68327548633769, 'salary': 57314}\n", - "{'id': 230, 'name': 'Individual: 230', 'age': 36.122309523791834, 'salary': 61779}\n", - "{'id': 231, 'name': 'Individual: 231', 'age': 36.10591686948013, 'salary': 72038}\n", - "{'id': 232, 'name': 'Individual: 232', 'age': 32.353142028555105, 'salary': 59520}\n", - "{'id': 233, 'name': 'Individual: 233', 'age': 35.68739011715068, 'salary': 62823}\n", - "{'id': 234, 'name': 'Individual: 234', 'age': 36.484734910946614, 'salary': 76148}\n", - "{'id': 235, 'name': 'Individual: 235', 'age': 34.24028050138242, 'salary': 58137}\n", - "{'id': 236, 'name': 'Individual: 236', 'age': 36.801147645813295, 'salary': 72684}\n", - "{'id': 237, 'name': 'Individual: 237', 'age': 33.975592395697944, 'salary': 57193}\n", - "{'id': 238, 'name': 'Individual: 238', 'age': 35.5605656556073, 'salary': 70458}\n", - "{'id': 239, 'name': 'Individual: 239', 'age': 34.6678889493235, 'salary': 60965}\n", - "{'id': 240, 'name': 'Individual: 240', 'age': 35.58708372147991, 'salary': 69205}\n", - "{'id': 241, 'name': 'Individual: 241', 'age': 34.10157722658814, 'salary': 78920}\n", - "{'id': 242, 'name': 'Individual: 242', 'age': 36.726078511475194, 'salary': 68470}\n", - "{'id': 243, 'name': 'Individual: 243', 'age': 37.98447063843578, 'salary': 67520}\n", - "{'id': 244, 'name': 'Individual: 244', 'age': 36.09322432884619, 'salary': 81141}\n", - "{'id': 245, 'name': 'Individual: 245', 'age': 35.41275007057748, 'salary': 69158}\n", - "{'id': 246, 'name': 'Individual: 246', 'age': 36.928169946714966, 'salary': 80274}\n", - "{'id': 247, 'name': 'Individual: 247', 'age': 34.70038001570242, 'salary': 59869}\n", - "{'id': 248, 'name': 'Individual: 248', 'age': 33.95626263510884, 'salary': 63166}\n", - "{'id': 249, 'name': 'Individual: 249', 'age': 35.78452940295166, 'salary': 80699}\n", - "{'id': 250, 'name': 'Individual: 250', 'age': 34.44030127185523, 'salary': 74023}\n", - "{'id': 251, 'name': 'Individual: 251', 'age': 35.13065446046275, 'salary': 66182}\n", - "{'id': 252, 'name': 'Individual: 252', 'age': 33.74986844534237, 'salary': 66092}\n", - "{'id': 253, 'name': 'Individual: 253', 'age': 32.643617710867694, 'salary': 73349}\n", - "{'id': 254, 'name': 'Individual: 254', 'age': 33.821388333447395, 'salary': 74649}\n", - "{'id': 255, 'name': 'Individual: 255', 'age': 36.82656956578252, 'salary': 81205}\n", - "{'id': 256, 'name': 'Individual: 256', 'age': 35.314719715442386, 'salary': 67400}\n", - "{'id': 257, 'name': 'Individual: 257', 'age': 36.87761625420699, 'salary': 66684}\n", - "{'id': 258, 'name': 'Individual: 258', 'age': 34.39754679419078, 'salary': 68244}\n", - "{'id': 259, 'name': 'Individual: 259', 'age': 41.816525712692396, 'salary': 70526}\n", - "{'id': 260, 'name': 'Individual: 260', 'age': 32.46525588617193, 'salary': 64708}\n", - "{'id': 261, 'name': 'Individual: 261', 'age': 38.44359361353193, 'salary': 63331}\n", - "{'id': 262, 'name': 'Individual: 262', 'age': 31.45462183739104, 'salary': 69542}\n", - "{'id': 263, 'name': 'Individual: 263', 'age': 37.27658957203023, 'salary': 78385}\n", - "{'id': 264, 'name': 'Individual: 264', 'age': 38.11794848106296, 'salary': 80897}\n", - "{'id': 265, 'name': 'Individual: 265', 'age': 35.0330527437047, 'salary': 53686}\n", - "{'id': 266, 'name': 'Individual: 266', 'age': 32.67540495416496, 'salary': 62167}\n", - "{'id': 267, 'name': 'Individual: 267', 'age': 30.624907612864487, 'salary': 67915}\n", - "{'id': 268, 'name': 'Individual: 268', 'age': 36.10663656416574, 'salary': 84828}\n", - "{'id': 269, 'name': 'Individual: 269', 'age': 35.26289910651095, 'salary': 82618}\n", - "{'id': 270, 'name': 'Individual: 270', 'age': 36.42668440297713, 'salary': 68270}\n", - "{'id': 271, 'name': 'Individual: 271', 'age': 33.33890058344479, 'salary': 71534}\n", - "{'id': 272, 'name': 'Individual: 272', 'age': 35.61080963599342, 'salary': 73866}\n", - "{'id': 273, 'name': 'Individual: 273', 'age': 35.32700016406549, 'salary': 81075}\n", - "{'id': 274, 'name': 'Individual: 274', 'age': 34.30684902469834, 'salary': 58865}\n", - "{'id': 275, 'name': 'Individual: 275', 'age': 32.437591076688896, 'salary': 65597}\n", - "{'id': 276, 'name': 'Individual: 276', 'age': 37.675351964383424, 'salary': 82233}\n", - "{'id': 277, 'name': 'Individual: 277', 'age': 35.36912648816337, 'salary': 73042}\n", - "{'id': 278, 'name': 'Individual: 278', 'age': 33.237396086356306, 'salary': 77283}\n", - "{'id': 279, 'name': 'Individual: 279', 'age': 37.76122970395246, 'salary': 78407}\n", - "{'id': 280, 'name': 'Individual: 280', 'age': 34.72091607471147, 'salary': 67314}\n", - "{'id': 281, 'name': 'Individual: 281', 'age': 34.47280067008884, 'salary': 64555}\n", - "{'id': 282, 'name': 'Individual: 282', 'age': 36.69245718985907, 'salary': 70082}\n", - "{'id': 283, 'name': 'Individual: 283', 'age': 34.76048672309016, 'salary': 62628}\n", - "{'id': 284, 'name': 'Individual: 284', 'age': 36.25144906694082, 'salary': 68203}\n", - "{'id': 285, 'name': 'Individual: 285', 'age': 34.04117576581565, 'salary': 78593}\n", - "{'id': 286, 'name': 'Individual: 286', 'age': 38.06253723275973, 'salary': 81193}\n", - "{'id': 287, 'name': 'Individual: 287', 'age': 34.37037920463491, 'salary': 74054}\n", - "{'id': 288, 'name': 'Individual: 288', 'age': 35.039904593187615, 'salary': 75508}\n", - "{'id': 289, 'name': 'Individual: 289', 'age': 31.170010356203505, 'salary': 77544}\n", - "{'id': 290, 'name': 'Individual: 290', 'age': 33.869710865868754, 'salary': 78205}\n", - "{'id': 291, 'name': 'Individual: 291', 'age': 37.157537622528665, 'salary': 72579}\n", - "{'id': 292, 'name': 'Individual: 292', 'age': 34.92498073589014, 'salary': 82418}\n", - "{'id': 293, 'name': 'Individual: 293', 'age': 32.46815694199189, 'salary': 68784}\n", - "{'id': 294, 'name': 'Individual: 294', 'age': 32.84927148107052, 'salary': 74522}\n", - "{'id': 295, 'name': 'Individual: 295', 'age': 37.30436105181069, 'salary': 73248}\n", - "{'id': 296, 'name': 'Individual: 296', 'age': 33.58393392838615, 'salary': 83167}\n", - "{'id': 297, 'name': 'Individual: 297', 'age': 33.30258842296932, 'salary': 67112}\n", - "{'id': 298, 'name': 'Individual: 298', 'age': 38.25803588528998, 'salary': 80069}\n", - "{'id': 299, 'name': 'Individual: 299', 'age': 37.63935961821646, 'salary': 80799}\n", - "{'id': 300, 'name': 'Individual: 300', 'age': 35.80554909275177, 'salary': 78114}\n" - ] - } - ], - "source": [ - "for i in inputBuf:\n", - " _id, _name, _age, _salary = i\n", - " key = (namespace, write_set,_id)\n", - " (key, metadata, record) = client.get(key)\n", - " print(record)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "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.8.5" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}