Advertisement
rfmonk

sqlite_createdb.py

Jan 29th, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import os
  5. import sqlite3
  6.  
  7. db_filename = 'todo.db'
  8.  
  9. db_is_new = not os.path.exists(db_filename)
  10.  
  11. conn = sqlite3.connect(db_filename)
  12.  
  13. if db_is_new:
  14.     print 'Need to create schema'
  15. else:
  16.     print 'Database exists, assume schema does, too.'
  17.  
  18. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement