NNAnalytics icon indicating copy to clipboard operation
NNAnalytics copied to clipboard

Document examples of the NNA SQL-like API usage

Open pjeli opened this issue 4 years ago • 0 comments

Just a reminder issue to provide some examples around how to use the SQL page. The following are some example calls:

Some documentation already exists here, but no examples.

Example SQLs to try on your /sql.html endpoint of your NNA instance:

SELECT * FROM files WHERE fileSize = 0 LIMIT 100 -- Example call to find and list 100 random empty files. Return value is a list of file paths.

SELECT * FROM files WHERE fileSize = 0 AND user != pjeli AND group = engineers -- List all empty files not owned by user 'pjeli' and owned by group 'engineers'. Return value is a list of file paths.

SELECT MAX(diskspaceConsumed) FROM files WHERE path LIKE '/tmp/%' AND user != pjeli -- Returns the single biggest files total diskspace consumed under path '/tmp' that is not owned by user 'pjeli'. Return value is an integer.

SELECT user,COUNT(*) FROM files WHERE fileSize = 0 GROUP BY user -- Returns a CSV list of usernames and their respective counts of empty files.

pjeli avatar Jan 05 '21 19:01 pjeli