Data and spreadsheets
ClickHouse email validation integration
Two SQL functions return the status of an address, or the reason, action and error in full, straight from a ClickHouse query. A small Python script on your server, run by ClickHouse as an executable function, checks each address with our API.
Read the full setup guideGet an API key
- Setup guide
- One zip: the script, its config and the SQL
SELECT email, validate_email(email) AS status FROM customers;
SELECT email, JSONExtractString(validate_email_details(email), 'reason') AS reason FROM customers;At a glance.
- Status
- Setup guide. Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- For
- Data teams who run their own ClickHouse server with customer or lead addresses in it and want each one’s status as a column they can join, filter and send on.
- You need
- A self-managed ClickHouse server where you can put files and reload functions, with Python 3, and an API key made for it, with a daily credit cap.
- Costs
- 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses, test addresses on sandbox.email-validation.org, addresses on reserved domains such as example.com and, in a bulk list, repeats of an address (charged once).
- Full guide
- Read the full setup guide
Typical uses.
Clean a customer table
Check each distinct address into a results table, then join to it in every query, view or export that needs the status.
Check new sign-ups each day
Run the check-once script on a schedule: it checks only addresses that have no result yet, so each run spends credits on new rows only.
Keep bad addresses out of sends
Filter the audiences you send to other tools on the status, so addresses that cannot receive mail and throwaway inboxes never leave the database.
Set it up. 4 steps.
The short version of the full setup guide, which stays the reference when a step does not match what you see.
Download the zip and make a key
Download the zip from the guide, create an API key with Validate addresses and a daily credit cap, and save it in a file only the clickhouse user can read.
Install the script and its config
Put
ev_validate.pyin the server’suser_scriptsfolder andemail_validation_function.xmlnext to its config, then runSYSTEM RELOAD FUNCTIONS.Create the status function
Run
sql/1-functions.sql, then tryvalidate_email('no_mailbox@sandbox.email-validation.org'): test addresses cost nothing.Check each address once
Run
sql/2-check-once.sqlto fillev_email_results, and join to it.
Good to know.
It has not run in a real ClickHouse server yet: it was built from ClickHouse’s documentation and tested against a stand-in.
Every non-NULL row a query passes to the functions is checked each time the query runs; the same address twice in one chunk is checked once. A query over a large table spends credits again on every run: the check-once script and a join avoid that.
A row that could not be checked gets a NULL status and an error code that says why, never an invented status. A wrong key fails the query with a message that never contains the key.
The script never logs an address or the key. ClickHouse’s query log and the tables you write keep what you put in them.
For EU data residency, set
EV_REGIONtoeuin the script: the same key works on both hosts.
Connect ClickHouse.
Test it on our sandbox addresses for free, then on your own contacts.
Updated · Maintained by: Email Validation LLC