aboutsummaryrefslogtreecommitdiff
path: root/app/create_table.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-07-03 17:09:05 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-07-03 17:09:05 +0530
commit5721a75ed46438cf390559d76a12358cd7770edf (patch)
tree84155d85ed82cd9ce3e8ad651079d0f17e56e743 /app/create_table.py
parentbe04a44bef7f7d7c12eec45c45084d15a789b2bf (diff)
connected database; backend complete
Diffstat (limited to 'app/create_table.py')
-rw-r--r--app/create_table.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/create_table.py b/app/create_table.py
new file mode 100644
index 0000000..a431ba4
--- /dev/null
+++ b/app/create_table.py
@@ -0,0 +1,17 @@
+import mysql.connector as con
+
+mycon = con.connect(host="sql12.freesqldatabase.com",user="sql12352288",password="7X35JENbK3",port=3306,database="sql12352288")
+
+mycursor = mycon.cursor()
+
+try:
+ mycursor.execute("create table curie (id INT PRIMARY KEY, email VARCHAR(255), receptor VARCHAR(255), ligand VARCHAR(255), config VARCHAR(255), date DATE, description VARCHAR(255),done TINYINT DEFAULT 0)")
+except con.ProgrammingError:
+ print("Table Already Exists!")
+
+try:
+ mycursor.execute("insert into curie values (1,'navanchauhan@gmail.com','lu.pdbqt','test.pdbqt','owo.txt',CURDATE(),'CURIE WEB TASK',0)")
+except con.IntegrityError:
+ print("Duplicate Entry For Primary Key!")
+
+mycon.commit() \ No newline at end of file