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.') |