|
Terarea
2
The automation project
|

Public Member Functions | |
| None | __init__ (self, SQLManageConnections sql_pool, int success=0, int error=84, bool debug=False) |
| Union[List[str], int] | get_table_column_names (self, str table_name) |
| Union[int, List[str]] | get_table_names (self) |
| Union[int, List[Any]] | describe_table (self, str table) |
| int | insert_data_into_table (self, str table, Union[List[List[str]], List[str]] data, Union[List[str], None] column=None) |
| Union[int, List[Dict[str, Any]]] | get_data_from_table (self, str table, Union[str, List[str]] column, Union[str, List[str]] where="", bool beautify=True) |
| Union[int] | get_table_size (self, str table, Union[str, List[str]] column, Union[str, List[str]] where="") |
| int | update_data_in_table (self, str table, List[str] data, List column, Union[str, List[str]] where="") |
| int | insert_or_update_data_into_table (self, str table, Union[List[List[str]], List[str]] data, Union[List[str], None] columns=None) |
| int | remove_data_from_table (self, str table, Union[str, List[str]] where="") |
Data Fields | |
| SQLManageConnections | sql_pool = sql_pool |
| int | error = error |
| bool | debug = debug |
| int | success = success |
| Disp | disp |
| SQLInjection | sql_injection |
| SQLSanitiseFunctions | sanitize_functions |
_summary_
Definition at line 18 of file sql_query_boilerplates.py.
| None src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.__init__ | ( | self, | |
| SQLManageConnections | sql_pool, | ||
| int | success = 0, | ||
| int | error = 84, | ||
| bool | debug = False ) |
_summary_
The class in charge of managing sql queries (it contains the required boilerplate functions).
Args:
sql_pool (SQLManageConnections): _description_
success (int, optional): _description_. Defaults to 0.
error (int, optional): _description_. Defaults to 84.
debug (bool, optional): _description_. Defaults to False.
Definition at line 22 of file sql_query_boilerplates.py.
| Union[int, List[Any]] src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.describe_table | ( | self, | |
| str | table ) |
_summary_
Fetch the headers (description) of a table from the database.
Args:
table (str): _description_: The name of the table to describe.
Raises:
RuntimeError: _description_: If there is a critical issue with the table or the database connection.
Returns:
Union[int, List[Any]]: _description_: A list containing the description of the table, or self.error if an error occurs.
Definition at line 107 of file sql_query_boilerplates.py.
| Union[int, List[Dict[str, Any]]] src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.get_data_from_table | ( | self, | |
| str | table, | ||
| Union[str, List[str]] | column, | ||
| Union[str, List[str]] | where = "", | ||
| bool | beautify = True ) |
_summary_
Args:
table (str): _description_
column (Union[str, List[str]]): _description_
where (Union[str, List[str]]): _description_
Returns:
Union[int, List[Dict[str, Any]]]: _description_: Will return the data you requested, self.error otherwise
Definition at line 214 of file sql_query_boilerplates.py.
| Union[List[str], int] src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.get_table_column_names | ( | self, | |
| str | table_name ) |
_summary_
Get the names of the columns in a table.
Args:
table_name (str): _description_
Returns:
List[str]: _description_
Definition at line 56 of file sql_query_boilerplates.py.
| Union[int, List[str]] src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.get_table_names | ( | self | ) |
_summary_
Get the names of the tables in the database.
Returns:
List[str]: _description_
Definition at line 85 of file sql_query_boilerplates.py.
| Union[int] src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.get_table_size | ( | self, | |
| str | table, | ||
| Union[str, List[str]] | column, | ||
| Union[str, List[str]] | where = "" ) |
_summary_
Get the size of a table.
Args:
table (str): _description_
column (Union[str, List[str]]): _description_
where (Union[str, List[str]]): _description_
Returns:
int: _description_: Return the size of the table, -1 if an error occurred.
Definition at line 255 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.insert_data_into_table | ( | self, | |
| str | table, | ||
| Union[List[List[str]], List[str]] | data, | ||
| Union[List[str], None] | column = None ) |
_summary_
Insert data into a table.
Args:
table (str): _description_
data (List[List[str]]): _description_
column (List[str]): _description_
Returns:
int: _description_
Definition at line 158 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.insert_or_update_data_into_table | ( | self, | |
| str | table, | ||
| Union[List[List[str]], List[str]] | data, | ||
| Union[List[str], None] | columns = None ) |
_summary_
Insert or update data into a given table.
Args:
table (str): Table name.
data (Union[List[List[str]], List[str]]): Data to insert or update.
columns (Union[List[str], None], optional): Column names. Defaults to None.
Returns:
int: Success or error code.
Definition at line 358 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.remove_data_from_table | ( | self, | |
| str | table, | ||
| Union[str, List[str]] | where = "" ) |
_summary_
Remove the data from a table.
Args:
table (str): _description_
data (List): _description_
column (List): _description_
Returns:
int: _description_
Definition at line 425 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.update_data_in_table | ( | self, | |
| str | table, | ||
| List[str] | data, | ||
| List | column, | ||
| Union[str, List[str]] | where = "" ) |
_summary_
Update the data contained in a table.
Args:
table (str): _description_
data (Union[List[List[str]], List[str]]): _description_
column (List): _description_
Returns:
int: _description_
Definition at line 300 of file sql_query_boilerplates.py.
| bool src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.debug = debug |
Definition at line 35 of file sql_query_boilerplates.py.
| Disp src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.disp |
Definition at line 38 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.error = error |
Definition at line 34 of file sql_query_boilerplates.py.
| SQLSanitiseFunctions src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.sanitize_functions |
Definition at line 52 of file sql_query_boilerplates.py.
| SQLInjection src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.sql_injection |
Definition at line 46 of file sql_query_boilerplates.py.
| SQLManageConnections src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.sql_pool = sql_pool |
Definition at line 33 of file sql_query_boilerplates.py.
| int src.lib.sql.sql_query_boilerplates.SQLQueryBoilerplates.success = success |
Definition at line 36 of file sql_query_boilerplates.py.