|
226 | 226 | },
|
227 | 227 | "outputs": [],
|
228 | 228 | "source": [
|
229 |
| - "pool = Connection(HBASEHOST)" |
| 229 | + "hbasecon = Connection(HBASEHOST)" |
230 | 230 | ]
|
231 | 231 | },
|
232 | 232 | {
|
|
250 | 250 | "tables: list[str] = ['posts', 'votes', 'users', 'tags', 'comments']\n",
|
251 | 251 | "for t in tables:\n",
|
252 | 252 | " try:\n",
|
253 |
| - " with pool.connection() as connection:\n", |
| 253 | + " with hbasecon.connection() as connection:\n", |
254 | 254 | " connection.create_table(\n",
|
255 | 255 | " t,\n",
|
256 | 256 | " {\n",
|
|
259 | 259 | " except Exception as e:\n",
|
260 | 260 | " print(\"Database already exists: {0}. {1}\".format(t, e))\n",
|
261 | 261 | " pass\n",
|
262 |
| - "with pool.connection() as connection:\n", |
| 262 | + "with hbasecon.connection() as connection:\n", |
263 | 263 | " print(connection.tables())"
|
264 | 264 | ]
|
265 | 265 | },
|
|
328 | 328 | "from happybase import Table\n",
|
329 | 329 | "\n",
|
330 | 330 | "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", |
332 | 332 | " table: Table = connection.table(tablename)\n",
|
333 | 333 | "\n",
|
334 | 334 | " # La llamada csv.reader() crea un iterador sobre un fichero CSV\n",
|
|
436 | 436 | },
|
437 | 437 | "outputs": [],
|
438 | 438 | "source": [
|
439 |
| - "with pool.connection() as connection:\n", |
| 439 | + "with hbasecon.connection() as connection:\n", |
440 | 440 | " posts = connection.table('posts')"
|
441 | 441 | ]
|
442 | 442 | },
|
|
637 | 637 | },
|
638 | 638 | "outputs": [],
|
639 | 639 | "source": [
|
640 |
| - "with pool.connection() as connection:\n", |
| 640 | + "with hbasecon.connection() as connection:\n", |
641 | 641 | " comments = connection.table('comments')\n",
|
642 | 642 | " posts = connection.table('posts')\n",
|
643 | 643 | "\n",
|
|
876 | 876 | },
|
877 | 877 | "outputs": [],
|
878 | 878 | "source": [
|
879 |
| - "with pool.connection() as connection:\n", |
| 879 | + "with hbasecon.connection() as connection:\n", |
880 | 880 | " FillWikiTable(connection).run()"
|
881 | 881 | ]
|
882 | 882 | },
|
|
974 | 974 | },
|
975 | 975 | "outputs": [],
|
976 | 976 | "source": [
|
977 |
| - "with pool.connection() as connection:\n", |
| 977 | + "with hbasecon.connection() as connection:\n", |
978 | 978 | " BuildLinks(connection).run()"
|
979 | 979 | ]
|
980 | 980 | },
|
|
1073 | 1073 | },
|
1074 | 1074 | "outputs": [],
|
1075 | 1075 | "source": [
|
1076 |
| - "with pool.connection() as connection:\n", |
| 1076 | + "with hbasecon.connection() as connection:\n", |
1077 | 1077 | " visualize_result_wikipedia(connection.table('wikilinks'))"
|
1078 | 1078 | ]
|
1079 | 1079 | },
|
|
0 commit comments