Source: factory.core/extend.data/ObjDataSql.py
| Method | Signature | Description |
|---|---|---|
| get_cache_stats | get_cache_stats() -> dict[str, Any] |
Returns cache performance statistics for monitoring and tuning. |
| clear_cache | clear_cache() -> int |
Manually clears all cache entries. |
| sql_format | sql_format(sql: str) -> str |
|
| sql_status | sql_status() -> str |
Retrieves the database status and returns it as a JSON string. |
| refresh_db_schema | refresh_db_schema(db_connection: Any = None) -> None |
Forces a refresh of the database schema for the given connection. |
| get_db_cursor | get_db_cursor(db = 0) |
|
| sql_read_object | sql_read_object(in_sql: str, DB = 0, fields = '', prefix = '_') -> int |
|
| sql_extract_info | sql_extract_info(sql_query: str) -> tuple |
|
| sql_execute | sql_execute(sql: str, alt_db: DatabaseConnectionType = 0) -> tuple[bool, int] |
|
| explain_sql | explain_sql(sql: str, alt_db: DatabaseConnectionType = 0) -> dict |
Run EXPLAIN on a SQL statement and return |
| sql_execute_many | sql_execute_many(sql: str, data: list, alt_db: DatabaseConnectionType = 0) -> tuple[bool, int] |
Executes a multi-row INSERT or UPDATE statement using executemany for efficiency. |
| sql_get_normalized_headings | sql_get_normalized_headings(table_name: str) -> tuple[list[str], list[str]] |
Gets the column headings for a table, returning them sorted and normalized. |
| sql_get_normalized_data | sql_get_normalized_data(table_name: str, columns: list[str], pk_values: list | None = None) -> list |
Retrieves data from a table, ordered by the provided columns. |
| compare_lists_ignore_types | compare_lists_ignore_types(list1, list2, ignore_types = (datetime.datetime, datetime.date)) |
Compare two lists element by element, ignoring elements whose type |
| sql_compare_tables | sql_compare_tables(table1: str, table2: str) -> bool |
Compares the contents of two tables, ensuring all columns (including primary keys) align. |
| sql_get_value | sql_get_value(sql: str, alt_db: DatabaseConnectionType = 0) -> str |
|
| sql_get_value_buffer | sql_get_value_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> str |
Cached version of sql_get_value with TTL-based expiration. |
| sql_get_database | sql_get_database(alt_db: DatabaseConnectionType = 0) -> str |
Return the database name of the current |
| sql_get_int | sql_get_int(sql: str, alt_db: DatabaseConnectionType = 0) -> int |
|
| sql_get_int_buffer | sql_get_int_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> int |
Cached version of sql_get_int with TTL-based expiration. |
| sql_get_values | sql_get_values(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
|
| sql_get_values_buffer | sql_get_values_buffer(sql: str, remote_db: DatabaseConnectionType = 0) -> list |
Cached version of sql_get_values with TTL-based expiration. |
| sql_get_values_dict | sql_get_values_dict(sql: str, alt_db: DatabaseConnectionType = 0) -> dict |
|
| sql_get_tuple | sql_get_tuple(sql: str, alt_db: DatabaseConnectionType = 0) -> tuple |
|
| sql_get_tuple_set | sql_get_tuple_set(sql: str, alt_db: DatabaseConnectionType = 0) -> list[tuple] |
|
| sql_get_rows | sql_get_rows(sql: str, alt_db: DatabaseConnectionType = 0) -> list[tuple] |
Backward-compatible alias for sql_get_tuple_set(). |
| sql_get_row | sql_get_row(sql: str, alt_db: DatabaseConnectionType = 0) -> tuple |
Backward-compatible helper returning the first row or empty tuple. |
| sql_get_tuple_buffer | sql_get_tuple_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> tuple |
Cached version of sql_get_tuple with TTL-based expiration. |
| sql_get_value_int | sql_get_value_int(sql: str) -> int |
|
| sql_get_dict | sql_get_dict(sql: str, alt_db: DatabaseConnectionType = 0) -> dict[str, Any] |
|
| sql_get_dictionary_list | sql_get_dictionary_list(sql: str, alt_db: DatabaseConnectionType = 0, base_col: str = '', lower_limit: int = -1, upper_limit: int = -1, raise_on_error: bool = False) -> list[dict[str, Any]] |
|
| sql_get_dataframe | sql_get_dataframe(sql: str, alt_db: DatabaseConnectionType = 0) -> pd.DataFrame |
|
| sql_get_dictionary | sql_get_dictionary(sql: str, alt_db: DatabaseConnectionType = 0) -> dict |
|
| sql_get_frame | sql_get_frame(sql: str, alt_db: DatabaseConnectionType = 0) -> pd.DataFrame |
|
| sql_get_dict_buffer | sql_get_dict_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> dict |
Cached version of sql_get_dict with TTL-based expiration. |
| sql_get_series | sql_get_series(sql: str, alt_db: DatabaseConnectionType = 0) -> list[dict[str, Any]] |
|
| get_sql_list | get_sql_list(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
|
| sql_get_list_buffer | sql_get_list_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
Cached version of sql_get_list with TTL-based expiration. |
| sql_get_set | sql_get_set(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
DEPRECATED: This method is unused and will be removed in v9.0. |
| sql_get_array | sql_get_array(sql: str, alt_db: DatabaseConnectionType = 0) -> list[tuple] |
|
| sql_get_pandas_data_frame | sql_get_pandas_data_frame(sql: str, alt_db: DatabaseConnectionType = 0) -> pd.DataFrame |
|
| sql_get_array_and_headings | sql_get_array_and_headings(sql: str, alt_db: DatabaseConnectionType = 0) -> tuple[list, list] |
|
| sql_get_headings | sql_get_headings(sql: str, alt_db: DatabaseConnectionType = 0) -> list[str] |
|
| sql_get_headings_full | sql_get_headings_full(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
|
| sql_get_headings_full_buffer | sql_get_headings_full_buffer(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
Cached version of sql_get_headings_full with TTL-based expiration. |
| sql_get_list | sql_get_list(sql: str, alt_db: DatabaseConnectionType = 0) -> list |
Get a list and create a deep copy. |