SQL Data Services Adventure – Day 3

By James at November 29, 2008 08:23
Filed Under: SQL Data Services

In the last post I talked about the structure of how SDS stores data. An Authority is geo-located and stores the containers. Multiple Containers can be stored in an Authority and each Container can hold multiple Entities.

I’m tired and need some REST, but after I wash with some SOAP

SQL Data Services support both REST (Representational State Transfer) and SOAP (Simple Object Access Protocol) interfaces which allows the use of practically any language and web development tools. For the rest of this series I will be focusing on interacting with SDS via REST.

Four kinds of URIs (Uniform Resource Identifier) are used when programming SDS with REST. Each of these URIs sets a scope for a set of operation to be performed. Each URI should look familiar by now:

Service – Used when creating and querying authorities

Authority – Used for creating and querying containers and to retrieve metadata regarding particular authorities

Container – Used for creating and querying entities, retrieving metadata about a particular container and for deleting a specific container

Entity – Used when retrieving, updating and deleting specific entities

Figuring out the pieces

Service URI

https://data.database.windows.net/v1/

In the URI above, data.database.windows.net refers to the Service while v1 references the version of the service.

A query can be appended to the end of the URI to query for Authorities which have been created, like this

https://data.database.windows.net/v1/q=’<some really cool query>’

Authority URI

To query against a particular Authority,  you prepend the URI with the name of the Authority you want to work with. For example:

https://duringlunch-01.data.database.windows.net/v1/

returns a single entity which contains metadata about the referenced Authority. The entity returned is XML like this:

   1: <s:Authority 
   2:     xmlns:s="http://schemas.microsoft.com/sitka/2008/03/" 
   3:     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   4:     xmlns:x="http://www.w3.org/2001/XMLSchema">
   5:       <s:Id>PizzaRecipes</s:Id>
   6:       <s:Version>2234</s:Version>
   7: </s:Authority>

As the same with Service URIs you can also append a query to an Authority URI to query against all the Containers in the Authority

https://duringlunch-01.data.database.windows.net/v1/q=’<a query to find containers>’

Container URI

The Container URI returns a single entity which contains metadata about the particular Container and returns the following XML:

   1: <s:Container 
   2:     xmlns:s="http://schemas.microsoft.com/sitka/2008/03/" 
   3:     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   4:     xmlns:x="http://www.w3.org/2001/XMLSchema">
   5:       <s:Id>LatinaSpecial</s:Id>
   6:       <s:Version>1234</s:Version>
   7: </s:Container>

As with Authority URIs appending a query to the end of a Container URI will return all entities which meet the query criteria for the particular Container.

Entity URI

An Entity URI is a Container URI followed by an Entity ID and returns a specific entity

https://duringlunch-01.data.database.windows.net/v1/PizzaRecipes/LatinaSpecial/

   1: <LatinaSpecial
   2:  xmlns:s="http://schemas.microsoft.com/sitka/2008/03/"
   3:  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4:  xmlns:x="http://www.w3.org/2001/XMLSchema">
   5:  <s:Id>LatinaSpecialPizza<s:Id>
   6:  <s:Version>13453</s:Version>
   7:  <s:DisplayName xsi:type="x:string">Latina Special Pizza</s:DisplayName>    
   8:  <Rating xsi:type="x:string">Great</Rating>
   9:  <NumberOfTimesMade xsi:type="x:decimal">250</NumberOfTimesMade>
  10:  <Description xsi:type="x:string">A mouth watering pizza with a Latina flair</Description>
  11:  <Pepperoni xsi:type="x:decimal">30</Pepperoni>
  12:  <Cheese xsi:type="x:decimal">24</Cheese>
  13:  <Crema xsi:type="x:decimal">5</Crema>
  14:  <QuesoFresco xsi:type="x:decimal">40</QuesoFresco>
  15: </LatinaSpecial> 

Security Model

Every Authority has a single user name and password (owner), and once authorized for a specific authority end point, full control over the Authority and the data stored within it is granted. Accounts are secured by SDS issued user credentials and only allows for communication by https.

Next…Query Support

SQL Data Services Adventure – Day 2

By James at November 24, 2008 15:40
Filed Under: SQL Data Services

One of the cool, and frustrating things, about dealing with cutting edge technology is how stuff changes so fast. Some of my links and bookmarks aren’t working until I start hacking the URL to find what it is I thought I had.

I’m going to make a minor change in plans and break my posts into two sub-categories; Hands-on learning and my experiences, and my interpretation of the online materials.

What are SQL Data Services (SDS)?

  1. Providing data and data access as a service.
  2. Highly scalable without having to manage the physical infrastructure.
  3. The capacity of the system is only limited by the amount of data you are putting into it.
  4. Supports REST and SOAP

The SDS data model uses concepts of authorities, containers and entities. The data model has a flexible schema, which make it very easy to create your data structures.

The “ACE” Model.

A is for Authority:

the authority is the topmost level of the hierarchy and is represented by a DNS name. For instance, in the URL, duringlunch.data.database.windows.net, “duringlunch” is the authority, with everything after being the reference to the service. What is cool about this is the authority maps to a specific data center. In other words an authority is a unit of geo-location.

C is for Container

Authorities contain containers. Each of these containers have a unique id associated to them, and store the data used in the application. As authorities are geo-located, so are the containers within them. Containers cannot be in a different geo-location than the authority holding them. Container can have either homogeneous or heterogeneous data.

E is for Entity

Entities are the actual bits of data stored in the container. Each entity stores any number of user-defined properties with the corresponding values. Entities can be retrieved, added, updated, deleted. However partial updates are not supported. When updating, the entire entity is replace in the container.

Homogeneous or Heterogeneous – everyone has a right to what they want.

As mentioned before containers can hold either homogeneous or heterogeneous data. Similar to a table in a database, homogeneous are entities which are all of the same kind. For instance a “Books” container stores all types of “book” entities. A heterogeneous container is more like an entire database with entities of all kinds. An example of a heterogeneous container would hold “book”, “office supply”, “furniture” entities.

Which is better? Hard to say, it depends on what your application needs. For the highly structured applications, use homogeneous containers. Heterogeneous containers allow for querying across all the entities stored in the parent container.

Flexible Entities

The key concept of SDS is the Flexible Entity. Flexible entities are XML fragments with one element per property value. Each property has a name and a value, with the value restricted to a simple scalar type of string, binary, boolean, decimal, or datetime. Each flexible entity has fixed metadata properties of “Id”, “Version”, and “Kind”, with “Version” acting as a timestamp. With each update, a new version is automatically assigned. “Kind” is user-defined, identifying the entity type. Entities can have additional user-defined flexible properties with any name and scalar type of the types listed above.

More soon,

James

SQL Data Services Adventure - Day 1

By James at November 24, 2008 14:36
Filed Under: SQL Data Services

Finally. I’ve been looking forward to this for a while now. Cracking open the VPC I created just for this, get VS2008 setup, re-familiarizing myself with SDS, and starting “Thriller”, I’m off on my adventure.

I decided the best way to get up to speed is to complete the Hands On Labs I started at PDC. You can get the same Azure Services Training kit at http://www.microsoft.com/azure/trainingkit.mspx. Unpacking everything and getting ready is pretty straight forward, and to be honest this is really good training, I’d suggest downloading and following along.

Jumping right into the Intro to SQL Data Services Lab things are fine until “unhandled exception (409) Conflict”. What the heck is that, double, triple, quadruple checking my code, yup, it’s fine. So, heading over to the SDS Forums a quick search returns the following post about how things have changed and Authorities are different now.

Now I’m up and running and got the first Exercise, “Using the REST Interface to Access SDS” complete. This is cool, can’t wait for the next one.

James

B-Side Players - Fire In The Youth - Unplug This Armageddon

Hold Fast Pomade – My first advertising sponsor

By James at November 21, 2008 03:37
Filed Under: Life in General, Non-Technical

My blog is the most popular on the interwebs. It gets so many hits a day, just now eclipsing 3.56 billion, it’s totally amazing to see the hit counters spin and watch how many ones and zeroes are zipped back and forth. Just freaking amazing. And while it’s cool to have so many fans, there is one drawback. I have to setup a new server every week. I know about virtualization and cloud computing, and all that other fancy schmancy technology, but I like to have total control over things. Thinking perhaps there was a way to offset the costs of having to build an entire server, and such, I decided to do what some of those other so called “web loggers” are doing and put an advertisement up. So I called my good friend – good is an understatement, he’s like my brother – Josh Highland.

Josh is an interweb guru, and has so many sites up, he almost comes close to my 3.56 billion hits a day. However, more importantly, is Josh’s ability to come up with ideas for real, tangible things. He has this new product, Hold Fast Pomade, which is taking the hair care product market by storm. Hold Fast Pomade is so popular, the parent company, Hold Fast Products has already come out with a new product line…wait for it… T_SHIRTS! Nice.

So, with that said, I am proud to offer you my first advertising sponsor – Hold Fast Pomade.

Show some interweb click love and give Hold Fast a try. Just click on the ad banner at the bottom of each page.

Word,

James

Postscript. Ok, perhaps 3.56 billion hits a day is a tiny exaggeration, its more like 3.56 hits per month. But Josh is a great friend, and I want to help him out where I can. And Hold Fast Pomade, really is, a great product.

J

The SQL Data Services adventure begins

By James at November 18, 2008 08:30
Filed Under: SQL Data Services

My great friend and mentor, Lynn Langit has asked me to present on SQL Data Services for geekSpeak on January 14th, 2009. Follow along as I learn as much as I can leading up to my presentation.

Wish me luck,

James

Dexter

By James at November 15, 2008 12:50
Filed Under: Life in General

During our travels today, running errands and such, we tried to stick to our game plan. Home Depot for potting soil, Wet Pets for crickets, Petco for dog food. Thinking it would be best to hit Petco first, we started off there. Walking into the store we ran across puppies for adoption. Schnauzer/Wire-haired terrier mixes. Needless to say, we fell in love. We get him on Wednesday, after his, ahem, surgery.

Everyone meet Dexter. Dexter, meet everyone.

How can you not love those ears?

I think we get all these animals ‘cuz we’re never going to get grandchildren.

latringo.com

By James at November 06, 2008 02:47
Filed Under:

Those who know me, know I’m full of ideas. Some are dumb while some really shine. And for some reason this time, I am stuck in the middle. I came up with the absolute most coolest domain name ever, but can’t figure out what to do with it. It is such a Web 2.5 (beta) name, it’s gotta be great, and I’m having a heck of a time nailing it down.

So, I need some help. Give me some ideas on what do with the name, what kind of site/service it would/could/should be.

Ready? Here’s the name…

latringo.com, from my background and family history, a combination of “latino” and “gringo”.

So, what do you think? Help me out, and you *know* I’ll treat you right.

James

BizSpark – Free Software for Startups

By James at November 06, 2008 02:41
Filed Under: Web Development

Microsoft just launched a new site aimed at helping out startups develop their ideas into innovative and kick ass products. Just like Windows Azure will help in keeping costs down for the new businesses and their IT infrastructure, BizSpark eliminates the high costs of purchasing software, and frees up the creativity to build out the ideas.

Of course there are some “gotcha’s”, but they appear to be pretty minimal.

More information can be found on the Microsoft Startup Zone site. http://www.microsoftstartupzone.com/BizSpark/Pages/At_a_Glance.aspx

I love the direction that Microsoft is leaning towards. Go check it out!

James

Enough said

By James at November 04, 2008 15:34
Filed Under: Life in General

“If there is anyone out there who doubts that America is a place where anything is possible, who still wonders if the dream of our founders is alive in our time, who still questions the power of our democracy, tonight is your answer.”

Barack Obama

November 4, 2008

I can’t remember a time when I was happier to be an American.

J

Is this being too much of a geek?

By James at November 02, 2008 06:57
Filed Under: Web Development, Life in General

With the announcement of Windows Azure, lots of people started grabbing domains relating to Azure. How geeky is this?

00AFFF.com

Guess who owns it?

Interestingly enough, Microsoft registered azure.com 14 years ago.

James

About the author

James James is a five time and current Microsoft MVP in Client App Development, a Telerik Insider, a past Director on the INETA North America Board, a husband and dad, and has been developing software since the early days of Laser Discs and HyperCard stacks. As the Founder and President of the Inland Empire .NET User's Group, he has fondly watched it grow from a twice-a-month, early Saturday morning group of five in 2003, to a robust and rambunctious gathering of all types and sizes of .NET developers.

James loves to dig deep into the latest cutting edge technologies - sometimes with spectacular disasters - and spread the word about the latest and greatest bits, getting people excited about developing web sites and applications on the .NET platform, and using the best tools for the job. He tries to blog as often as he can, but usually gets distracted by EF, LINQ, MVC, ASP, SQL, XML, and most other types of acronyms. To keep calm James plays a mean Djembe and tries to practice his violin. You can follow him on twitter at @latringo.

And as usual, the comments, suggestions, writings and rants are my own, and really shouldn't reflect the opinions of my employer. That is, unless it really does.

James Twitter Feed

Recent Comments

Comment RSS

Month List