Compare commits
2 Commits
f0669aafef
...
8c50a62538
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c50a62538 | |||
| 782445e0df |
File diff suppressed because it is too large
Load Diff
+11
-9
@@ -4,9 +4,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "071f6969-c01a-4369-a763-871f5b9e65b3",
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install redis hiredis fastid tqdm kagglehub"
|
||||
@@ -24,7 +22,7 @@
|
||||
"from redis.retry import Retry\n",
|
||||
"from redis.backoff import ExponentialBackoff\n",
|
||||
"from pathlib import Path\n",
|
||||
"import kagglehub\n",
|
||||
"import kagglehub # pyright: ignore[reportMissingTypeStubs]\n",
|
||||
"from csv import DictReader\n",
|
||||
"from fastid import ulid\n",
|
||||
"from tqdm.notebook import tqdm\n",
|
||||
@@ -79,7 +77,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with full_dump.open(\"rb\") as f:\n",
|
||||
" rows = sum(1 for line in f) - 1"
|
||||
" rows = sum(1 for _ in f) - 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -89,7 +87,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"daily_matches = {}\n",
|
||||
"daily_matches: dict[str, set[str]] = {}\n",
|
||||
"with full_dump.open(errors=\"ignore\") as csvfile:\n",
|
||||
" reader = DictReader(csvfile, delimiter=\";\")\n",
|
||||
" with client.pipeline() as p:\n",
|
||||
@@ -102,8 +100,8 @@
|
||||
" continue\n",
|
||||
" daily_matches[row[\"dateid\"]].add(row[\"matchid\"])\n",
|
||||
" display(f\"Selected {row[\"matchid\"]} for day {row[\"dateid\"]}\")\n",
|
||||
" p.hset(f\"raw:{ulid()}\", mapping=row)\n",
|
||||
" p.execute()"
|
||||
" _ = p.hset(f\"raw:{ulid()}\", mapping=row)\n",
|
||||
" _ = p.execute()"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -113,7 +111,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from redis.commands.search.field import TagField, NumericField, TextField\n",
|
||||
"from redis.commands.search.field import TagField, NumericField\n",
|
||||
"from redis.commands.search.index_definition import IndexDefinition, IndexType\n",
|
||||
"\n",
|
||||
"schema = (\n",
|
||||
@@ -150,6 +148,10 @@
|
||||
" TagField(\"secondarygadget\")\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"try:\n",
|
||||
" client.ft().dropindex()\n",
|
||||
"except:\n",
|
||||
" pass\n",
|
||||
"client.ft().create_index(schema, definition=IndexDefinition(prefix=(\"raw:\",), index_type=IndexType.HASH))"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user