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.

Download files

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

Source Distribution

chembl_sqlalchemy-1.1.0.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

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

chembl_sqlalchemy-1.1.0-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file chembl_sqlalchemy-1.1.0.tar.gz.

File metadata

  • Download URL: chembl_sqlalchemy-1.1.0.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for chembl_sqlalchemy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d968b2a533f88ce3dcee4dabbe6aa38b1f5d1dec87b5c9cd1031174d57f0613c
MD5 f71201eebdf77345e7ba9ae4a4d0522a
BLAKE2b-256 cb44771e4b68daed3eef463215e169c69c2e82d0d2fe6cbb254f1048996239be

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembl_sqlalchemy-1.1.0.tar.gz:

Publisher: release.yml on audivir/chembl-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chembl_sqlalchemy-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chembl_sqlalchemy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94f7db3e91fd4f64b215b9364d27f0e86d5d618e9212efb57a8b2d3f85a80ed3
MD5 d8d756a5752f6c31a1173754771ce95b
BLAKE2b-256 04a8196cb7a849e493c203dc693cd3af2a8f747803c6cb3fcc3eabb8cedd449c

See more details on using hashes here.

Provenance

The following attestation bundles were made for chembl_sqlalchemy-1.1.0-py3-none-any.whl:

Publisher: release.yml on audivir/chembl-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.35

2 files

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