Search code examples
socrata

Is there a Socrata API method to get the row count of a dataset?


Is there any fast way to get the number of rows in a dataset?

The best idea I can come up with is to do binary probing using $limit and $offset, or maybe some hybrid of binary probing and a final fetch of a single column within a $limit/$offset window when the size is known within, say, 100 or so.

(I checked the HTTP headers... no joy.)


Solution

  • One way you can achieve this is by doing a COUNT(*) operation on the dataset. For example, to get the total row count of this Socrata dataset:
    https://data.seattle.gov/City-Business/Sold-Fleet-Equipment/y6ef-jf2w

    You could issue this SODA query:
    https://data.seattle.gov/resource/y6ef-jf2w.json?$select=count(*)