-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
21 lines (14 loc) · 801 Bytes
/
test.py
File metadata and controls
21 lines (14 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# coding=utf-8
import psycopg2
conn = psycopg2.connect("dbname=inter user=inter password=inter")
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS player_players (id serial PRIMARY KEY, username varchar UNIQUE);")
cur.execute("CREATE TABLE IF NOT EXISTS player_data (pid serial, last_server varchar, last_online time, "
"points integer);")
cur.execute("CREATE TABLE IF NOT EXISTS player_login_logout (pid serial, action bool, time time);")
cur.execute("CREATE TABLE IF NOT EXISTS player_points (pid serial, change integer);")
cur.execute("INSERT INTO player_players (username) VALUES (%s);", ("arbot",))
cur.execute("SELECT id FROM player_players WHERE username = (%s)", ("arbot",))
player_id = cur.fetchone()[0]
print "ID: %s" % player_id
conn.commit()