Snowflake UDF: TO_IP - Convert the integer equivalent of an IPv4 address to its IPv4 string equivalent

TO_IP snowflake UDF converts the integer equivalent value of an IPv4 address to its IPv4 string format.

Often time it is easy to run IP address operations through their integer or hexadecimal equivalent values. However, after running those operations, to publish a report or to ingest the data into other systems, you need to convert them back to their IP address format. The TO_IP UDF takes in the integer value of IPv4 addresses and converts it back to their IP format.

One IPv4 IP address integer value

Input IP address:

469720341

Code:

SELECT ipinfo.public.to_ip('469720341') as IPv4

Output:

image


Multiple IPv4 IP Addresses integer value

Input IP address:

2239136096
241969668
2956524755
1996262039
2157726077
80431965
401579153
1153651306
1288949318
268842728

Code:

SELECT ipinfo.public.to_ip(ip) as IPv4
FROM logs

Output:

image


Relevant Docs

Relevant Databases

:link: IPinfo Snowflake documentation

1 Like