aboutsummaryrefslogtreecommitdiffstats
path: root/createdb.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2012-11-07 00:23:53 +0100
committerThibaut Horel <thibaut.horel@gmail.com>2012-11-07 00:23:53 +0100
commite143cf83baf0c50da27251cee4f5e3a8929586a6 (patch)
treeaaa1e7f1b782aa10120a77490fe8c9abc7bad044 /createdb.py
parent6a1d6a7365fb917784d378cf3b3683c85bb81b48 (diff)
downloadfamille-flask-e143cf83baf0c50da27251cee4f5e3a8929586a6.tar.gz
Code cleanup. Login is now functional.
There is a script createdb.py to create the db from the schema.sql file
Diffstat (limited to 'createdb.py')
-rw-r--r--createdb.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/createdb.py b/createdb.py
new file mode 100644
index 0000000..7f50807
--- /dev/null
+++ b/createdb.py
@@ -0,0 +1,17 @@
+import sqlite3
+from argparse import ArgumentParser
+
+if __name__ == "__main__":
+ arg_parser = ArgumentParser()
+ arg_parser.add_argument("-d", "--database", help="Name of the database file",
+ required=True)
+ arg_parser.add_argument("-s", "--schema", help="File containing the db schema",
+ required=True)
+ args = arg_parser.parse_args()
+
+ conn = sqlite3.connect(args.database)
+ c = conn.cursor()
+ schema = open(args.schema)
+ c.executescript( schema.read() )
+ conn.commit()
+ c.close()