@@ -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,8 @@ 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 = [],
360
+ row_limit = None ):
360
361
"""Launches a job
361
362
TAP & TAP+
362
363
@@ -378,6 +379,10 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
378
379
flag to display information about the process
379
380
columns: list, optional, default []
380
381
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.
381
386
382
387
Returns
383
388
-------
@@ -395,7 +400,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
395
400
heightQuantity = self .__getQuantityInput (height , "height" )
396
401
widthDeg = widthQuantity .to (units .deg )
397
402
heightDeg = heightQuantity .to (units .deg )
398
-
403
+ row_limit = row_limit or self . ROW_LIMIT or conf . ROW_LIMIT
399
404
if columns :
400
405
columns = ',' .join (map (str , columns ))
401
406
else :
@@ -424,7 +429,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
424
429
)
425
430
ORDER BY
426
431
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 "" ,
428
433
'ra_column' : self .MAIN_GAIA_TABLE_RA , 'dec_column' : self .MAIN_GAIA_TABLE_DEC ,
429
434
'columns' : columns , 'table_name' : self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE , 'ra' : ra , 'dec' : dec ,
430
435
'width' : widthDeg .value , 'height' : heightDeg .value })
@@ -435,7 +440,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
435
440
return job .get_results ()
436
441
437
442
def query_object (self , coordinate , radius = None , width = None , height = None ,
438
- verbose = False , columns = []):
443
+ verbose = False , columns = [], row_limit = None ):
439
444
"""Launches a job
440
445
TAP & TAP+
441
446
@@ -453,15 +458,22 @@ def query_object(self, coordinate, radius=None, width=None, height=None,
453
458
flag to display information about the process
454
459
columns: list, optional, default []
455
460
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.
456
465
457
466
Returns
458
467
-------
459
468
The job results (astropy.table).
460
469
"""
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 )
462
473
463
474
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 ):
465
477
"""Launches a job (async)
466
478
TAP & TAP+
467
479
@@ -479,12 +491,18 @@ def query_object_async(self, coordinate, radius=None, width=None,
479
491
flag to display information about the process
480
492
columns: list, optional, default []
481
493
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.
482
498
483
499
Returns
484
500
-------
485
501
The job results (astropy.table).
486
502
"""
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 )
488
506
489
507
def __cone_search (self , coordinate , radius , table_name = None ,
490
508
ra_column_name = MAIN_GAIA_TABLE_RA ,
@@ -493,7 +511,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
493
511
background = False ,
494
512
output_file = None , output_format = "votable" , verbose = False ,
495
513
dump_to_file = False ,
496
- columns = []):
514
+ columns = [], row_limit = None ):
497
515
"""Cone search sorted by distance
498
516
TAP & TAP+
499
517
@@ -526,6 +544,10 @@ def __cone_search(self, coordinate, radius, table_name=None,
526
544
if True, the results are saved in a file instead of using memory
527
545
columns: list, optional, default []
528
546
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.
529
551
530
552
Returns
531
553
-------
@@ -542,6 +564,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
542
564
columns = ',' .join (map (str , columns ))
543
565
else :
544
566
columns = "*"
567
+ row_limit = row_limit or self .ROW_LIMIT or conf .ROW_LIMIT
545
568
546
569
query = """
547
570
SELECT
@@ -561,7 +584,7 @@ def __cone_search(self, coordinate, radius, table_name=None,
561
584
ORDER BY
562
585
dist ASC
563
586
""" .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 "" ,
565
588
'dec_column' : dec_column_name , 'columns' : columns , 'ra' : ra , 'dec' : dec ,
566
589
'radius' : radiusDeg , 'table_name' : table_name or self .MAIN_GAIA_TABLE or conf .MAIN_GAIA_TABLE })
567
590
@@ -586,7 +609,7 @@ def cone_search(self, coordinate, radius=None,
586
609
output_file = None ,
587
610
output_format = "votable" , verbose = False ,
588
611
dump_to_file = False ,
589
- columns = []):
612
+ columns = [], row_limit = None ):
590
613
"""Cone search sorted by distance (sync.)
591
614
TAP & TAP+
592
615
@@ -613,6 +636,10 @@ def cone_search(self, coordinate, radius=None,
613
636
if True, the results are saved in a file instead of using memory
614
637
columns: list, optional, default []
615
638
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.
616
643
617
644
Returns
618
645
-------
@@ -628,15 +655,17 @@ def cone_search(self, coordinate, radius=None,
628
655
output_file = output_file ,
629
656
output_format = output_format ,
630
657
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 )
632
660
633
661
def cone_search_async (self , coordinate , radius = None ,
634
662
table_name = None ,
635
663
ra_column_name = MAIN_GAIA_TABLE_RA ,
636
664
dec_column_name = MAIN_GAIA_TABLE_DEC ,
637
665
background = False ,
638
666
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 ):
640
669
"""Cone search sorted by distance (async)
641
670
TAP & TAP+
642
671
@@ -665,6 +694,10 @@ def cone_search_async(self, coordinate, radius=None,
665
694
flag to display information about the process
666
695
dump_to_file : bool, optional, default 'False'
667
696
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.
668
701
669
702
Returns
670
703
-------
@@ -680,7 +713,8 @@ def cone_search_async(self, coordinate, radius=None,
680
713
output_file = output_file ,
681
714
output_format = output_format ,
682
715
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 )
684
718
685
719
def __checkQuantityInput (self , value , msg ):
686
720
if not (isinstance (value , str ) or isinstance (value , units .Quantity )):
0 commit comments