[Developers] Write quotas and syncing sandbox

John Giannandrea jg at metaweb.com
Fri Feb 13 06:01:48 UTC 2009


Tom Morris wrote:
> 1. Do writes with "create" : "unless_exists" count against my write
> quota if they return "existed"?  I'm trying to figure out whether I
> need to go to the extra trouble to do a read and check the results
> first in order to make my quota last as long as possible.  Is there a
> way to tell how much quota is left?  When does the counter get reset?

Your quota is part of your user profile, if you have a good reason to  
need it raised, just let us know.  It is not currently enforced on  
sandbox.

The quota is enforced for the last 24 hours (actual time), so to  
compute how much is "left" you need to know how many objects and links  
you wrote in the last 24 hours.
This is a little tricky in MQL, you have to fetch four numbers, the  
number of objects and the number of links now and 24 hours ago, e.g.:

'http://api.freebase.com/api/service/mqlread?queries={"q0":{"query": 
{"creator":"/user/tfmorris","return":"count"}},"q1":{"query":{"type":"/ 
type/link"," creator":"/user/tfmorris","return":"count"}},"q2": 
{"query":{"creator":"/user/ 
tfmorris","return":"count"},"as_of_time":"2009-02-01"},"q3":{"query": 
{"type":"/type/link", "creator":"/user/ 
tfmorris","return":"count"},"as_of_time":"2009-02-01"}}'

Replace 2009-02-01 with 24 hours ago and add the first two numbers and  
subtract the last two numbers and thats what you wrote in the last 24  
hours.

There is also a stats object for each user which has some more data,  
but is only updated once every 24 hours:
{ "primitives_live" : null, "primitives_written" : null,  
"topics_live" : null, "type" : "/freebase/user_activity",  
"types_live" : null, "user" : "/user/tfmorris" }

> 2. Is there a way to extract a "diff" from the production database and
> apply it to the sandbox or are my choices limited to a) writing my own
> tool, b) doing my updates twice or c) waiting for Monday?

Not currently.  Your best bet is write to both places.

-jg



More information about the Developers mailing list