Invoking an Open Data Table Definition within YQL
If you want to access external data that is not provided through the standard YQL set of
tables (accessible through the show tables query), YQL provides the
use statement when you want to import external tables defined through your Open
Data Table definition.
Invoking a Single Open Data Table
You can access a single Open Data Table using the USE and AS
verbs:
Tip
The AS verb in the above example is optional. If you omit the
AS verb, YQL uses the filename (without the .xml file ending) to
name the table.
In the above query, USE precedes the location of the Open Data Table
definition, which is then followed by AS and the table as defined within your
Open Data Table definition. After the semicolon, the query is formed as would be any other YQL
query. YQL fetches the URL above and makes it available as a table named mytable
in the current request scope. The statements following use can then select
or describe the particular table using the name mytable.
Invoking Multiple Open Data Tables
You can also specify multiple Open Data Tables by using multiple USE
statements in the following manner:
Invoking Multiple Open Data Tables as an Environment
An easier way to use multiple Open Data Tables is to write or use a YQL environment
file, which allows you to use multiple tables at once without the USE verb in
your YQL statements.
An environment file is simply a text file that contains a list of USE and
SET statements, typically ending with a ".env" suffix.
Here is how an environment file can look:
Tip
The AS verb in the above example is optional. If you omit the
AS verb, YQL uses the filename (without the .xml file ending) to
name the table.
Once you upload the environment file to your server, you can simply access the YQL console and append the location of the file as follows:
http://developer.yahoo.com/yql/console/?env=http://datatables.org/alltables.env
Try this example in the YQL console
Tip
You can include multiple environment files at once by using multiple “env” query parameters. These are loaded in the order they appear in the query string.

