INNER CODE UNIT · Python

connect

mlin/GenomicSQLite · bindings/python/genomicsqlite/__init__.py:48

def connect(dbfile: str, read_only: bool = False, **kwargs) -> sqlite3.Connection:
    """
    Open a SQLite connection & activate GenomicSQLite extension on it
    """

    # kwargs may be a mix of GenomicSQLite config settings and sqlite3.connect() kwargs. Extract
    # the GenomicSQLite settings based on the keys found in the default configuration.
    kwargs = dict(kwargs)
    config = {}
    for config_key in _DEFAULT_CONFIG:
        if config_key in kwargs:
            config[config_key] = kwargs[config_key]
            del kwargs[config_key]
    if read_only:
        config["mode"] = "ro"
    config_json = json.dumps(config)

    # formulate the URI connection string

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…