usage: cadc-tap query [-h]
                      [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER | -a]
                      [--host HOST] [-d | -q | -v] [-o OUTPUT_FILE]
                      [-i INPUT_FILE] [--timeout TIMEOUT]
                      [-f {VOTable,csv,tsv}] [-t TMPTABLE] [-s SERVICE]
                      [QUERY]

Run an adql query

To obtain the host associated with a service, execute a subcommand
with the service in verbose mode without specifying any authentication
option

If no authentication option is specified, cadc-tap will determine the
host associated with the service and look in the ~/.netrc file for the
host, and if found, will use the -n option. If not, cadc-tap will look
for ~/.ssl/cadcproxy.pem file, and if found, will use the --cert
option. If not, cadc-tap will use the --anon option.

positional arguments:
  QUERY                 ADQL query to run, format is a string with quotes
                        around it, for example "SELECT observationURI FROM
                        caom2.Observation"

optional arguments:
  -a, --anon            use the service anonymously
  --cert CERT           location of your X509 certificate to use for
                        authentication (unencrypted, in PEM format)
  -d, --debug           debug messages
  -f, --format {VOTable,csv,tsv}
                        output format, either tsv(default), csv, fits (TBD),
                        or VOTable
  -h, --help            show this help message and exit
  --host HOST           base hostname for services - used mainly for testing
                        (default: www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca)
  -i, --input-file INPUT_FILE
                        read query string from file (default is from STDIN),
                        location of file
  -n                    use .netrc in $HOME for authentication
  --netrc-file NETRC_FILE
                        netrc file to use for authentication
  -o, --output-file OUTPUT_FILE
                        write query results to file (default is to STDOUT)
  -q, --quiet           run quietly
  -s, --service SERVICE
                        set the TAP service. For the CADC TAP services both
                        the ivo and the short formats
                        (ivo://cadc.nrc.ca/youcat or youcat) are accepted.
                        External TAP services can be referred to by their URL
                        (https://almascience.nrao.edu/tap). Default is
                        ivo://cadc.nrc.ca/youcat
  --timeout TIMEOUT     query timeout in minutes. Default 2min
  -t, --tmptable TMPTABLE
                        Temp table upload, the value is in format:
                        "tablename:/path/to/table". In query to reference the
                        table use tap_upload.tablename
  -u, --user USER       name of user to authenticate. Note: application
                        prompts for the corresponding password!
  -v, --verbose         verbose messages

Examples:
- Anonymously run a query string:
      cadc-tap query -a -s tap "SELECT TOP 10 type FROM caom2.Observation"
- Use certificate to run a query:
      cadc-tap query -s tap "SELECT TOP 10 type FROM caom2.Observation" --cert ~/.ssl/cadcproxy.pem
- Use username/password to run a query on the tap service:
      cadc-tap query -s ivo://cadc.nrc.ca/tap "SELECT TOP 10 type FROM caom2.Observation" -u <username>
- Use netrc file to run a query on the ams/mast service :
      cadc-tap query -n -s ivo://cadc.nrc.ca/ams/mast "SELECT TOP 10 target_name FROM caom2.Observation"
