@@ -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,8 @@ 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 = [],
360+ row_limit = None ):
360361 """Launches a job
361362 TAP & TAP+
362363
@@ -378,6 +379,10 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
378379 flag to display information about the process
379380 columns: list, optional, default []
380381 if empty, all columns will be selected
382+ row_limit : int, optional
383+ The maximum number of retrieved rows. Will default to the value
384+ provided by the configuration system if not set explicitly. The
385+ value -1 removes the limit entirely.
381386
382387 Returns
383388 -------
@@ -395,7 +400,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
395400 heightQuantity = self .__getQuantityInput (height , "height" )
396401 widthDeg = widthQuantity .to (units .deg )
397402 heightDeg = heightQuantity .to (units .deg )
398-
403+ row_limit = row_limit or self . ROW_LIMIT or conf . ROW_LIMIT
399404 if columns :
400405 columns = ',' .join (map (str , columns ))
401406 else :
@@ -424,7 +429,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
424429 )
425430 ORDER BY
426431 dist ASC
427- """ .format (** {'row_limit' : "TOP {0}" .format (self . ROW_LIMIT ) if self . ROW_LIMIT > 0 else "" ,
432+ """ .format (** {'row_limit' : "TOP {0}" .format (row_limit ) if row_limit > 0 else "" ,
428433 'ra_column' : self .MAIN_GAIA_TABLE_RA , 'dec_column' : self .MAIN_GAIA_TABLE_DEC ,
429434 'columns' : columns , 'table_name' : self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE , 'ra' : ra , 'dec' : dec ,
430435 'width' : widthDeg .value , 'height' : heightDeg .value })
@@ -435,7 +440,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
435440 return job .get_results ()
436441
437442 def query_object (self , coordinate , radius = None , width = None , height = None ,
438- verbose = False , columns = []):
443+ verbose = False , columns = [], row_limit = None ):
439444 """Launches a job
440445 TAP & TAP+
441446
@@ -453,15 +458,22 @@ def query_object(self, coordinate, radius=None, width=None, height=None,
453458 flag to display information about the process
454459 columns: list, optional, default []
455460 if empty, all columns will be selected
461+ row_limit : int, optional
462+ The maximum number of retrieved rows. Will default to the value
463+ provided by the configuration system if not set explicitly. The
464+ value -1 removes the limit entirely.
456465
457466 Returns
458467 -------
459468 The job results (astropy.table).
460469 """
461- return self .__query_object (coordinate , radius , width , height , async_job = False , verbose = verbose , columns = columns )
470+ return self .__query_object (coordinate , radius , width , height ,
471+ async_job = False , verbose = verbose ,
472+ columns = columns , row_limit = row_limit )
462473
463474 def query_object_async (self , coordinate , radius = None , width = None ,
464- height = None , verbose = False , columns = []):
475+ height = None , verbose = False , columns = [],
476+ row_limit = None ):
465477 """Launches a job (async)
466478 TAP & TAP+
467479
@@ -479,12 +491,18 @@ def query_object_async(self, coordinate, radius=None, width=None,
479491 flag to display information about the process
480492 columns: list, optional, default []
481493 if empty, all columns will be selected
494+ row_limit : int, optional
495+ The maximum number of retrieved rows. Will default to the value
496+ provided by the configuration system if not set explicitly. The
497+ value -1 removes the limit entirely.
482498
483499 Returns
484500 -------
485501 The job results (astropy.table).
486502 """
487- return self .__query_object (coordinate , radius , width , height , async_job = True , verbose = verbose , columns = columns )
503+ return self .__query_object (coordinate , radius , width , height ,
504+ async_job = True , verbose = verbose ,
505+ columns = columns , row_limit = row_limit )
488506
489507 def __cone_search (self , coordinate , radius , table_name = None ,
490508 ra_column_name = MAIN_GAIA_TABLE_RA ,
@@ -493,7 +511,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
493511 background = False ,
494512 output_file = None , output_format = "votable" , verbose = False ,
495513 dump_to_file = False ,
496- columns = []):
514+ columns = [], row_limit = None ):
497515 """Cone search sorted by distance
498516 TAP & TAP+
499517
@@ -526,6 +544,10 @@ def __cone_search(self, coordinate, radius, table_name=None,
526544 if True, the results are saved in a file instead of using memory
527545 columns: list, optional, default []
528546 if empty, all columns will be selected
547+ row_limit : int, optional
548+ The maximum number of retrieved rows. Will default to the value
549+ provided by the configuration system if not set explicitly. The
550+ value -1 removes the limit entirely.
529551
530552 Returns
531553 -------
@@ -542,6 +564,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
542564 columns = ',' .join (map (str , columns ))
543565 else :
544566 columns = "*"
567+ row_limit = row_limit or self .ROW_LIMIT or conf .ROW_LIMIT
545568
546569 query = """
547570 SELECT
@@ -561,7 +584,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
561584 ORDER BY
562585 dist ASC
563586 """ .format (** {'ra_column' : ra_column_name ,
564- 'row_limit' : "TOP {0}" .format (self . ROW_LIMIT ) if self . ROW_LIMIT > 0 else "" ,
587+ 'row_limit' : "TOP {0}" .format (row_limit ) if row_limit > 0 else "" ,
565588 'dec_column' : dec_column_name , 'columns' : columns , 'ra' : ra , 'dec' : dec ,
566589 'radius' : radiusDeg , 'table_name' : table_name or self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE })
567590
@@ -586,7 +609,7 @@ def cone_search(self, coordinate, radius=None,
586609 output_file = None ,
587610 output_format = "votable" , verbose = False ,
588611 dump_to_file = False ,
589- columns = []):
612+ columns = [], row_limit = None ):
590613 """Cone search sorted by distance (sync.)
591614 TAP & TAP+
592615
@@ -613,6 +636,10 @@ def cone_search(self, coordinate, radius=None,
613636 if True, the results are saved in a file instead of using memory
614637 columns: list, optional, default []
615638 if empty, all columns will be selected
639+ row_limit : int, optional
640+ The maximum number of retrieved rows. Will default to the value
641+ provided by the configuration system if not set explicitly. The
642+ value -1 removes the limit entirely.
616643
617644 Returns
618645 -------
@@ -628,15 +655,17 @@ def cone_search(self, coordinate, radius=None,
628655 output_file = output_file ,
629656 output_format = output_format ,
630657 verbose = verbose ,
631- dump_to_file = dump_to_file , columns = columns )
658+ dump_to_file = dump_to_file , columns = columns ,
659+ row_limit = row_limit )
632660
633661 def cone_search_async (self , coordinate , radius = None ,
634662 table_name = None ,
635663 ra_column_name = MAIN_GAIA_TABLE_RA ,
636664 dec_column_name = MAIN_GAIA_TABLE_DEC ,
637665 background = False ,
638666 output_file = None , output_format = "votable" ,
639- verbose = False , dump_to_file = False , columns = []):
667+ verbose = False , dump_to_file = False , columns = [],
668+ row_limit = None ):
640669 """Cone search sorted by distance (async)
641670 TAP & TAP+
642671
@@ -665,6 +694,10 @@ def cone_search_async(self, coordinate, radius=None,
665694 flag to display information about the process
666695 dump_to_file : bool, optional, default 'False'
667696 if True, the results are saved in a file instead of using memory
697+ row_limit : int, optional
698+ The maximum number of retrieved rows. Will default to the value
699+ provided by the configuration system if not set explicitly. The
700+ value -1 removes the limit entirely.
668701
669702 Returns
670703 -------
@@ -680,7 +713,8 @@ def cone_search_async(self, coordinate, radius=None,
680713 output_file = output_file ,
681714 output_format = output_format ,
682715 verbose = verbose ,
683- dump_to_file = dump_to_file , columns = columns )
716+ dump_to_file = dump_to_file , columns = columns ,
717+ row_limit = row_limit )
684718
685719 def __checkQuantityInput (self , value , msg ):
686720 if not (isinstance (value , str ) or isinstance (value , units .Quantity )):
0 commit comments