query

query(sql, version=None, *, prefix=None, **kwargs)[source]

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

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

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

  • prefix (Optional[Sequence[str]]) – The directory inside pystow to use

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

Return type:

DataFrame

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)