YQL new features
We pushed a shiny new (to use Nagesh’s terms) YQL out yesterday and here’s a quick overview of the new things (beyond fixes mainly to the HTML and XHTML handling). Our docs are about to catch up but for those of you interested in the new feature list, here we go:
- @var substitution from GET query string. YQL will “prepare” statements by replacing all @var literal values with the same named value in the query parameters. For example:
http://query.yahooapis.com/v1/yql?name=dog&q=select * from sometable where name=@name
Will result in the following statement being executed:
select * from sometable where name="dog"
- (literal) sets. Literal arrays of strings or ints can be used in the IN () clause, for example:
select * from social.profile where guid in ("1234","5566","123121");
- (field list) IN (select keys). The left hand side of an IN can how accept a list of fields in addition to a single field, and a sub-select within the right hand side of an IN can now return multiple scalars (from leaf values). The upshot is you can now join using multiple keys (not just a single one):
select * from local.search where (latitude,longitude) in (select centroid.latitude, centroid.longitude from geo.places where text="north beach, san francisco") and radius=1 and query="pizza" and location=""
- Sanitize output. Added a ’sanitize’ post-select function that will attempt to sanitize the output for HTML safe rendering (stripping certain tags, cooking data etc). To sanitize the entire document:
select * from atable | sanitize()To sanitize a specific field:
select * from atable | sanitize(field='foo')