From 9cfc81ea79bd260b45559e22d75a7c5cf6c00a50 Mon Sep 17 00:00:00 2001
From: mancini <mancini@astron.nl>
Date: Fri, 24 Jan 2020 14:12:13 +0100
Subject: [PATCH] Fix missing where in default statement

---
 inspect_vo_registry.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/inspect_vo_registry.py b/inspect_vo_registry.py
index c1566f3..82abdee 100644
--- a/inspect_vo_registry.py
+++ b/inspect_vo_registry.py
@@ -74,6 +74,8 @@ def print_table(service: TAPService, args):
     where_statement = args.where
     cone_search = args.cone_search
     save = args.save
+    if where_statement:
+        where_statement = "where " + where_statement
     if cone_search:
         ra, dec, radius = _parse_cone_search_ra_dec_radius(cone_search)
         where_statement = " and ".join(filter(lambda x: len(x), (where_statement,
@@ -81,7 +83,7 @@ def print_table(service: TAPService, args):
                                                                  "CIRCLE('ICRS', {}, {}, {}))".format(ra, dec,
                                                                                                       radius))))
 
-    query = 'select top {} * from {} where {}'.format(limit, table_name, where_statement)
+    query = 'select top {} * from {} {}'.format(limit, table_name, where_statement)
     logging.debug('executing query %s', query)
     result_set = service.search(query)
 
@@ -97,7 +99,7 @@ def parse_arguments():
 
     parser.set_defaults(func=lambda x, y: parser.print_help())
 
-    subparser = parser.add_subparsers()
+    subparser = parser.add_subparsers(description='possible commands are')
 
     list_table_parser = subparser.add_parser('list_tables')
     list_table_parser.set_defaults(func=list_tables)
-- 
GitLab