vyperdatum.db ============= .. py:module:: vyperdatum.db Attributes ---------- .. autoapisummary:: vyperdatum.db.logger Classes ------- .. autoapisummary:: vyperdatum.db.DB Module Contents --------------- .. py:data:: logger .. py:class:: DB(db_dir: Optional[str] = enuPDB.DIR.value) .. py:attribute:: db_dir .. py:attribute:: db_name .. py:property:: db_file_path :type: str .. py:method:: update_db_path() -> bool Prepend `self.db_dir` to `pyproj.datadir` which guides the pyproj to first look for the database at `self.db_dir` address. :raises ValueError:: If `.db_dir` is not set. :raises FileNotFoundError:: If the database file is not found. :returns: `True` if the `data_dir` is set successfully, otherwise `False`. :rtype: bool .. py:method:: query(sql: str, dataframe: bool = False) -> Union[Optional[list], Optional[pandas.DataFrame]] Execute a sql query and return the response. This method is intended to run a read (scan) query. Avoid using this method for DML/DDL type operations. :param sql: SQL query (intended to be a scan query) to be executed. :type sql: str :param dataframe: If True, converts the result into a pandas dataframe. :type dataframe: bool, default=False :rtype: list or pd.DataFrame .. py:method:: crs_by_keyword(keywords: list[str], dataframe: bool = False) -> Union[Optional[list], Optional[pandas.DataFrame]] Return a list (or dataframe) of CRS that their name or description contain the passed keywords. The search is not case-sensitive. :param sql: SQL query (intended to be a scan query) to be executed. :type sql: str :param keywords: A list of string keywords used to query the database. :type keywords: list[str] :param dataframe: If True, converts the result into a pandas dataframe. :type dataframe: bool, default=False :raises TypeError:: If `keywords` is not a list of strings. :raises ValueError:: If no keywords is passed. :rtype: list or pd.DataFrame