connect

connect(version: str | int | float | VersionInfo | None = None, *, prefix: Sequence[str] | None = None) Generator[Connection, None, None][source]

Ensure and connect to the database.

Parameters:
  • 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

Yields:

The SQLite connection object.

Example: .. code-block:: python

import chembl_downloader

with chembl_downloader.connect() as conn:
with closing(conn.cursor()) as cursor:

cursor.execute(…)