MCPcopy
hub / github.com/openai/swarm / add_user

Function add_user

examples/personal_shopper/database.py:61–81  ·  view source on GitHub ↗
(user_id, first_name, last_name, email, phone)

Source from the content-addressed store, hash-verified

59
60
61def add_user(user_id, first_name, last_name, email, phone):
62 conn = get_connection()
63 cursor = conn.cursor()
64
65 # Check if the user already exists
66 cursor.execute("SELECT * FROM Users WHERE user_id = ?", (user_id,))
67 if cursor.fetchone():
68 return
69
70 try:
71 cursor.execute(
72 """
73 INSERT INTO Users (user_id, first_name, last_name, email, phone)
74 VALUES (?, ?, ?, ?, ?)
75 """,
76 (user_id, first_name, last_name, email, phone),
77 )
78
79 conn.commit()
80 except sqlite3.Error as e:
81 print(f"Database Error: {e}")
82
83
84def add_purchase(user_id, date_of_purchase, item_id, amount):

Callers 1

initialize_databaseFunction · 0.85

Calls 1

get_connectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…