Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Limit Rows in NasaExoplanetArchive? #2974

Open
duruburak opened this issue Mar 26, 2024 · 2 comments
Open

How to Limit Rows in NasaExoplanetArchive? #2974

duruburak opened this issue Mar 26, 2024 · 2 comments

Comments

@duruburak
Copy link

I'm trying to limit the number of rows that the query gives me.

This doesn't work, any ideas on how to do it?

NasaExoplanetArchive.query_criteria(table="stellarhosts",`orderby="sy_pnum desc", count=3)
@bsipocz
Copy link
Member

bsipocz commented Mar 27, 2024

cc @rickynilsson - maybe an example for this could be added to the docs?

@mfixstsci
Copy link
Contributor

@bsipocz I found this one too. COUNT will return the number of rows returned from a query where TOP will return the first however many number of rows from a query a user specifies. When I tried passing top instead of count:

NasaExoplanetArchive.query_criteria(table="stellarhosts",orderby="sy_pnum desc", top=20)

<QTable masked=True length=20>
      hostname        hd_name   hip_name     tic_id    ... st_rotplim           gaia_id            cb_flag        sky_coord       
                                                       ...                                                         deg,deg        
       str20            str9      str9       str13     ...   int32               str28              int32          SkyCoord       
-------------------- --------- --------- ------------- ... ---------- ---------------------------- ------- -----------------------
           Kepler-79                     TIC 239306681 ...          0 Gaia DR2 2076085318570299136       0  300.5171067,44.3815508
         Kepler-1073                     TIC 138568416 ...          0 Gaia DR2 2052069201482198784       0  294.1527259,38.2330886
          Kepler-495                     TIC 120692092 ...          0 Gaia DR2 2100073393808483328       0  285.9307362,39.0981201
          Kepler-101                      TIC 48304653 ...          0 Gaia DR2 2131709921047710336       0   283.255507,48.3552474
           Kepler-91                     TIC 352011875 ...          0 Gaia DR2 2105909326647414400       0  285.6729033,44.1167513
         Kepler-1997                     TIC 273372570 ...          0 Gaia DR2 2080296757338392576       0  297.4808253,46.5891373
          Kepler-540                     TIC 159452015 ...          0 Gaia DR2 2127008611187043456       0  290.6249953,44.8737757
         Kepler-1372                     TIC 158843824 ...          0 Gaia DR2 2127136605512921600       0  288.8865895,44.8394672
         Kepler-1627                     TIC 120105470 ...          0 Gaia DR2 2103737241426734336       0  284.0566675,41.5767277
         Kepler-1152                     TIC 159382189 ...          0 Gaia DR2 2126870351901388672       0  290.4341483,44.1077802
         Kepler-1628                     TIC 123362984 ...          0 Gaia DR2 2105245187265625728       0  281.6336936,43.4115547
 OGLE-2018-BLG-0596L                                   ...          0                                    0 269.0555417,-29.1990833
  KMT-2021-BLG-0171L                                   ...          0                                    0 269.2416667,-30.0930556
          Kepler-978                     TIC 158317637 ...          0 Gaia DR2 2105597825559486336       0  286.7107166,43.0433585
OGLE-2007-BLG-349L A                                   ...          0                                    1  271.351807,-26.4219437
           alf Cen A HD 128620 HIP 71683 TIC 471011145 ...          0                                    0 219.9204103,-60.8351471
            HD 62509  HD 62509 HIP 37826 TIC 423088367 ...          0                                    0    116.328824,28.026127
   MOA-2019-BLG-008L                                   ...          0                                    0  267.982875,-29.9897306
   MOA-2010-BLG-117L                                   ...          0                                    0   271.95697,-25.3446388
          Kepler-914                     TIC 159386728 ...          0 Gaia DR2 2127019915540964224       0  290.4120774,44.8993227

I do see an example where TOP is used when passing some raw SQL in example two but I could add this example using the API if you think that is useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants