Code source de ensae_teaching_cs.data.datasql

"""
Example of databases


:githublink:`%|py|5`
"""
from .data_helper import any_local_file


[docs]def anyfile(name, local=True, cache_folder="."): """ Returns any file in sub folder `data_sql <https://github.com/sdpython/ensae_teaching_cs/tree/master/src/ensae_teaching_cs/data/data_sql>`_. :param name: file to download :param local: local data or web :param cache_folder: where to cache the data if downloaded a second time :return: text content (str) :githublink:`%|py|17` """ return any_local_file(name, "data_sql", cache_folder=cache_folder, filename=True)
[docs]def simple_database(name="World.db3", local=True, cache_folder="."): """ Returns a simple database. See :func:`ensae_teaching_cs.data.datasql.anyfile` to directly download it. :param name: filename :param local: local data or web :param cache_folder: where to cache the data if downloaded a second time :return: text content (str) :githublink:`%|py|31` """ return anyfile(name, local=local, cache_folder=cache_folder)