IPGeo Example 1: IP Database Stored as ML Engine File - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantage™

This example requires that the files MaxMindLite.jar, GeoLiteCity.dat, and GeoLiteCityv6.dat are installed on the ML Engine.

Input

ipgeo_1
id ip
1 159.41.1.23
2 153.65.16.10
3 75.36.209.106
4 202.106.0.20
5 69.236.77.51
6 168.187.7.114

SQL Call

SELECT * FROM IPGeo (
  ON ipgeo_1
  USING
  IpAddressColumn ('ip')
  Converter('MaxMindLite.jar',
            'com.asterdata.sqlmr.analytics.location.ipgeo.MaxMindLite')
  Accumulate ('id', 'ip')
) AS dt ORDER BY 1;

Output

id ip country_code country_name state city postal_code latitude longitude isp organization organization_type area_code metro_code dma_code
1 159.41.1.23 US United States Michigan Saint Joseph 49085 42.0569 -86.4563       269 588 588
2 153.65.16.10 US United States Ohio Miamisburg 45342 39.6182 -84.2488       937 542 542
3 75.36.209.106 US United States California San Francisco   37.7749 -122.4194       415 807 807
4 202.106.0.20 CN China Beijing Beijing   39.9289 116.3883       0 0 0
5 69.236.77.51 US United States California San Francisco   37.7749 -122.4194       415 807 807
6 168.187.7.114 KW Kuwait Al Kuwayt Kuwait   29.3697 47.9783       0 0 0