@@ -41,7 +41,7 @@ class GaiaClass(TapPlus):
41
41
MAIN_GAIA_TABLE = None
42
42
MAIN_GAIA_TABLE_RA = conf .MAIN_GAIA_TABLE_RA
43
43
MAIN_GAIA_TABLE_DEC = conf .MAIN_GAIA_TABLE_DEC
44
- ROW_LIMIT = conf . ROW_LIMIT
44
+ ROW_LIMIT = None
45
45
VALID_DATALINK_RETRIEVAL_TYPES = conf .VALID_DATALINK_RETRIEVAL_TYPES
46
46
47
47
def __init__ (self , tap_plus_conn_handler = None ,
@@ -356,7 +356,7 @@ def get_datalinks(self, ids, verbose=False):
356
356
return self .__gaiadata .get_datalinks (ids = ids , verbose = verbose )
357
357
358
358
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 ):
360
360
"""Launches a job
361
361
TAP & TAP+
362
362
@@ -378,6 +378,10 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
378
378
flag to display information about the process
379
379
columns: list, optional, default []
380
380
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.
381
385
382
386
Returns
383
387
-------
@@ -395,7 +399,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
395
399
heightQuantity = self .__getQuantityInput (height , "height" )
396
400
widthDeg = widthQuantity .to (units .deg )
397
401
heightDeg = heightQuantity .to (units .deg )
398
-
402
+ row_limit = row_limit or self . ROW_LIMIT or conf . ROW_LIMIT
399
403
if columns :
400
404
columns = ',' .join (map (str , columns ))
401
405
else :
@@ -424,7 +428,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
424
428
)
425
429
ORDER BY
426
430
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 "" ,
428
432
'ra_column' : self .MAIN_GAIA_TABLE_RA , 'dec_column' : self .MAIN_GAIA_TABLE_DEC ,
429
433
'columns' : columns , 'table_name' : self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE , 'ra' : ra , 'dec' : dec ,
430
434
'width' : widthDeg .value , 'height' : heightDeg .value })
@@ -435,7 +439,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
435
439
return job .get_results ()
436
440
437
441
def query_object (self , coordinate , radius = None , width = None , height = None ,
438
- verbose = False , columns = []):
442
+ verbose = False , columns = [], row_limit = None ):
439
443
"""Launches a job
440
444
TAP & TAP+
441
445
@@ -453,15 +457,21 @@ def query_object(self, coordinate, radius=None, width=None, height=None,
453
457
flag to display information about the process
454
458
columns: list, optional, default []
455
459
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.
456
464
457
465
Returns
458
466
-------
459
467
The job results (astropy.table).
460
468
"""
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 )
462
472
463
473
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 ):
465
475
"""Launches a job (async)
466
476
TAP & TAP+
467
477
@@ -479,12 +489,17 @@ def query_object_async(self, coordinate, radius=None, width=None,
479
489
flag to display information about the process
480
490
columns: list, optional, default []
481
491
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.
482
496
483
497
Returns
484
498
-------
485
499
The job results (astropy.table).
486
500
"""
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 )
488
503
489
504
def __cone_search (self , coordinate , radius , table_name = None ,
490
505
ra_column_name = MAIN_GAIA_TABLE_RA ,
@@ -493,7 +508,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
493
508
background = False ,
494
509
output_file = None , output_format = "votable" , verbose = False ,
495
510
dump_to_file = False ,
496
- columns = []):
511
+ columns = [], row_limit = None ):
497
512
"""Cone search sorted by distance
498
513
TAP & TAP+
499
514
@@ -526,6 +541,10 @@ def __cone_search(self, coordinate, radius, table_name=None,
526
541
if True, the results are saved in a file instead of using memory
527
542
columns: list, optional, default []
528
543
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.
529
548
530
549
Returns
531
550
-------
@@ -542,6 +561,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
542
561
columns = ',' .join (map (str , columns ))
543
562
else :
544
563
columns = "*"
564
+ row_limit = row_limit or self .ROW_LIMIT or conf .ROW_LIMIT
545
565
546
566
query = """
547
567
SELECT
@@ -561,7 +581,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
561
581
ORDER BY
562
582
dist ASC
563
583
""" .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 "" ,
565
585
'dec_column' : dec_column_name , 'columns' : columns , 'ra' : ra , 'dec' : dec ,
566
586
'radius' : radiusDeg , 'table_name' : table_name or self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE })
567
587
@@ -586,7 +606,7 @@ def cone_search(self, coordinate, radius=None,
586
606
output_file = None ,
587
607
output_format = "votable" , verbose = False ,
588
608
dump_to_file = False ,
589
- columns = []):
609
+ columns = [], row_limit = None ):
590
610
"""Cone search sorted by distance (sync.)
591
611
TAP & TAP+
592
612
@@ -613,6 +633,10 @@ def cone_search(self, coordinate, radius=None,
613
633
if True, the results are saved in a file instead of using memory
614
634
columns: list, optional, default []
615
635
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.
616
640
617
641
Returns
618
642
-------
@@ -628,15 +652,15 @@ def cone_search(self, coordinate, radius=None,
628
652
output_file = output_file ,
629
653
output_format = output_format ,
630
654
verbose = verbose ,
631
- dump_to_file = dump_to_file , columns = columns )
655
+ dump_to_file = dump_to_file , columns = columns , row_limit = row_limit )
632
656
633
657
def cone_search_async (self , coordinate , radius = None ,
634
658
table_name = None ,
635
659
ra_column_name = MAIN_GAIA_TABLE_RA ,
636
660
dec_column_name = MAIN_GAIA_TABLE_DEC ,
637
661
background = False ,
638
662
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 ):
640
664
"""Cone search sorted by distance (async)
641
665
TAP & TAP+
642
666
@@ -665,6 +689,10 @@ def cone_search_async(self, coordinate, radius=None,
665
689
flag to display information about the process
666
690
dump_to_file : bool, optional, default 'False'
667
691
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.
668
696
669
697
Returns
670
698
-------
@@ -680,7 +708,7 @@ def cone_search_async(self, coordinate, radius=None,
680
708
output_file = output_file ,
681
709
output_format = output_format ,
682
710
verbose = verbose ,
683
- dump_to_file = dump_to_file , columns = columns )
711
+ dump_to_file = dump_to_file , columns = columns , row_limit = row_limit )
684
712
685
713
def __checkQuantityInput (self , value , msg ):
686
714
if not (isinstance (value , str ) or isinstance (value , units .Quantity )):
0 commit comments