This query is to find geolocation of an IP address including latitude, longitude, city and country.
Legacy SQL doesn't support range conditions such as BETWEEN
when using JOIN
, so we need to filter data by WHERE
.
This means if IP address does not match any of the data inside geolite_city_bq_b2b
, records will not be able to receive.
Use Standard SQL if you want to receive records no matter you succeed to find geolocation or not.
Please refer to the following post for more detail.
https://cloudplatform.googleblog.com/2014/03/geoip-geolocation-with-google-bigquery.html
@cheikhdjibrilla
Unfortunately, it looks like google removed the table from public data.
I don't remember the structure of the table schema, but the original data was provided by MAXMIND.
May be you can find the table schema from the following site.
https://dev.maxmind.com/geoip/geoip2/geolite2/