@@ -41,7 +41,7 @@ class GaiaClass(TapPlus):
4141 MAIN_GAIA_TABLE = None
4242 MAIN_GAIA_TABLE_RA = conf .MAIN_GAIA_TABLE_RA
4343 MAIN_GAIA_TABLE_DEC = conf .MAIN_GAIA_TABLE_DEC
44- ROW_LIMIT = conf . ROW_LIMIT
44+ ROW_LIMIT = None
4545 VALID_DATALINK_RETRIEVAL_TYPES = conf .VALID_DATALINK_RETRIEVAL_TYPES
4646
4747 def __init__ (self , tap_plus_conn_handler = None ,
@@ -356,7 +356,7 @@ def get_datalinks(self, ids, verbose=False):
356356 return self .__gaiadata .get_datalinks (ids = ids , verbose = verbose )
357357
358358 def __query_object (self , coordinate , radius = None , width = None , height = None ,
359- async_job = False , verbose = False , columns = []):
359+ async_job = False , verbose = False , columns = [], row_limit = None ):
360360 """Launches a job
361361 TAP & TAP+
362362
@@ -378,6 +378,10 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
378378 flag to display information about the process
379379 columns: list, optional, default []
380380 if empty, all columns will be selected
381+ row_limit : int, optional
382+ The maximum number of retrieved rows. Will default to the value
383+ provided by the configuration system if not set explicitly. The
384+ value -1 removes the limit entirely.
381385
382386 Returns
383387 -------
@@ -395,7 +399,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
395399 heightQuantity = self .__getQuantityInput (height , "height" )
396400 widthDeg = widthQuantity .to (units .deg )
397401 heightDeg = heightQuantity .to (units .deg )
398-
402+ row_limit = row_limit or self . ROW_LIMIT or conf . ROW_LIMIT
399403 if columns :
400404 columns = ',' .join (map (str , columns ))
401405 else :
@@ -424,7 +428,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
424428 )
425429 ORDER BY
426430 dist ASC
427- """ .format (** {'row_limit' : "TOP {0}" .format (self . ROW_LIMIT ) if self . ROW_LIMIT > 0 else "" ,
431+ """ .format (** {'row_limit' : "TOP {0}" .format (row_limit ) if row_limit > 0 else "" ,
428432 'ra_column' : self .MAIN_GAIA_TABLE_RA , 'dec_column' : self .MAIN_GAIA_TABLE_DEC ,
429433 'columns' : columns , 'table_name' : self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE , 'ra' : ra , 'dec' : dec ,
430434 'width' : widthDeg .value , 'height' : heightDeg .value })
@@ -435,7 +439,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
435439 return job .get_results ()
436440
437441 def query_object (self , coordinate , radius = None , width = None , height = None ,
438- verbose = False , columns = []):
442+ verbose = False , columns = [], row_limit = None ):
439443 """Launches a job
440444 TAP & TAP+
441445
@@ -453,15 +457,21 @@ def query_object(self, coordinate, radius=None, width=None, height=None,
453457 flag to display information about the process
454458 columns: list, optional, default []
455459 if empty, all columns will be selected
460+ row_limit : int, optional
461+ The maximum number of retrieved rows. Will default to the value
462+ provided by the configuration system if not set explicitly. The
463+ value -1 removes the limit entirely.
456464
457465 Returns
458466 -------
459467 The job results (astropy.table).
460468 """
461- return self .__query_object (coordinate , radius , width , height , async_job = False , verbose = verbose , columns = columns )
469+ return self .__query_object (coordinate , radius , width , height ,
470+ async_job = False , verbose = verbose ,
471+ columns = columns , row_limit = row_limit )
462472
463473 def query_object_async (self , coordinate , radius = None , width = None ,
464- height = None , verbose = False , columns = []):
474+ height = None , verbose = False , columns = [], row_limit = None ):
465475 """Launches a job (async)
466476 TAP & TAP+
467477
@@ -479,12 +489,17 @@ def query_object_async(self, coordinate, radius=None, width=None,
479489 flag to display information about the process
480490 columns: list, optional, default []
481491 if empty, all columns will be selected
492+ row_limit : int, optional
493+ The maximum number of retrieved rows. Will default to the value
494+ provided by the configuration system if not set explicitly. The
495+ value -1 removes the limit entirely.
482496
483497 Returns
484498 -------
485499 The job results (astropy.table).
486500 """
487- return self .__query_object (coordinate , radius , width , height , async_job = True , verbose = verbose , columns = columns )
501+ return self .__query_object (coordinate , radius , width , height , async_job = True ,
502+ verbose = verbose , columns = columns , row_limit = row_limit )
488503
489504 def __cone_search (self , coordinate , radius , table_name = None ,
490505 ra_column_name = MAIN_GAIA_TABLE_RA ,
@@ -493,7 +508,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
493508 background = False ,
494509 output_file = None , output_format = "votable" , verbose = False ,
495510 dump_to_file = False ,
496- columns = []):
511+ columns = [], row_limit = None ):
497512 """Cone search sorted by distance
498513 TAP & TAP+
499514
@@ -526,6 +541,10 @@ def __cone_search(self, coordinate, radius, table_name=None,
526541 if True, the results are saved in a file instead of using memory
527542 columns: list, optional, default []
528543 if empty, all columns will be selected
544+ row_limit : int, optional
545+ The maximum number of retrieved rows. Will default to the value
546+ provided by the configuration system if not set explicitly. The
547+ value -1 removes the limit entirely.
529548
530549 Returns
531550 -------
@@ -542,6 +561,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
542561 columns = ',' .join (map (str , columns ))
543562 else :
544563 columns = "*"
564+ row_limit = row_limit or self .ROW_LIMIT or conf .ROW_LIMIT
545565
546566 query = """
547567 SELECT
@@ -561,7 +581,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
561581 ORDER BY
562582 dist ASC
563583 """ .format (** {'ra_column' : ra_column_name ,
564- 'row_limit' : "TOP {0}" .format (self . ROW_LIMIT ) if self . ROW_LIMIT > 0 else "" ,
584+ 'row_limit' : "TOP {0}" .format (row_limit ) if row_limit > 0 else "" ,
565585 'dec_column' : dec_column_name , 'columns' : columns , 'ra' : ra , 'dec' : dec ,
566586 'radius' : radiusDeg , 'table_name' : table_name or self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE })
567587
@@ -586,7 +606,7 @@ def cone_search(self, coordinate, radius=None,
586606 output_file = None ,
587607 output_format = "votable" , verbose = False ,
588608 dump_to_file = False ,
589- columns = []):
609+ columns = [], row_limit = None ):
590610 """Cone search sorted by distance (sync.)
591611 TAP & TAP+
592612
@@ -613,6 +633,10 @@ def cone_search(self, coordinate, radius=None,
613633 if True, the results are saved in a file instead of using memory
614634 columns: list, optional, default []
615635 if empty, all columns will be selected
636+ row_limit : int, optional
637+ The maximum number of retrieved rows. Will default to the value
638+ provided by the configuration system if not set explicitly. The
639+ value -1 removes the limit entirely.
616640
617641 Returns
618642 -------
@@ -628,15 +652,15 @@ def cone_search(self, coordinate, radius=None,
628652 output_file = output_file ,
629653 output_format = output_format ,
630654 verbose = verbose ,
631- dump_to_file = dump_to_file , columns = columns )
655+ dump_to_file = dump_to_file , columns = columns , row_limit = row_limit )
632656
633657 def cone_search_async (self , coordinate , radius = None ,
634658 table_name = None ,
635659 ra_column_name = MAIN_GAIA_TABLE_RA ,
636660 dec_column_name = MAIN_GAIA_TABLE_DEC ,
637661 background = False ,
638662 output_file = None , output_format = "votable" ,
639- verbose = False , dump_to_file = False , columns = []):
663+ verbose = False , dump_to_file = False , columns = [], row_limit = None ):
640664 """Cone search sorted by distance (async)
641665 TAP & TAP+
642666
@@ -665,6 +689,10 @@ def cone_search_async(self, coordinate, radius=None,
665689 flag to display information about the process
666690 dump_to_file : bool, optional, default 'False'
667691 if True, the results are saved in a file instead of using memory
692+ row_limit : int, optional
693+ The maximum number of retrieved rows. Will default to the value
694+ provided by the configuration system if not set explicitly. The
695+ value -1 removes the limit entirely.
668696
669697 Returns
670698 -------
@@ -680,7 +708,7 @@ def cone_search_async(self, coordinate, radius=None,
680708 output_file = output_file ,
681709 output_format = output_format ,
682710 verbose = verbose ,
683- dump_to_file = dump_to_file , columns = columns )
711+ dump_to_file = dump_to_file , columns = columns , row_limit = row_limit )
684712
685713 def __checkQuantityInput (self , value , msg ):
686714 if not (isinstance (value , str ) or isinstance (value , units .Quantity )):
0 commit comments