I was reviewing some of the "Interesting queries on Data Explorer", and saw that the top-voted answer, "How many users can do X?", was broken and obsolete. And, it only had data for Stack Overflow proper -- not any of the dozens of other sites or their metas.

I set about to revive, update, and broaden this query and quickly ran up against some problems:

  1. There is no table of Privileges in the SEDE data. There are tables of Privileges in the API, but that is not usable in SEDE.
  2. Trying to hand-create a table of privileges, like in this query, is not a good option, because of the need to constantly hand-check dozens of sites for changes. (Note that that query's table was based on just a sample of 6 sites and 6 metas.)
  3. There is no way for a SEDE query to know what site's data it is operating on. That means that queries that depend on site-specific data have no way of delivering accurate and concise results. See this query, again, for example.

    As Nick pointed out, DB_NAME() is set to match the source site.

So, Please add a Privileges table to the Data Explorer. Which would return site-specific reputation requirements, just like the API does.

  • 2
    For 1) why does our internal Site ID matter? Keep in mind you can already see where you are with DB_NAME(). For 2) This isn't actually stored strictly in the DB, there are code components so it's not a copy/paste operation, but I can take a look when time allows. – Nick Craver Dec 23 '12 at 23:44
  • @NickCraver, I didn't know that the database name would be set to match the site. (Did I miss some documentation?) Site ID doesn't matter, except that queries should be more efficient matching an integer rather than a string. Anyway, thanks for the info, DB_Name()/DB_ID() should work just fine. And, we can get a list of database names with select name from sys.databases. – Awesome Poodles Dec 24 '12 at 0:40
  • The matching is a side-effect of how I do the import really, but they've always been close. Privileges I don't disagree with but it's not a simple view...we want to re-work how privileges are stored in general, we'll probably get this much cleaner, then get them exported since the export would just have to change. It'll have to wait a bit though...it's currently working so not high up in the to-do queue. – Nick Craver Dec 24 '12 at 1:08
  • @NickCraver, understand the low priority. Fully agree with rework before trying to export. I'll probably use the API to semi-automate generating an all-sites @PrivilegeRequirements SQL, now that I know how to filter down to the current site in queries. – Awesome Poodles Dec 24 '12 at 1:22

You must log in to answer this question.

Browse other questions tagged .