Install and load
Run these commands in a Haybarn SQL session. The extension is available from the community repository.
INSTALL dns FROM community;
LOAD dns FROM community;
Using upstream DuckDB? Follow the maintainerβs installation instructions.
Usage example
Performs a forward DNS lookup to resolve a hostname to its first IPv4 address.
-- Performs a forward DNS lookup to resolve a hostname to its first IPv4 address.
D SELECT dns_lookup('google.com') as ip;
βββββββββββββββββββ
β ip β
β varchar β
βββββββββββββββββββ€
β 142.251.209.142 β
βββββββββββββββββββ
-- Performs a DNS lookup to resolve all TXT records for a hostname.
D SELECT unnest(dns_lookup_all('google.com', 'TXT')) as txt_record order by txt_record ASC LIMIT 5;
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β txt_record β
β varchar β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β MS=E4A68B9AB2BB9670BCE15412F62916164C0B20BB β
β apple-domain-verification=30afIBcvSuDV2PLX β
β cisco-ci-domain-verification=47c38bc8c4b74b7233e9053220c1bbe76bcc1cd33c7acf7acd36cd6a5332004b β
β docusign=05958488-4752-4ef2-95eb-aa7ba8a3bd0e β
β docusign=1b0a6754-49b1-4db5-8540-d2c12664b289 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
-- Performs a reverse DNS lookup to resolve an IPv4 or IPv6 address to its hostname.
D SELECT ip, reverse_dns_lookup(ip) as hostname FROM (VALUES ('8.8.8.8'), ('2606:4700:4700::1111')) AS ips(ip);
ββββββββββββββββββββββββ¬ββββββββββββββββββ
β ip β hostname β
β varchar β varchar β
ββββββββββββββββββββββββΌββββββββββββββββββ€
β 8.8.8.8 β dns.google β
β 2606:4700:4700::1111 β one.one.one.one β
ββββββββββββββββββββββββ΄ββββββββββββββββββ
-- Returns all TXT records for a hostname as a table.
D SELECT * FROM corey('lastweekinaws.com') order by txt_record ASC;
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β txt_record β
β varchar β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β google-site-verification=2cfGboK6oBt4GlzI62WGmKWI_SjoDEKRSaAgmZsQZlo β
β google-site-verification=FRrs1UZEfmPke4kYWmYH0wcOPwcMLM0pphvpyhGCa2w β
β google-site-verification=FuHv5niDbZdqLlXOlvyqokvFJDso9WtDAE3-zHJgz40 β
β google-site-verification=VE5d97aE3ZCw4GzBHIKKeUGKaCYs2evsGq3QCM0t87I β
β v=spf1 include:_spf.google.com include:sendgrid.net include:spf.revue.co ~all β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
-- Sets the DNS resolver to use for lookups (e.g. 'google' or 'cloudflare').
-- Hint: The C-API doesn't currently support using SET commands. The usage of a SELECT is a workaround.
D SELECT set_dns_config('google');
βββββββββββββββββββββββββββββββββββββββββ
β set_dns_config('google') β
β varchar β
βββββββββββββββββββββββββββββββββββββββββ€
β DNS configuration updated to 'google' β
βββββββββββββββββββββββββββββββββββββββββ
-- Set concurrency limit to 250 (default: 50)
D SELECT set_dns_concurrency_limit(250);
βββββββββββββββββββββββββββββββββββββββββ
β set_dns_concurrency_limit(250) β
β varchar β
βββββββββββββββββββββββββββββββββββββββββ€
β DNS concurrency limit updated to 250 β
βββββββββββββββββββββββββββββββββββββββββ
-- Set DNS cache size to 8192 (default: 1000)
D SELECT set_dns_cache_size(8192);
ββββββββββββββββββββββββββββββββββ
β set_dns_cache_size(8192) β
β varchar β
ββββββββββββββββββββββββββββββββββ€
β DNS cache size updated to 8192 β
ββββββββββββββββββββββββββββββββββ
Provided by tobilg. Not yet verified on Haybarn 2.0.0.
Sample data & setupAbout this extension
This community extension implements DNS (reverse) lookup functions for DuckDB.
Performs a forward DNS lookup to resolve a hostname to its first IPv4 address, or to the first record of a specified DNS record type.
Project overview from the community descriptor.
Documentation and resources
Project and build details
- Repository
- tobilg/duckdb-dns
- License
- MIT
- Maintainers
- tobilg
- Written in
- Rust
- Build source
e44a254ec795- Build definition
- Community descriptor