Some SDS basics

I just thought I’d share some basic notes on SQL Data Services that I took while reading through a few pages on MSDN and doing a few of the labs. Head to SQL Data Services (SDS) on MSDN for all the documentation, or hit the portal SDS portal for the SDK and heaps more.


  • Authority – the unique name of the service. This is how the service is referenced, e.g. an authority name of ducas-authority would be represented by the DNS Authorities can only contain lowercase letters (a-z), numbers (0-9) and hyphens.


  • Container – a store for data/entities. These are “buckets” of objects that can be used without worrying about any schema. In this release cross-container queries are not supported.


  • Entity – an object with user-defined properties and values that is stored inside a container. Entities can be blog or non-blob both of which have metadata properties. A non-blob entity will have Id, Version and Kind properties and a blob entity will also have the Content property. Non-blob entites have flexible properties that are of the scalar types string, binary, boolean, decimal and date time.


  • URI Space – when using REST for SDS, you deal with Service, Authority, Container and Entity URIs. Querying the URIs will return POX that defines the results.
    • The Service URI that allows you to create and query your Authorities is
    • The Authority URI depends on your authority name and can be used to create or query for containers – https://<authority-name&gt;
    • The Container URI allows you to create and query entities in the container – https://<authority-name&gt;<container-name>.
    • The Entity URI allows you to retrieve, update and delete an entity – https://<authority-name&gt;<container-name>/<entity-id>.


  • Queries – iterate over a scope and return a POX representation of the results. The general syntax for querying entities is “from e in entities [where condition] [orderby property1] select e”. Flexible properties are stored in a property collection and most be quiered using a string indexer (e.g. e[“Age”] == 32) whereas metadata properties are on the object (e.g. e.Id == “someId”).
    • Using SOAP, the authority scope must be defined. Use the proxy’s Get method to get an entity or Query method to query the scope.
    • Using REST, the URI must be well formed for the scope of the query. The actual query is appended to the URI, e.g.’from e in entities select e’.
    • The default page size of a result set is 500 entities.
    • Take can be used to specify the number of results to return (as long as it’s less than 500) – (from e in entities orderby e[“Author”], e.Id select e).Take(10)
    • OfKind can be used as a shortcut to specifying the Kind of an entity – from o in entities where o.Kind == “Order” is the same as from o in entities.OfKind(“Order”)
    • Joins can be performed on entities in the same container by specifying multiple from clauses – from c in entities.OfKind(“Customer”) where c[“Name”] == “Customer 1” from o in entities.OfKind(“Order”) where o[“CustomerId”] == c.Id select o

Posted on 13 November, 2008, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: