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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d968b2a533f88ce3dcee4dabbe6aa38b1f5d1dec87b5c9cd1031174d57f0613c
|
|
| MD5 |
f71201eebdf77345e7ba9ae4a4d0522a
|
|
| BLAKE2b-256 |
cb44771e4b68daed3eef463215e169c69c2e82d0d2fe6cbb254f1048996239be
|
Provenance
The following attestation bundles were made for chembl_sqlalchemy-1.1.0.tar.gz:
Publisher:
release.yml on audivir/chembl-sqlalchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chembl_sqlalchemy-1.1.0.tar.gz -
Subject digest:
d968b2a533f88ce3dcee4dabbe6aa38b1f5d1dec87b5c9cd1031174d57f0613c - Sigstore transparency entry: 2607933618
- Sigstore integration time:
-
Permalink:
audivir/chembl-sqlalchemy@8941719ad9fef461e398ae11a20e8f0978447570 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/audivir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8941719ad9fef461e398ae11a20e8f0978447570 -
Trigger Event:
release
-
Statement type:
File details
Details for the file chembl_sqlalchemy-1.1.0-py3-none-any.whl.
File metadata
- Download URL: chembl_sqlalchemy-1.1.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94f7db3e91fd4f64b215b9364d27f0e86d5d618e9212efb57a8b2d3f85a80ed3
|
|
| MD5 |
d8d756a5752f6c31a1173754771ce95b
|
|
| BLAKE2b-256 |
04a8196cb7a849e493c203dc693cd3af2a8f747803c6cb3fcc3eabb8cedd449c
|
Provenance
The following attestation bundles were made for chembl_sqlalchemy-1.1.0-py3-none-any.whl:
Publisher:
release.yml on audivir/chembl-sqlalchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chembl_sqlalchemy-1.1.0-py3-none-any.whl -
Subject digest:
94f7db3e91fd4f64b215b9364d27f0e86d5d618e9212efb57a8b2d3f85a80ed3 - Sigstore transparency entry: 2607933721
- Sigstore integration time:
-
Permalink:
audivir/chembl-sqlalchemy@8941719ad9fef461e398ae11a20e8f0978447570 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/audivir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8941719ad9fef461e398ae11a20e8f0978447570 -
Trigger Event:
release
-
Statement type: