Google Lovefield Relational Query Engine
Written by Kay Ewbank   
Friday, 21 November 2014

Google has released Lovefield. an open source JavaScript SQL-like database library for web developers. You can check it out on GitHub.

Lovefield is a database query engine built using IndexedDB as a backend that gives you a SQL-like declarative syntax to make it easy for developers to learn. You query the database using JavaScript function calls, and the developers say that its declarative form provides immunity to SQL injection attacks, since there is no query parsing involved. The library offers cross browser support for Chrome, Firefox, and IE10.

The case for a SQL data store for web development is an interesting one. Developers can make use of Web Storage, but that’s limited to key-value storage. An alternative is Indexed DB, but it is again object-and lacks traditional relational database features. Earlier versions of Google Chrome used to support the W3C’s WebSQL Database API, but work on this stopped because all the implementations that used WebSQL used SQLite as the back end, and the W3C said that “we need multiple independent implementations to proceed along a standardization path.

The language of Lovefield is a rather limited subset of SQL that lets you write select, insert, update, and delete queries, and provides atomicity for transactions. You can make use of integrity constraint checks using primary keys, unique values, and specify whether columns can be null or not. Aggregation operators include count, min, max, sum, avg, stddev, and distinct. The Select operator can have a Group by clause, and you can set up multi-table joins.

Google says that Lovefield includes a query optimizer that will evaluate different execution plans and pick the most promising. On the Google Open Source blog, Demetrios Papadopoulos of the Chrome team states:

“We are confident that current performance will satisfy the majority of use cases (less than 50k rows) and we plan to further improve the performance for larger datasets in the near future.”

 

Papadopoulos also says that Google is working to provide more advanced features such as foreign keys, cascaded delete/update, self-table join, and observers/data-binding “ in the near future”. There are no plans to add more advanced SQL features such as views, cursors, triggers and subqueries.

According to the blog post, Lovefield is already powering a few Google services, including Google Play Movies Chrome app. The team hopes that by releasing the library to other developers, they’ll enable the development of data-rich applications, and attract interest and feedback from developers. The feedback will be used in working out how to move forward with the project.

Banner


JConference January 2024 Sessions Now Online
23/02/2024

The talks presented at the 4th JChampions Conference which took place between Jan 25 to Jan 30, are now available for free on YouTube. Topics ranged from Code and Tech to Career Advice.



Crazy Clocks
10/03/2024

It's that time again when the clocks change and  time is of the essence and I indulge my interest in crazy clocks. I am always surprised that there are still new ideas for how to display the time [ ... ]


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Friday, 21 November 2014 )