Skip to content

Commit 963c7a1

Browse files
committed
add some actions
1 parent 47c9e64 commit 963c7a1

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

main.py

-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +0,0 @@
1-
import random
2-
3-
import psycopg2
4-
5-
conn = psycopg2.connect(
6-
dbname="postgres",
7-
user="postgres",
8-
password="1",
9-
host="localhost",
10-
port="5445",
11-
)
12-
conn.autocommit = True
13-
cursor = conn.cursor()
14-
15-
try:
16-
random_ids = random.sample(range(1, 10_000_001), 1000)
17-
18-
for idx, user_id in enumerate(random_ids, start=1):
19-
print(f"\n👤 [{idx}/1000] user_id = {user_id}")
20-
21-
for i in range(1, 101):
22-
suffix = f"_upd{i}"
23-
query = """
24-
UPDATE billing.users
25-
SET name = name || %s
26-
WHERE id = %s;
27-
"""
28-
cursor.execute(query, (suffix, user_id))
29-
print(f" → Update {i}/100 done")
30-
31-
print("\n✅ 1000 ta userga 100 martalik real update yakunlandi!")
32-
33-
finally:
34-
cursor.close()
35-
conn.close()

0 commit comments

Comments
 (0)