-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_table.py
50 lines (38 loc) · 1.52 KB
/
reset_table.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
# This is a sample Python script.
import psycopg2
from datetime import datetime, timezone
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def empty_table():
conn = psycopg2.connect("dbname=postgres user=j3_g2 password=Blaat1234 host=145.74.104.145") #connectie maken aan database
cur = conn.cursor()
date = '2000-09-09' #moduleren zodat we later dingen in de querry konden zetten
cur.execute('SELECT * from condition_occurrence;')
db_version = cur.fetchone()
# print("condition_occurrrence")
# print(db_version)
cur.execute('delete from condition_occurrence;')
cur.execute('SELECT * from condition_occurrence;')
db_version = cur.fetchone()
# print(db_version)
cur.execute('SELECT * from person;')
db_version = cur.fetchone()
# print("person")
# print(db_version)
cur.execute('delete from person;')
cur.execute('SELECT * from person;')
db_version = cur.fetchone()
# print(db_version)
cur.execute('SELECT * from measurement;')
db_version = cur.fetchone()
# print("measurement")
# print(db_version)
cur.execute('delete from measurement;')
cur.execute('SELECT * from measurement;')
db_version = cur.fetchone()
# print(db_version)
conn.commit()
cur.close()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
empty_table()