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

SQLafter setup

clickhouse-client
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.

Read the full setup guide

  1. 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.

  2. Install the script and its config

    Put ev_validate.py in the server’s user_scripts folder and email_validation_function.xml next to its config, then run SYSTEM RELOAD FUNCTIONS.

  3. Create the status function

    Run sql/1-functions.sql, then try validate_email('no_mailbox@sandbox.email-validation.org'): test addresses cost nothing.

  4. Check each address once

    Run sql/2-check-once.sql to fill ev_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_REGION to eu in the script: the same key works on both hosts.

Connect ClickHouse.

Test it on our sandbox addresses for free, then on your own contacts.

Create your accountRead the full setup guide

Updated · Maintained by: Email Validation LLC