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

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

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