Any way to put a lid on ODATA queries?

I have a customer with about 330,000 records in their orders table. I was thinking about providing ODATA access, but it doesn’t look too safe. http://localhost:8099/odata/orders will keep going up to 2GB of memory for the server and then die with an out of memory error. I’ve never actually deployed an ODATA service with DA, just played with it, so I’m curious how I would implement defensive programming with it.

Thank you,
Ron

I suppose I could put a TOP command in the SQL rather than let AutoSQL do it for me. Are others here doing that too? I suppose it hasn’t been too much of an issue thus far because I’ve had my GUI restrict people from going crazy. I’m feeling a little uncomfortable at the thought of an end user with PowerPivot going crazy on an OData service, though. :stuck_out_tongue:

Property MaxRecords of ODATA schema dispatcher component handles this. Set it to limit number of records per request (-1 for unlimited). Unfortunately, there is a small bug I’ve just found testing this answer.
If you are using Delphi, you could fix it yourself:
uDAODataDispatcher.pas

// lSimpleRequest.MaxRecords := -1;
lSimpleRequest.MaxRecords := MaxRecords; //fix
lSimpleRequestArr.Add(lSimpleRequest);

  if not VarIsNull(lQuery.Top) then
    lSimpleRequest.MaxRecords := Min(lQuery.Top, MaxRecords);

.NET version will be fixed as soon as possible.
logged as:
52312: DA/D ODATAShemaDispatcher.MaxRecords doesn’t have an effect
52313: OData: Query.Top value is always overridded by Query.MaxRecords

A post was split to a new topic: OData: issue with MaxRecords