Skip to main content

chembl-sqlalchemy

SQLAlchemy ORM models for the ChEMBL database, enabling programmatic access to ChEMBL data using Python.

This package allows you to query and explore ChEMBL bioactivity data using SQLAlchemy, without having to manually define the table schemas yourself.

Prerequisites

  • Python 3.10 to 3.14.
  • A local ChEMBL database file, downloaded separately (see Database Files below).

Installation

Install via pip:

pip install chembl-sqlalchemy

Usage

Table and column definitions differ between ChEMBL releases, so each supported release has its own submodule: chembl_sqlalchemy.chembl_35, chembl_sqlalchemy.chembl_36, and chembl_sqlalchemy.chembl_37. Import the submodule matching the ChEMBL database version in use:

from chembl_sqlalchemy.chembl_37 import Activities
from sqlalchemy import create_engine, select
from sqlalchemy.orm import sessionmaker

# Connect to a local ChEMBL SQLite database
engine = create_engine("sqlite:///chembl_37.db")
Session = sessionmaker(bind=engine)
session = Session()

# Example query: Get first 1000 non-null pChEMBL values
query = (
    select(Activities.molregno, Activities.pchembl_value, Activities.standard_type)
    .where(Activities.pchembl_value.isnot(None))
    .limit(1000)
)

results = session.execute(query).fetchall()

for molregno, pchembl_value, standard_type in results:
    print(molregno, pchembl_value, standard_type)

Importing directly from chembl_sqlalchemy (e.g. from chembl_sqlalchemy import Activities) still works and resolves to the ChEMBL 35 schema, for backward compatibility with releases before 1.1.0. It emits a DeprecationWarning and will be removed in 2.0.0: there is no default schema, since silently picking one could break queries against a different ChEMBL release.

Versioning

The package follows plain semantic versioning. A single package version bundles ORM schemas for multiple ChEMBL releases as separate submodules, rather than targeting one ChEMBL version per package version.

Database Files

The package does not include the ChEMBL database file itself. You can download the corresponding SQLite file from the ChEMBL downloads page.

Place it in your project directory or reference it by path when creating the SQLAlchemy engine.

Acknowledgments

This package derives its ORM schemas from the structure of the ChEMBL database, produced by EMBL-EBI. No ChEMBL data is bundled with this package; download the database separately (see Database Files above) and note the release number, per ChEMBL attribution requirements.

For publications using ChEMBL data, cite:

Mendez D, Gaulton A, Bento AP, Chambers J, De Veij M, Félix E, Magariños MP, Mosquera JF, Mutowo P, Nowotka M, Gordillo-Marañón M, Hunter F, Junco L, Mugumbate G, Rodriguez-Lopez M, Atkinson F, Bosc N, Radoux CJ, Segura-Cabrera A, Hersey A, Leach AR. ChEMBL: towards direct deposition of bioassay data. Nucleic Acids Res. 2019 47(D1):D930-D940. DOI: 10.1093/nar/gky1075

License

MIT, see LICENSE.

Metadata

Release files for chembl-sqlalchemy 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chembl-sqlalchemy 1.1.0
File Size Uploaded Provenance Actions
chembl_sqlalchemy-1.1.0.tar.gz 38.4 kB With provenance Details for chembl_sqlalchemy-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chembl-sqlalchemy 1.1.0
File Interpreter ABI Platform Actions
chembl_sqlalchemy-1.1.0-py3-none-any.whl Python 3 none any Details for chembl_sqlalchemy-1.1.0-py3-none-any.whl

Total release size: 73.7 kB

Release files / chembl_sqlalchemy-1.1.0.tar.gz

Download URL chembl_sqlalchemy-1.1.0.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d968b2a533f88ce3dcee4dabbe6aa38b1f5d1dec87b5c9cd1031174d57f0613c
BLAKE2b-256 checksum
How to use checksums
cb44771e4b68daed3eef463215e169c69c2e82d0d2fe6cbb254f1048996239be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release files / chembl_sqlalchemy-1.1.0-py3-none-any.whl

Download URL chembl_sqlalchemy-1.1.0-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94f7db3e91fd4f64b215b9364d27f0e86d5d618e9212efb57a8b2d3f85a80ed3
BLAKE2b-256 checksum
How to use checksums
04a8196cb7a849e493c203dc693cd3af2a8f747803c6cb3fcc3eabb8cedd449c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Security for chembl-sqlalchemy 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chembl_sqlalchemy-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page