IPInfo Geolocation Data (country
and asn
)
This repository contains IP address data powered by IPInfo. It was sourced by downloading the CSV files from IPInfo Data Download on Mar 1, 2023.
There are two tables, corresponding to their respective IPInfo Data Downloads: asn
and country
.
For full details on their schema, see the IPInfo Release Blog Post.
Note: The columns are all VARCHAR
but you can cast them to inet
, cidr
, etc. as required in your queries. The reason the columns are VARCHAR
is because these CSV files were uploaded through the web UI where there is no support for customizing column types, and the CSV parser cannot infer the cidr
or inet
types by the values in the provied columns. If you setup a repository with splitgraph.yml
, or push an image with sgr
, then you can customize these types at import time.
Sample queries:
Find 1.1.1.1
in country
table (Open in Console)
SELECT "start_ip"::inet, "end_ip"::inet, "country", "country_name", "continent", "continent_name" FROM "miles/ipinfo-country-asn:latest"."country" WHERE start_ip::inet <= inet '1.1.1.1' AND end_ip::inet >= inet '1.1.1.1' LIMIT 1;
Find 9.9.9.9
in asn
table (Open in Console)
SELECT "start_ip"::inet, "end_ip"::inet, "asn", "name", "domain" FROM "miles/ipinfo-country-asn:latest"."asn" WHERE start_ip::inet < inet '9.9.9.9' AND end_ip::inet > inet '9.9.9.9' LIMIT 100;
Find 8.8.8.8
in joined country
and asn
tables (Open in Console)
SELECT t_country."start_ip" as country_start_ip, t_country."end_ip" as country_end_ip, t_asn.start_ip as asn_start_ip, t_asn.end_ip as asn_end_ip, t_country."country", t_country."country_name", t_country."continent", t_country."continent_name", t_asn."asn", t_asn."name", t_asn."domain" FROM "miles/ipinfo-country-asn:latest"."country" t_country JOIN "miles/ipinfo-country-asn:latest"."asn" AS t_asn ON ( t_asn.start_ip::inet <= t_country.start_ip::inet AND t_asn.end_ip::inet >= t_country.end_ip::inet ) WHERE t_country.start_ip::inet <= inet '8.8.8.8' AND t_country.end_ip::inet >= inet '8.8.8.8' LIMIT 1;
- asn1 Object| 11 MB |432k Rows