commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/tools parse_load_sql.py


From: Neil Tiffin
Subject: gnue/geas/tools parse_load_sql.py
Date: Sat, 07 Jul 2001 07:02:53 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Neil Tiffin <address@hidden>    01/07/07 07:02:52

Modified files:
        geas/tools     : parse_load_sql.py 

Log message:
        Add checks for inputs and TODOs.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/tools/parse_load_sql.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/geas/tools/parse_load_sql.py
diff -u gnue/geas/tools/parse_load_sql.py:1.3 
gnue/geas/tools/parse_load_sql.py:1.4
--- gnue/geas/tools/parse_load_sql.py:1.3       Fri Jul  6 19:29:57 2001
+++ gnue/geas/tools/parse_load_sql.py   Sat Jul  7 07:02:52 2001
@@ -3,8 +3,7 @@
 # parse_load_sql.py - parse *.geas files and substitute
 #                     GEAS_OBJECT_ID with real
 #                     object id, create .sql file then 
-#                     load files into
-#                     SQL database.
+#                     load files into SQL database.
 #
 # Copyright 2001 Free Software Foundation
 #
@@ -25,14 +24,36 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# $Id: parse_load_sql.py,v 1.3 2001/07/07 02:29:57 ntiffin Exp $
+# This program originally written by Neil Tiffin (address@hidden).
 #
+# $Id: parse_load_sql.py,v 1.4 2001/07/07 14:02:52 ntiffin Exp $
+#
+# to use this program
+# type "./parse_load_sql.py [dir_name]"
+#    where dir_name = the top level dir to start search for
+#                     *.geas files, defaults to CWD if not
+#                     specified
+#
 # the format of the .geas file is as follows:
 #  INSERT INTO must start in col 1 and must preceed any data
 #
 # all data lines must end with ; and start with left parenthesis
+#  For example:
 #  ("data");
 #
+# TODO's (in no particular order)
+# 1 - make non-interactive, command line only version
+# 2 - do create, store, use file manifests ( a file that
+#     contains a list of files to process)
+# 3 - add option to only load and not create .sql files
+# 4 - add option to only create and not load .sql files
+# 5 - figure out discrepency (if it exists) between
+#     geas uuids (32 characters) and uuid_unparse() of
+#     38 characters
+# 6 - add mysql capability and option
+# 7 - add capability to delete data before inserting
+# 8 - add capability to process a single file
+#
 
 import os
 import sys
@@ -42,6 +63,11 @@
 
 my_uuids = []
 
+# determine how to process .geas into .sql files
+# set do_all = "y" to process all without interaction
+# set do_all = " " for force interactive
+do_all = " "
+
 def get_uuid():
        global my_uuids
        if (len(my_uuids) < 2):
@@ -97,16 +123,18 @@
 # ask to use stored file list or go thru each file found
 
 # ask if process all or ask each one
-do_all = "y"
 do_this_one = "y"
-do_all = raw_input("Do you want to process all files found (y/n)? ")
+while (do_all != "y" and do_all != "n"): 
+       do_all = raw_input("Do you want to process all files found (y/n)? ")
 
 # if not all then
 # for each file ask if wanted for processing
 for file_name in sql_file_list:
        if (do_all == "n" or do_all == "N"):
                print "\nFile: ", file_name
-               do_this_one = raw_input("Do you want to process this file 
(y/n)? ")
+               do_this_one = " "
+               while (do_this_one != "y" and do_this_one != "n"): 
+                       do_this_one = raw_input("Do you want to process this 
file (y/n)? ")
        # for each file selected replace OBJECTID with uuid
        if do_this_one == "y" or do_this_one == "Y":
                file_in = open( file_name, "r")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]