Skip to content
Snippets Groups Projects
Commit 9cfc81ea authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Fix missing where in default statement

parent ab0251f1
Branches
No related tags found
No related merge requests found
...@@ -74,6 +74,8 @@ def print_table(service: TAPService, args): ...@@ -74,6 +74,8 @@ def print_table(service: TAPService, args):
where_statement = args.where where_statement = args.where
cone_search = args.cone_search cone_search = args.cone_search
save = args.save save = args.save
if where_statement:
where_statement = "where " + where_statement
if cone_search: if cone_search:
ra, dec, radius = _parse_cone_search_ra_dec_radius(cone_search) ra, dec, radius = _parse_cone_search_ra_dec_radius(cone_search)
where_statement = " and ".join(filter(lambda x: len(x), (where_statement, where_statement = " and ".join(filter(lambda x: len(x), (where_statement,
...@@ -81,7 +83,7 @@ def print_table(service: TAPService, args): ...@@ -81,7 +83,7 @@ def print_table(service: TAPService, args):
"CIRCLE('ICRS', {}, {}, {}))".format(ra, dec, "CIRCLE('ICRS', {}, {}, {}))".format(ra, dec,
radius)))) 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) logging.debug('executing query %s', query)
result_set = service.search(query) result_set = service.search(query)
...@@ -97,7 +99,7 @@ def parse_arguments(): ...@@ -97,7 +99,7 @@ def parse_arguments():
parser.set_defaults(func=lambda x, y: parser.print_help()) 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 = subparser.add_parser('list_tables')
list_table_parser.set_defaults(func=list_tables) list_table_parser.set_defaults(func=list_tables)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment