batchquery.py
changeset 39 0cef3540b69f
parent 30 a8b7cd92f39f
child 83 515fadd3d286
equal deleted inserted replaced
38:d3593869d624 39:0cef3540b69f
     5 
     5 
     6 
     6 
     7 class BatchQueryTool(toolbase.SimpleTool):
     7 class BatchQueryTool(toolbase.SimpleTool):
     8     def __init__(self):
     8     def __init__(self):
     9         toolbase.SimpleTool.__init__(self, name='batchquery', desc='Run a query using columns from CSV file as arguments.')
     9         toolbase.SimpleTool.__init__(self, name='batchquery', desc='Run a query using columns from CSV file as arguments.')
    10         self.parser.add_argument('--query', dest='query', type=str, help='Query to run. Use %s for arguments, or %(name)s for named arguments (see --names).')
    10         self.parser.add_argument('--query', dest='query', type=str, help='Query to run. Use %%s for arguments, or %%(name)s for named arguments (see --header).')
    11         self.parser.add_argument('--file', dest='file', type=str, help='CSV file with data to use as arguments.')
    11         self.parser.add_argument('--file', dest='file', type=str, help='CSV file with data to use as arguments.')
    12         self.parser.add_argument('--init', dest='init', type=str, help='Query which initialize database session (eg. temporary function).')
    12         self.parser.add_argument('--init', dest='init', type=str, help='Query which initialize database session (eg. temporary function).')
    13         self.parser.add_argument('--output', dest='output', type=str, help='File name for results.')
    13         self.parser.add_argument('--output', dest='output', type=str, help='File name for results.')
    14         self.parser.add_argument('--outputfunc', dest='outputfunc', type=str, help='Python function which will format results (format_row(args, rows)).')
    14         self.parser.add_argument('--outputfunc', dest='outputfunc', type=str, help='Python function which will format results (format_row(args, rows)).')
    15         self.parser.add_argument('--header', dest='header', action='store_true', help='First line of CSV is header with names for columns. These name can be used in query.')
    15         self.parser.add_argument('--header', dest='header', action='store_true', help='First line of CSV is header with names for columns. These name can be used in query.')