Advertisement
repente

Untitled

Sep 1st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import sqlite3
  2.  
  3. def create_table():
  4. conn = sqlite3.connect("work.db")
  5. sql = "CREATE TABLE work (code TEXT, documentid TEXT)"
  6. cursor = conn.cursor()
  7. cursor.execute(sql)
  8. conn.close()
  9.  
  10. def insert_table(args):
  11. conn = sqlite3.connect("work.db")
  12. cursor = conn.cursor()
  13. cursor.execute("INSERT INTO work VALUES(?,?)", args)
  14. conn.commit()
  15. conn.close()
  16.  
  17. def get_data():
  18. conn = sqlite3.connect("work.db")
  19. cursor = conn.cursor()
  20. cursor.execute("SELECT * FROM work")
  21. res = cursor.fetchall()
  22. conn.close()
  23. return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement