Sep 9, 2009

OpenBD Google App Engine and cfc's

In my previous OpenBD on Google App Engine post I mention there is no relational database ( yet ) for OpenBD on GAE. There is however the ability to write and save objects directly to Googles Data Store. This sort of feels like working with an ORM but it's even more abstracted as there is not actual database that we can see but we can put objects in this place and run simple queries against the data sets.

Here is a code snippet:

Persisting Data:


Notice I must use variable.VariableName rather then cfproperty name="variableName this is explained here.

Here is a small application to demonstrate this in action:

Click Here for a live demo.
( Yes it looks like UniCode just works :) )

Being that it lives on Googles servers the application should be very fast and I expect Googles connections to be very fast you'll notice I do a cfhttp call in every page request you almost don't even notice it's happening.

I really have no metrics to judge/comment on the performance of the datastore but I am working on a project with Rob Parkhill which will make use of the datastore or the SQL engine that's being built so I may have something to report in a few weeks/months.

Here is the official OpenBD wiki entries on the datastore.

Here is the sample app code:




Visitor.cfc

9 comments:

  1. Thanks Paul. Another good post
    ReplyDelete
  2. Good stuff! A couple of things to keep in mind:

    1) The OpenBD-GAE API you're using was developed before the CF9 public beta was released. We plan to implement syntax that's compatible with the CF9 ORM feature; for example, GoogleWrite() will become EntitySave(), and GoogleRead() will become EntityLoad(). This will allow you to write portable applications.

    2) The relational database support we're building for OpenBD-GAE is primarily intended for porting of existing applications. For new applications, using the ORM-like features of the Google datastore is recommended because it will perform and scale much better.

    Vince Bonfanti
    ReplyDelete
  3. @Vince that's great news. I really like the Google Datastore and knowing it will scale well has made up my mind already.
    ReplyDelete
  4. Why the images of code rather than just text?
    ReplyDelete
  5. My syntax highlighter was not being friendly and it was just easier. If you would like the code I will be happy to place it som where for download.
    ReplyDelete
  6. Could you post the code? I keep getting a CFML Runtime Error: variables.country doesn't exist.
    ReplyDelete
  7. The code is the same as attached. Perhaps in vehicle.cfc you forgot to declare a variable?
    ReplyDelete