forked from Aneeshcn07/2022_IBM_Code_Challenge_Ayudar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tax_payment_alert.py
37 lines (28 loc) · 1014 Bytes
/
tax_payment_alert.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
import threading
import mysql.connector
#from mysql.connector import Error
def check(aadhaar):
threading.Timer(5.0, check).start()
try:
connection = mysql.connector.connect(host='localhost',
database= 'mydatabase',
user='root',
password='')
sql_select_Query = "select * from tax_details where aadhaar_no='"+aadhaar+"' order by date DESC LIMIT 1"
cursor = connection.cursor()
cursor.execute(sql_select_Query)
# get all records
records = cursor.fetchall()
print("Total number of rows in table: ", cursor.rowcount)
print("\nPrinting each row")
for row in records:
if row[3]!='Paid':
print('Tax payment is open')
except mysql.connector.Error as e:
print("Error reading data from MySQL table", e)
finally:
if connection.ts_connected():
connection.close()
cursor.close()
aadhaar=input()
check(aadhaar)