-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_db.py
More file actions
executable file
·40 lines (30 loc) · 1 KB
/
map_db.py
File metadata and controls
executable file
·40 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
import MySQLdb
db = None
db_upd2 = None
def connect():
global db
db = MySQLdb.connect(host="localhost", # your host, usually localhost
# user="tcarlson", # your username
# passwd="KCkApAG7Db9tnGcS", # your password
user = 'kuser0',
passwd = '9aad1067f476ba',
db="kdev0") # name of the data base
global db_upd2
db_upd2 = MySQLdb.connect(host="localhost", # your host, usually localhost
user="tcarlson", # your username
passwd="KCkApAG7Db9tnGcS", # your password
#user = 'kuser0',
#passwd = '9aad1067f476ba',
db="kdev0") # name of the data base
return (db, db_upd2)
if __name__ == '__main__':
connect()
# you must create a Cursor object. It will let
# you execute all the query you need
cur = db.cursor()
# Use all the SQL you like
cur.execute("SELECT * FROM device_location")
# print all the first cell of all the rows
for row in cur.fetchall() :
print row[0]