-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase_file
More file actions
13 lines (8 loc) · 667 Bytes
/
database_file
File metadata and controls
13 lines (8 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
import sqlite3
conn = sqlite3.connect('controller.db')
cursor = conn.cursor()
cursor.execute('''CREATE TABLE energyValues (id INTEGER PRIMARY KEY, value REAL, ip STRING, server INTEGER, time STRING, private_ip STRING, users_number INTEGER) ''' )
#cursor.execute ("INSERT into energyValues(id, value, ip, server, time) values (?, ?, ?, ?, ?)", (1, 2, 'aaa', 1, 'sdfsdf'))
#cursor.execute("SELECT * from energyValues where id = (SELECT MAX(id) from energyValues where server = 1)")
#cursor.execute("SELECT * from energyValues where id = (SELECT MAX(id) from energyValues where ip = ?)", dst)
cursor.execute("alter table energyValues add column private_ip STRING")