Mercurial > repos > jjohnson > query_tabular
comparison query_tabular.xml @ 16:5b4f6cf857cf draft
Uploaded
| author | jjohnson |
|---|---|
| date | Thu, 22 Jun 2017 09:14:56 -0400 |
| parents | 3003fe70f297 |
| children | b9f797bf4f38 |
comparison
equal
deleted
inserted
replaced
| 15:67082f49f047 | 16:5b4f6cf857cf |
|---|---|
| 1 <tool id="query_tabular" name="Query Tabular" version="3.0.0"> | 1 <tool id="query_tabular" name="Query Tabular" version="3.1.0"> |
| 2 <description>using sqlite sql</description> | 2 <description>using sqlite sql</description> |
| 3 | 3 |
| 4 <requirements> | 4 <requirements> |
| 5 </requirements> | 5 </requirements> |
| 6 <stdio> | 6 <stdio> |
| 101 #set $filter_dict = dict() | 101 #set $filter_dict = dict() |
| 102 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 102 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
| 103 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) | 103 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) |
| 104 #set $filter_dict['action'] = str($fi.filter.regex_action) | 104 #set $filter_dict['action'] = str($fi.filter.regex_action) |
| 105 #silent $input_filters.append($filter_dict) | 105 #silent $input_filters.append($filter_dict) |
| 106 #elif $fi.filter.filter_type == 'select_columns': | |
| 107 #set $filter_dict = dict() | |
| 108 #set $filter_dict['filter'] = str($fi.filter.filter_type) | |
| 109 #set $filter_dict['columns'] = [int(str($ci)) for $ci in str($fi.filter.columns).split(',')] | |
| 110 #silent $input_filters.append($filter_dict) | |
| 106 #elif $fi.filter.filter_type == 'replace': | 111 #elif $fi.filter.filter_type == 'replace': |
| 107 #set $filter_dict = dict() | 112 #set $filter_dict = dict() |
| 108 #set $filter_dict['filter'] = str($fi.filter.filter_type) | 113 #set $filter_dict['filter'] = str($fi.filter.filter_type) |
| 109 #set $filter_dict['column'] = int(str($fi.filter.column)) | 114 #set $filter_dict['column'] = int(str($fi.filter.column)) |
| 110 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) | 115 #set $filter_dict['pattern'] = str($fi.filter.regex_pattern) |
| 143 <conditional name="filter"> | 148 <conditional name="filter"> |
| 144 <param name="filter_type" type="select" label="Filter By"> | 149 <param name="filter_type" type="select" label="Filter By"> |
| 145 <option value="skip">skip leading lines</option> | 150 <option value="skip">skip leading lines</option> |
| 146 <option value="comment">comment char</option> | 151 <option value="comment">comment char</option> |
| 147 <option value="regex">by regex expression matching</option> | 152 <option value="regex">by regex expression matching</option> |
| 153 <option value="select_columns">select columns</option> | |
| 148 <option value="replace">regex replace value in column</option> | 154 <option value="replace">regex replace value in column</option> |
| 149 <option value="prepend_line_num">prepend a line number column</option> | 155 <option value="prepend_line_num">prepend a line number column</option> |
| 150 <option value="append_line_num">append a line number column</option> | 156 <option value="append_line_num">append a line number column</option> |
| 151 <option value="normalize">normalize list columns, replicates row for each item in list</option> | 157 <option value="normalize">normalize list columns, replicates row for each item in list</option> |
| 152 </param> | 158 </param> |
| 168 <param name="regex_action" type="select" label="action for regex match"> | 174 <param name="regex_action" type="select" label="action for regex match"> |
| 169 <option value="exclude_match">exclude line on pattern match</option> | 175 <option value="exclude_match">exclude line on pattern match</option> |
| 170 <option value="include_match">include line on pattern match</option> | 176 <option value="include_match">include line on pattern match</option> |
| 171 <option value="exclude_find">exclude line if pattern found</option> | 177 <option value="exclude_find">exclude line if pattern found</option> |
| 172 <option value="include_find">include line if pattern found</option> | 178 <option value="include_find">include line if pattern found</option> |
| 179 </param> | |
| 180 </when> | |
| 181 <when value="select_columns"> | |
| 182 <param name="columns" type="text" value="" label="enter column numbers to keep" | |
| 183 help="example: 1,4,2 (selects the first,fourth, and second columns)"> | |
| 184 <validator type="regex" message="Column ordinal positions separated by commas">^([1-9]\d*)(,[1-9]\d*)*$</validator> | |
| 173 </param> | 185 </param> |
| 174 </when> | 186 </when> |
| 175 <when value="replace"> | 187 <when value="replace"> |
| 176 <param name="column" type="data_column" data_ref="table" label="Column to replace text" | 188 <param name="column" type="data_column" data_ref="table" label="Column to replace text" |
| 177 help=""/> | 189 help=""/> |
| 308 :: | 320 :: |
| 309 | 321 |
| 310 - skip leading lines skip the first *number* of lines | 322 - skip leading lines skip the first *number* of lines |
| 311 - comment char omit any lines that start with the specified comment character | 323 - comment char omit any lines that start with the specified comment character |
| 312 - by regex expression matching *include/exclude* lines the match the regex expression | 324 - by regex expression matching *include/exclude* lines the match the regex expression |
| 325 - select columns choose to include only selected columns in the order specified | |
| 313 - regex replace value in column replace a field in a column using a regex substitution (good for date reformatting) | 326 - regex replace value in column replace a field in a column using a regex substitution (good for date reformatting) |
| 314 - prepend a line number column each line has the ordinal value of the line read by this filter as the first column | 327 - prepend a line number column each line has the ordinal value of the line read by this filter as the first column |
| 315 - append a line number column each line has the ordinal value of the line read by this filter as the last column | 328 - append a line number column each line has the ordinal value of the line read by this filter as the last column |
| 316 - normalize list columns replicates the line for each item in the specified list *columns* | 329 - normalize list columns replicates the line for each item in the specified list *columns* |
| 317 | 330 |
| 539 :: | 552 :: |
| 540 | 553 |
| 541 Filter 1 - by regex expression matching [include]: '^\d+' (include lines that start with a number) | 554 Filter 1 - by regex expression matching [include]: '^\d+' (include lines that start with a number) |
| 542 Filter 2 - append a line number column: | 555 Filter 2 - append a line number column: |
| 543 Filter 3 - regex replace value in column[4]: '(\d+)/(\d+)/(\d+)' '19\3-\2-\1' (convert dates to sqlite format) | 556 Filter 3 - regex replace value in column[4]: '(\d+)/(\d+)/(\d+)' '19\3-\2-\1' (convert dates to sqlite format) |
| 557 Filter 4 - select columns 7,2,3,4,1 | |
| 544 | 558 |
| 545 Table: People | 559 Table: People |
| 546 Columns: Pets,FirstName,LastName,DOB,,,id | 560 Columns: id,FirstName,LastName,DOB,Pets |
| 547 | 561 |
| 548 ==== ========= ======== ========== == | 562 == ========= ======== ========== ==== |
| 549 Pets FirstName LastName DOB id | 563 id FirstName LastName DOB Pets |
| 550 ==== ========= ======== ========== == | 564 == ========= ======== ========== ==== |
| 551 2 Paula Brown 1978-05-24 1 | 565 1 Paula Brown 1978-05-24 2 |
| 552 1 Steven Jones 1974-04-04 2 | 566 2 Steven Jones 1974-04-04 1 |
| 553 0 Jane Doe 1978-05-24 3 | 567 3 Jane Doe 1978-05-24 0 |
| 554 1 James Smith 1980-10-20 4 | 568 4 James Smith 1980-10-20 1 |
| 555 ==== ========= ======== ========== == | 569 == ========= ======== ========== ==== |
| 556 | 570 |
| 557 | 571 |
| 558 *Pet Table* | 572 *Pet Table* |
| 559 | 573 |
| 560 :: | 574 :: |
| 561 | 575 |
| 562 Filter 1 - by regex expression matching [include]: '^\d+' (include lines that start with a number) | 576 Filter 1 - by regex expression matching [include]: '^\d+' (include lines that start with a number) |
| 563 Filter 2 - append a line number column: | 577 Filter 2 - append a line number column: |
| 564 Filter 3 - by regex expression matching [exclude]: '^0\t' (exclude lines with no pets) | 578 Filter 3 - by regex expression matching [exclude]: '^0\t' (exclude lines with no pets) |
| 565 Filter 4 - normalize list columns[5,6]: | 579 Filter 4 - normalize list columns[5,6]: |
| 580 Filter 5 - select columns 7,5,6 | |
| 566 | 581 |
| 567 Table: Pet | 582 Table: Pet |
| 568 Columns: ,,,,PetName,PetType,id | 583 Columns: id,PetName,PetType |
| 569 | 584 |
| 570 ======== ======== == | 585 == ======== ======== |
| 571 PetName PetType id | 586 id PetName PetType |
| 572 ======== ======== == | 587 == ======== ======== |
| 573 Rex dog 1 | 588 1 Rex dog |
| 574 Fluff cat 1 | 589 1 Fluff cat |
| 575 Allie cat 2 | 590 2 Allie cat |
| 576 Spot 4 | 591 4 Spot |
| 577 ======== ======== == | 592 == ======== ======== |
| 578 | 593 |
| 579 | 594 |
| 580 Query: SELECT FirstName,LastName,PetName FROM People join Pet on People.id = Pet.id WHERE PetType = 'cat'; | 595 Query: SELECT FirstName,LastName,PetName FROM People join Pet on People.id = Pet.id WHERE PetType = 'cat'; |
| 581 | 596 |
| 582 Result: | 597 Result: |
