sqlite3_interface#
- ioapps.sqlite3_interface.create_table(path, table_name, table_dict)[source]#
DESCRIPTION:
This function creates a previously non-existent a SQLite3 database table in the specified SQLite3 database file path.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- table_name: str
A Python string specifying the name for the SQLite3 database table.
- table_dict: Dict
A Python dictionary containing the SQLite3 database table attributes; the dictionary keys are the respective SQLite3 database table column names and the associated dictionary key values are the database types for the respective columns; accepted datatypes are BLOB, INTEGER, NULL, REAL, and TEXT.
- Raises:
- SQLite3InterfaceError:
raised if an exception is encountered while creating the specified SQLite3 database table in the specified path.
- Return type:
None
- ioapps.sqlite3_interface.delete_row(path, table_name, rmcond)[source]#
DESCRIPTION:
This function deletes a row within a specified table based on a provided removal condition.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- table_name: str
A Python string specifying the existing table name within the SQLite3 database file.
- rmcond: str
A Python string specifying the removal condition.
- Raises:
- SQLite3InterfaceError:
raised if an exception is encountered while attempting to apply the removal condition for the SQLite3 database table within the specified database file path.
- Return type:
None
- ioapps.sqlite3_interface.read_columns(path, table_name)[source]#
DESCRIPTION:
This function returns a list for the respective column names within the specified SQLite3 database table.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- table_name: str
A Python string specifying the existing table name within the SQLite3 database file.
- Returns:
- columns: List
A Python list of the column names within the specified SQLite3 database table.
- Raises:
- SQLite3InterfaceError:
raised if an exception is encountered while attempting to collect column names from the SQLite3 database table names.
- Return type:
List
- ioapps.sqlite3_interface.read_table(path, table_name)[source]#
DESCRIPTION:
This function reads values from an existing SQLite3 database.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- table_name: str
A Python string specifying the existing table name within the SQLite3 database file.
- Returns:
- table_dict: Dict
A Python dictionary containing an enumerated list of the SQLite3 database table contents.
- Raises:
- SQLite3InterfaceError:
raised if the SQLite3 database path does not exist.
raised an exception is encountered while reading the specified SQLite3 database table.
- Return type:
Dict
- ioapps.sqlite3_interface.read_tablenames(path, format_list=False)[source]#
DESCRIPTION:
This method parses the SQLite3 database path and returns a list of table names within the respective SQLite3 database path.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- Returns:
- tablenames: List
A Python list of table names contained within the respective SQLite3 database path.
- Return type:
List
- ioapps.sqlite3_interface.write_table(path, table_name, row_dict)[source]#
DESCRIPTION:
This function writes values into an existing SQLite3 database.
- Parameters:
- path: str
A Python string specifying the path to the SQLite3 database file.
- table_name: str
A Python string specifying the existing table name within the SQLite3 database file.
- row_dict: Dict
A Python dictionary containing the variable fields to be written to the SQLite3 database table.
- Raises:
- SQLite3InterfaceError:
raised if the database file path does not exist upon entry.
- Return type:
None