Initial Commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "05c0de49-0eb8-4cd2-89b2-c312111dda85",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%pip install redis hiredis fastid faker tqdm"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "90326242-f141-4035-9053-d3aab6cc9224",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from redis.cluster import RedisCluster\n",
|
||||
"\n",
|
||||
"client = RedisCluster(host=\"redis\", port=6379)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "50b9f473-8924-4d03-acf8-71ecf25e54a8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from fastid import ulid\n",
|
||||
"from faker import Faker\n",
|
||||
"from tqdm.notebook import trange\n",
|
||||
"faker = Faker()\n",
|
||||
"\n",
|
||||
"with client.pipeline() as p:\n",
|
||||
" for _ in trange(15_000_000):\n",
|
||||
" p.hset(f\"profile:{ulid()}\", mapping={\"name\": \"John Doe\", \"sex\": \"M\"})\n",
|
||||
" p.execute()\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "23933aa3-ff5d-45f9-b402-59e58c02a2b3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.13.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user