usage: cadc-tap query [-h]
                      [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER | -a]
                      [-s SERVICE] [-q | -v] [-o OUTPUT_FILE] [-m MAXREC]
                      [-i INPUT_FILE] [--timeout TIMEOUT]
                      [-f {VOTable,csv,tsv}] [-t TMPTABLE]
                      [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)
  -f, --format {VOTable,csv,tsv}
                        output format, either tsv(default), csv, fits (TBD),
                        or VOTable
  -h, --help            show this help message and exit
  -i, --input-file INPUT_FILE
                        read query string from file (default is from STDIN),
                        location of file
  -m, --maxrec MAXREC   limit the number of returned records to this maximum
  -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
                        service this command accesses. Both IDs in short form
                        (<service>) or the complete one
                        (ivo://cadc.nrc.ca/<service>) as well as actual URLs
                        to the root of the service (https://someurl/service)
                        are accepted. 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"
