Yahoo Weather Query by Latitude and Longitude - yql

I want to fetch some weather data via latitude and longitude using yahoo query. but it seems this query is not available now. the query is below:
select * from weather.forecast where woeid in (SELECT woeid FROM geo.placefinder WHERE text="{lat},{lon}" and gflags="R")
is this query is changed to new one or something? or it didn't exist anymore? last time I use this format was about 2 months ago and it worked well. but now it can't fetch any data. result from YQL console is as below:
{
"error": {
"lang": "en-US",
"description": "Tenant 'query_yahooapis_com' access to 'Resource [tenantName=query_yahooapis_com, type=TABLE, name=geo.placefinder, locatorType=FILE, url=/home/y/share/manhattan/application/tenantBundles/yql_query_yahooapis_com_manhattan_v2/YQL-INF/restdefs/geo.placefinder.xml, useUrl=false]' is denied."
}
}
I already make some research, including this post: How to get Yahoo's woeid by location?
Is that true that yahoo already terminate this latitude longitude query for fetching weather?

According to the latest reply to this answer, you should switch to the table geo.places and remove the gflags="R" part.
I tried it in the YQL console and it seems to work:
select * from weather.forecast where woeid in (SELECT woeid FROM geo.places WHERE text="(latitude,longitude)")

This works for me(you should switch to the table geo.places(1)):
...
query = "SELECT * FROM weather.forecast " +
"WHERE woeid in (" +
"SELECT woeid " +
"FROM geo.places(1) " +
"WHERE text=\"(%1$s, %2$s)\") " +
"AND u='c'";
... and then:
query = String.format(query, location.getLatitude(), location.getLongitude());

Related

google ads API , CONTAINS ANY is not a valid operator to use with 'ad_group.name' in WHERE clause

I am trying to fetch google Adwords reporting data (clicks,cost..etc) of specific addGroup with Google Ads Query Language buts saying CONTAINS ANY is not a valid operator to use with 'ad_group.name',
here is my query
"query": "SELECT ad_group.name, metrics.impressions,metrics.clicks FROM ad_group where ad_group.name CONTAINS ANY ('pmp')"
I need to fetch similar addgroup by name similar to SQL like '%%',
there is a LIKE command in GAQL but its working like = , eg for add group = 'test-exam'
this works
"query": "SELECT ad_group.name, metrics.impressions,metrics.clicks FROM ad_group where ad_group.name LIKE ('test-exam')"
but this returns nothing
"query": "SELECT ad_group.name, metrics.impressions,metrics.clicks FROM ad_group where ad_group.name CONTAINS ANY ('test')"
You need to use the SQL percentage syntax for the LIKE statement in GAQL too.
So:
SELECT ad_group.name, metrics.impressions,metrics.clicks
FROM ad_group
WHERE ad_group.name LIKE '%test-exam%'
This works for me.
I think 'CONTAINS' only works with the older AdWords API.

How to define query in solr

I am making a log searching service for business by solr.
I have some problem during query configuration.
I have below data.
message_type, mobile_no, ident_no, resultCode
||CCR, 01012345678, 1, null||
||CCA, null, 1, 5012||
I want to find all records with same ident_no by using mobile_no.
So, I am thinking sql statement like below.
SELECT A.*
FROM DATA
WHERE IDENT_NO IN (SELECT IDENT_NO FROM DATA WHERE MOBILE_NO = ‘01012345678’)
I defined below query for solr.
http://localhost:8983/solr/select?q={!join from=ident_no to=ident_no}mobile_no:01012345678
I didn’t receive the result by using query.
Is this query incorrect?
If you have added field mobile number in your schema.xml,then you can fetch the result by using query as mobile number : 1234567890

SQL API or Fusion Tables searching

I want to search my table in each column I choose. What am I doing wrong?
this is work
SELECT * FROM TABLE_ID WHERE firstname LIKE '%"+ s +"%' ORDER BY id DESC OFFSET "+ start +" LIMIT "+ localStorage.getItem('delimeter'))
this is not
SELECT * FROM TABLE_ID WHERE firstname LIKE '%"+ s +"%' OR lastname LIKE '%"+ s +"%' ORDER BY id DESC OFFSET "+ start +" LIMIT "+ localStorage.getItem('delimeter'))
The Fusion Table API does not support the 'OR' SQL operator, only 'AND'.
You could run two queries and combine the results in the client.

Get Weather information using Yql query lat,long parms

I am using the following YQL query to get weather information
http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json
Is there any way to get weather information using longitude, latitude as YQL query parameter.
You could use a sub-select to go from a latitude/longitude pair to a WOEID like
SELECT * FROM weather.woeid
WHERE w IN (
SELECT place.woeid
FROM flickr.places(1)
WHERE (lat,lon) in (55.948503,-3.198931)
);
(Try in YQL console)
This works for me:
...
query = "SELECT * FROM weather.forecast " +
"WHERE woeid in (" +
"SELECT woeid " +
"FROM geo.places(1) " +
"WHERE text=\"(%1$s, %2$s)\") " +
"AND u='c'";
... and then:
query = String.format(query, location.getLatitude(), location.getLongitude());
I have found some thing use ful; if you need to forcast weather yql use the
SELECT * FROM weather.bylocation WHERE location='Indonesia'
select * from weather.forecast where location=90210

Combining two queries in Yahoo YQL

I want to get the weather information for a specific location.
Right now, I need to calls to get them: The first one translated my current position (lat/lon) to a WOEID, the second call retrieves the Weather information by using that WOEID.
Can I combine those 2 queries?
The first one is:
select * from yahoo.maps.findLocation where q="LAT, LON" and gflags="R"
The second one is:
select * from weather.bylocation where location= WOEID AND unit = 'c'
You can use sub-selects to join data between different queries.
In your case, you can grab the woeid from the yahoo.maps.findLocation table and insert that into a query against the weather.bylocation table as follows:
select *
from weather.bylocation
where unit = 'c' and location in (
select Results.woeid
from yahoo.maps.findLocation
where q="LAT, LON" and gflags="R"
limit 1
)

Resources