Archive

Posts Tagged ‘pipes’

YQL – makes you want to hack more

September 5, 2009 Leave a comment

Yahoo! Query Language (YQL)

YQL is a SQL like Query Language developed by Yahoo! to provide a single interface for all the properties of Yahoo! which have exposed their APIs. The best part of YQL (unlike most of the other (*)QLs) is the concept of open tables, in addition to the 50+ Yahoo tables. You can as well fetch a RSS feed, select what is required, massage them and display it.

What makes YQL even more attractive then other (*)QLs is the Console. Developers can type their queries in the console, test them and get the REST URL for the query.

For quick understanding, let us say that a developer has to:
1. Search for photos from Flickr Search the web for data, photos
2. Search for local business
3. Fetch weather info
4. Fetch(add) events from(to) Upcoming
5. Fetch contacts, updates, profiles from profiles (social)
6. Fetch RSS and render it

The developer can use YQl for the above operations. Sample YQL queries are as below:
1. Flickr photo search
select * from flickr.photos.search where text=’Angelina’
2. Search the web
select title, abstract from search.web where query=’Taj mahal’
3. Read RSS
select title from rss where url=’http://twitter.com/statuses/user_timeline/15722583.rss’
4. Read from a HTML page
select * from html where url=’www.harsharv.com’ and xpath=’//body/div[@id=”doc2″]/div[1]/h1′
5. Social: Fetch contacts for a user
select fields.value from social.contacts where guid=[the guid]
6. Social: Updates for a user
select * from social.updates where guid=[the guid]

Other SQL commands like limit, in, joins, sub-queries, unique hold good too.

Overall, YQL is one of the big hit promises that Yahoo! has shown recently. I personally appreciate and love it. It makes me want to hack more. I will use YQL in situations where I would use pipes.

More examples can be found and tried at http://developer.yahoo.com/yql/console

The documentation can be found at http://developer.yahoo.com/yql/guide

Advertisements