Skip to content

Commit b95a815

Browse files
committed
Misc fixes regarding connection.
1 parent 0a68fa7 commit b95a815

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

hbase/sesion5.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
},
227227
"outputs": [],
228228
"source": [
229-
"pool = Connection(HBASEHOST)"
229+
"hbasecon = Connection(HBASEHOST)"
230230
]
231231
},
232232
{
@@ -250,7 +250,7 @@
250250
"tables: list[str] = ['posts', 'votes', 'users', 'tags', 'comments']\n",
251251
"for t in tables:\n",
252252
" try:\n",
253-
" with pool.connection() as connection:\n",
253+
" with hbasecon.connection() as connection:\n",
254254
" connection.create_table(\n",
255255
" t,\n",
256256
" {\n",
@@ -259,7 +259,7 @@
259259
" except Exception as e:\n",
260260
" print(\"Database already exists: {0}. {1}\".format(t, e))\n",
261261
" pass\n",
262-
"with pool.connection() as connection:\n",
262+
"with hbasecon.connection() as connection:\n",
263263
" print(connection.tables())"
264264
]
265265
},
@@ -328,7 +328,7 @@
328328
"from happybase import Table\n",
329329
"\n",
330330
"def csv_to_hbase(file: str, tablename: str, column_family: str):\n",
331-
" with pool.connection() as connection, open(file) as f:\n",
331+
" with hbasecon.connection() as connection, open(file) as f:\n",
332332
" table: Table = connection.table(tablename)\n",
333333
"\n",
334334
" # La llamada csv.reader() crea un iterador sobre un fichero CSV\n",
@@ -436,7 +436,7 @@
436436
},
437437
"outputs": [],
438438
"source": [
439-
"with pool.connection() as connection:\n",
439+
"with hbasecon.connection() as connection:\n",
440440
" posts = connection.table('posts')"
441441
]
442442
},
@@ -637,7 +637,7 @@
637637
},
638638
"outputs": [],
639639
"source": [
640-
"with pool.connection() as connection:\n",
640+
"with hbasecon.connection() as connection:\n",
641641
" comments = connection.table('comments')\n",
642642
" posts = connection.table('posts')\n",
643643
"\n",
@@ -876,7 +876,7 @@
876876
},
877877
"outputs": [],
878878
"source": [
879-
"with pool.connection() as connection:\n",
879+
"with hbasecon.connection() as connection:\n",
880880
" FillWikiTable(connection).run()"
881881
]
882882
},
@@ -974,7 +974,7 @@
974974
},
975975
"outputs": [],
976976
"source": [
977-
"with pool.connection() as connection:\n",
977+
"with hbasecon.connection() as connection:\n",
978978
" BuildLinks(connection).run()"
979979
]
980980
},
@@ -1073,7 +1073,7 @@
10731073
},
10741074
"outputs": [],
10751075
"source": [
1076-
"with pool.connection() as connection:\n",
1076+
"with hbasecon.connection() as connection:\n",
10771077
" visualize_result_wikipedia(connection.table('wikilinks'))"
10781078
]
10791079
},

hbase/sesion6.ipynb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,6 @@
240240
" print(connection.tables())"
241241
]
242242
},
243-
{
244-
"cell_type": "code",
245-
"execution_count": null,
246-
"metadata": {},
247-
"outputs": [],
248-
"source": [
249-
"pool = Connection(HBASEHOST)"
250-
]
251-
},
252243
{
253244
"cell_type": "markdown",
254245
"metadata": {
@@ -348,7 +339,7 @@
348339
"from happybase import Table\n",
349340
"\n",
350341
"def csv_to_hbase(file: str, tablename: str, column_family: str):\n",
351-
" with pool.connection() as connection, open(file) as f:\n",
342+
" with hbasecon.connection() as connection, open(file) as f:\n",
352343
" table: Table = connection.table(tablename)\n",
353344
"\n",
354345
" # La llamada csv.reader() crea un iterador sobre un fichero CSV\n",
@@ -456,7 +447,7 @@
456447
},
457448
"outputs": [],
458449
"source": [
459-
"def posts():\n",
450+
"def posts() -> Table:\n",
460451
" with hbasecon.connection() as connection:\n",
461452
" return connection.table('posts')"
462453
]

0 commit comments

Comments
 (0)