Skip to main content

ClickHouse backend

The DuckDB builder remains the source of truth. Build a DuckDB file with build_merged_duckdb, then upload its canonical tables into ClickHouse:

uv run python scripts/upload_clickhouse.py data/dbs_final/SmallMolecule.duckdb --database normalization

The upload shows a progress bar for each copied table; pass --no-progress to silence it.

Connection settings are read from .env with python-dotenv and use the official clickhouse-connect client. Set CH_HTTP, for example http://host:8123/normalization; CH_USER and CH_PASSWORD may be supplied separately and override URL credentials.

Use the ClickHouse backend from Python:

import asyncio

from norm_toolkit import ClickHouseNormalizer


async def main():
    normalizer = await ClickHouseNormalizer.create(database="normalization")
    result = await normalizer.normalize(["aspirin"], top_k=5)
    print(result)


asyncio.run(main())

Normalizer instances keep a 10,000-item LRU cache. Repeated items skip string normalization, database lookup, enrichment, and hierarchy expansion; misses in a mixed batch are queried together and added to the cache. Synonyms and all result-affecting options are part of the cache key.

normalizer = await ClickHouseNormalizer.create(
    database="normalization",
    normalization_cache_size=50_000,  # 0 disables; None is unbounded
)

print(normalizer.normalization_cache_info())
normalizer.clear_normalization_cache()  # also use after refreshing backing tables

You can also pass a DSN in code:

normalizer = await ClickHouseNormalizer.create(
    dsn="http://host:8123/normalization",
    database="normalization",
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

norm_toolkit-2.0.1.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

norm_toolkit-2.0.1-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file norm_toolkit-2.0.1.tar.gz.

File metadata

  • Download URL: norm_toolkit-2.0.1.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for norm_toolkit-2.0.1.tar.gz
Algorithm Hash digest
SHA256 5b47a5c928f1af789db8163158d7137e8ce34eb22e857f1709cac31064e27bb8
MD5 c5ba8a69e1f82f10c1293635c2d1571f
BLAKE2b-256 79a0f85be62eb1fdef08a9ac23922d7ae72865ca4bdf4573698f30bb163cff65

See more details on using hashes here.

File details

Details for the file norm_toolkit-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: norm_toolkit-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for norm_toolkit-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32f09d87dda2c64cedf6b7fd478cea8a570dfe9277bed70b8bdb916c20d0722f
MD5 f5dc0680b523c84a04d7dd17fa1e0bdd
BLAKE2b-256 968ff00f731bff04647248532d6a4c49ebf582324013b74bab6210870dce59ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page