330 likes | 338 Views
This overview will cover:- YQL SELECT, INSERT, UPDATE and DELETE query Syntax- Open Data Tables- YQL Execute
E N D
Jonathan LeBlanc – Technology Evangelist Yahoo! Developer Network Twitter: @jcleblanc 1
YQL Query Structure SELECT * FROM Internet 3
YQL Test Console Available At: http://developer.yahoo.com/yql/console 4
Running Queries - SELECT Query Structure SELECTmyColumn, myTitle FROM myTable(0, 50) WHEREmyColumn = 'value' ANDmyTitle = 'title„ LIMIT3 OFFSET 10 | sort(field='myColumn') | reverse() 5
Running Queries - INSERT Query Structure INSERT INTObitly.shorten (login, apiKey, longUrl) VALUES (‟ME', 'API_KEY', 'http://yahoo.com') 6
Running Queries - UPDATE Query Structure UPDATE social.profile.status SETstatus="Using YQL UPDATE" WHEREguid=“NJFIDHVPVVISDXZKT7UKED2WHU” 7
Running Queries - DELETE Query Structure DELETE FROM twittertable WHERE tweetid="12345" AND username="twitter_username" AND password="twitter_password 8
Running Queries– Sub-selects with the IN clause SELECT * FROM table WHERE field IN (SELECT * FROM table) SELECT * FROM flickr.photos.search WHERE (lat, lon) IN (SELECT centroid.latitude, centroid.longitude FROM geo.places WHERE text="SFO") 9
Running Queries – Available Tables YQL Command: SHOW Tables Number of Standard Tables: 108 Number of Community Tables: 521 Total Number of Tables: 629 Contribute Tables to: http://www.github.com/yql/yql-tables/ 10
Running Queries – Table Syntax YQL Command: DESC tablename 11
Running Queries– URL Format http://query.yahooapis.com/v1/yql?[params] http://query.yahooapis.com/v1/public/yql?[params] Params • q=[QUERY] • format=[XML / JSON] • diagnostics=[true / false] • debug=[true / false] • env=[.env file link] • callback=[function name] 12
Running Queries– URL Format http://query.yahooapis.com/v1/yql?[params] http://query.yahooapis.com/v1/public/yql?[params] Params • q=[QUERY] • format=[XML / JSON / JSONP / JSONP-X] • diagnostics=[true / false] • debug=[true / false] • env=[.env file link] • callback=[function name] 13
YQL Open Data Tables Wrap Your Own API or Data Source 15
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/tabl e.xsd"> <meta></meta> <bindings></bindings> </table> 16
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/tabl e.xsd"> <meta></meta> <bindings></bindings> </table> 17
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <author>Jonathan LeBlanc</author> <description>My Table</description> <documentationURL>www.site.com</documentationURL> <sampleQuery>SELECT * FROM {table} </sampleQuery> </meta> <bindings></bindings> </table> 18
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/tabl e.xsd"> <meta></meta> <bindings></bindings> </table> 19
Open Data Tables – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls> <urlenv="all”>http://www.site.com/{user}</url> </urls> <inputs> <key id="user" type="xs:string" paramType="path" required="true" /></inputs> </select> </bindings> </table> 20
Google Buzz Table Available At: http://github.com/yql/yql-tables
Open Data Tables – Invoking a Table Definition The USE clause USE 'http://github.com/yql/yql- tables/raw/master/google/google.buzz.upd ates.xml' AS buzz.updates; SELECT * FROM buzz.updates WHERE user='nakedtechnologist' 22
Open Data Tables – .env Files http://datatables.org/alltables.env USE 'http://www.datatables.org/amazon/amazon.ecs.xml' AS amazon.ecs; USE 'http://www.datatables.org/bitly/bit.ly.shorten.xml' AS bit.ly.shorten; USE 'http://www.datatables.org/dopplr/dopplr.auth.xml' AS dopplr.auth; USE 'http://www.datatables.org/dopplr/dopplr.city.info.xml' AS dopplr.city.info; 23
YQL Execute Extending Open Data Tables 24
YQL Execute – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" > <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls></urls> <inputs></inputs> </select> </bindings> </table> 25
YQL Execute – XML File Syntax <?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" > <meta></meta> <bindings> <select itemPath="" produces="XML" > <urls></urls> <inputs></inputs> <execute></execute> </select> </bindings> </table> 26
Global Disaster Alert and Coordination System Table Available At: http://github.com/yql/yql-tables
Netflix Movie Search Table Available At: http://github.com/yql/yql-tables
http://events.carsonified.com/fowa/2010/miami Session Information Time: 9:00am – 12:30pm Session: Hands on workshop on how to build applications using YQL Free YQL Workshop Date: 02/24/2010 Address: Adrienne Arsht Centre 1300 Biscayne Blvd Miami, Florida 33132
This Presentation http://www.slideshare.net/jcleblanc YQL Documentation http://developer.yahoo.com/yql YQL Console http://developer.yahoo.com/yql/console YQLGithub Account (Contribute Tables) http://github.com/yql/yql-tables
Thank You Questions? 33