query

query(sql: str, version: VersionHint | None = None, *, prefix: Sequence[str] | None = None, **kwargs: Any) pandas.DataFrame[source]

Ensure the data is available, run the query, then put the results in a dataframe.

Parameters:
  • sql – A SQL query string or table name

  • version – The version number of ChEMBL to get. If none specified, uses latest() to look up the latest.

  • prefix – The directory inside pystow to use

  • kwargs – keyword arguments to pass through to pandas.read_sql(), such as index_col.

Returns:

A dataframe

Example: .. code-block:: python

import chembl_downloader from chembl_downloader.queries import ID_NAME_QUERY_EXAMPLE

df = chembl_downloader.query(ID_NAME_QUERY_EXAMPLE)