view sqlite_to_tabular.xml @ 0:30a37dd92ccd draft

Uploaded
author jjohnson
date Sat, 03 Oct 2015 09:13:55 -0400
parents
children 1819a06a01eb
line wrap: on
line source

<?xml version="1.0"?>
<tool id="sqlite_to_tabular" name="SQLite to tabular" version="0.0.1">
  <description>for SQL query</description>
  <stdio>
    <exit_code range="1:" level="fatal" description="Error" />
  </stdio>
  <command interpreter="python">
  sqlite_to_tabular.py 
  --sqlitedb="$sqlitedb" 
  --query='$sqlquery'
  $no_header 
  --output="$query_results"
  </command>
  <inputs>
    <param name="sqlitedb" type="data" format="sqlite" label="SQLite Database"/>
    <param name="sqlquery" type="text" area="True" size="120x20" label="SQL query">
        <validator type="regex">^(?im)\s*SELECT\s.*\sFROM\s.*$</validator>
    </param>
    <param name="no_header" type="boolean" truevalue="-n" falsevalue="" checked="False" label="Omit column headers"/>
  </inputs>
  <outputs>
    <data name="query_results" format="tabular" />
  </outputs>
  <tests>
    <!--
    -->
    <test>
      <param name="sqlitedb" ftype="sqlite" value="testdb.sqlite" />
      <param name="sqlquery" value="SELECT first_name, last_name, age FROM contacts WHERE first_name = 'Sam'" />
      <output name="query_results">
        <assert_contents>
          <has_text text="Smith" />
          <not_has_text text="Doe" />
        </assert_contents>
      </output>
    </test>
  </tests>
  <help>
    Outputs the results of a query on a SQLite Database as a tabular file. 
  </help>
</tool>