-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete_db.py
executable file
·63 lines (48 loc) · 1.68 KB
/
delete_db.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
import psycopg2
def delete_user(c):
c.execute('drop table if exists users')
def delete_devices(c):
c.execute('drop table if exists devices')
def delete_features_for_data_handler(c):
c.execute('drop table if exists features_for_data_handler')
def delete_commands_for_data_handler(c):
c.execute('drop table if exists commands_for_data_handler')
def delete_properties_for_data_handler(c):
c.execute('drop table if exists properties_for_data_handler')
def delete_parameters_for_data_handler(c):
c.execute('drop table if exists parameters_for_data_handler')
def delete_defined_execution_errors(c):
c.execute('drop table if exists defined_execution_errors')
def delete_databases(c):
c.execute('drop table if exists databases')
def delete_logs(c):
c.execute('drop table if exists log')
def delete_booking_info(c):
c.execute('drop table if exists bookings')
def delete_experiments(c):
c.execute('drop table if exists experiments')
def delete_scripts(c):
c.execute('drop table if exists scripts')
def main():
conn = psycopg2.connect(host='localhost',
port=5432,
user='postgres',
password='1234')
c = conn.cursor()
delete_user(c)
delete_devices(c)
delete_features_for_data_handler(c)
delete_commands_for_data_handler(c)
delete_properties_for_data_handler(c)
delete_parameters_for_data_handler(c)
delete_defined_execution_errors(c)
delete_databases(c)
delete_logs(c)
delete_booking_info(c)
delete_experiments(c)
delete_scripts(c)
conn.commit()
conn.close()
if __name__ == '__main__':
main()