Source: factory.core/ObjData.py
Main data access object for database operations.
Thread Safety Warning:
⚠️ Sharing ObjData instances across threads is NOT recommended due to cursor conflicts.
...
| Method | Signature | Description |
|---|---|---|
| format_uptime_seconds | format_uptime_seconds(seconds: int | float) -> str |
Format uptime seconds as a compact human string. |
| version | version() -> None |
|
| load_queries | load_queries() -> dict |
|
| get_queries | get_queries(query_name: str = '') |
|
| get_js | get_js(js_name: str = '') |
Return a JavaScript block (or the |
| get_html | get_html(html_name: str = '') |
Return an HTML template block from the per-class |
| get_css | get_css(css_name: str = '') |
Return a CSS block (or the whole css |
| get_cache_ttl | get_cache_ttl(default: int = 0) -> int |
Return cache TTL from the per-class YAML. |
| get_svg | get_svg(svg_name: str = '') |
Return an SVG template (or the whole |
| get_query_template | get_query_template(query_name: str, default_sql: str = '') -> str |
Return an externalized SQL template, falling back to inline default. |
| get_prompts | get_prompts(prompt_name: str) -> str |
|
| get_template | get_template(template_name: str) -> str |
|
| get_templates | get_templates(template_name: str) -> str |
Backward-compatible alias for legacy callers. |
| get_data | get_data(key: str) -> Any |
Read a named value from the YAML data section. |
| get_notes | get_notes(file_name: str, *keys) |
|
| create_tables_from_yaml | create_tables_from_yaml(schema_name: str = '', force_schema_check: bool = False) -> bool |
Compatibility wrapper for schema creation. |
| get_query_from_yaml | get_query_from_yaml(query_name: str, yaml_file: str = '') -> str |
Load a single SQL query by name from an explicit YAML file. |
| create_forms_from_yaml | create_forms_from_yaml(schema_name: str = '') -> bool |
Load form definitions from YAML into def_form/def_formfields. |
| create_reference_table | create_reference_table(module_name: str, table_name: str) -> bool |
If a specific database table is missing, this code executes a preliminary |
| get_constants | get_constants(name: str) |
|
| get_constant | get_constant(name: str) -> str |
|
| patch_constants | patch_constants(text: str) -> str |
Legacy hook kept for backward compatibility. |
| note_check | note_check(testname: str, result: bool) -> None |
|
| replace_placeholders | replace_placeholders(working_str: str, placeholders: dict) -> str |
|
| get_ssl | get_ssl(package: str) -> tuple[str, str] |
|
| is_simulation | is_simulation() -> bool |
|
| get_domongo | get_domongo() -> bool |
|
| get_collation | get_collation() -> str |
Keep ObjData module buffer semantics stable even though the concrete |
| get_storage_engine | get_storage_engine() -> str |
Return the default storage engine from |
| get_ini_value | get_ini_value(section: str, option: str | list[str] | list[tuple[str, str]], default: str = '') -> str | list[str] |
Get configuration value(s) from ConfigIni. |
| get_ini_int | get_ini_int(section: str, option: str | list[str] | list[tuple[str, int]], default: int = 0) -> int | list[int] |
Get configuration value(s) as integer(s). |
| get_ini_float | get_ini_float(section: str, option: str | list[str] | list[tuple[str, float]], default: float = 0.0) -> float | list[float] |
Get configuration value(s) as float(s). |
| get_ini_bool | get_ini_bool(section: str, option: str | list[str] | list[tuple[str, bool]], default: bool = False) -> bool | list[bool] |
Get configuration value(s) as boolean(s). |
| get_model | get_model() -> str |
Return the generation (chat) model for this machine. |
| get_model_vision | get_model_vision() -> str |
Return the vision model for this machine (or ""). |
| get_model_embedding | get_model_embedding() -> str |
Return the embedding model for this machine. |
| get_acl | get_acl() |
Return the ACL instance for this connection. |
| get_package | get_package() -> str |
|
| get_deployment | get_deployment() -> str |
|
| get_parent_branch | get_parent_branch() -> str |
|
| get_version_name | get_version_name() -> str |
|
| get_role | get_role() -> str |
|
| get_package_and_archetype | get_package_and_archetype() -> tuple[str, str] |
|
| get_realm | get_realm() -> dict |
Retrieves the current package and Keycloak API configuration. |
| is_virtual_service | is_virtual_service() -> int |
|
| db_type | db_type(db = 0) -> str |
|
| DBType | DBType(DB = 0) -> str |
|
| is_ms_sql | is_ms_sql(data_connector) -> bool |
Return True if the given data connector is a MSSQL connection. |
| is_postgres | is_postgres(data_connector) -> bool |
Return True if the given data connector is a PostgreSQL connection. |
| is_sqlite | is_sqlite(data_connector) -> bool |
Return True if the given data connector is a SQL Lite connection. |
| get_db_cursor | get_db_cursor(DB = 0) |
|
| sql_set_dict | sql_set_dict(base_table: str, data_dict: dict, target_connection: object, mix_in: dict, insert_mode: bool = True, bulk_mode: bool = False, bulk_header: bool = False) -> str |
|
| sql_set_list | sql_set_list(base_table: str, data_list: list, target_connection: object, mix_in: dict, insert_mode: bool = True) |
|
| sql_transfer_query | sql_transfer_query(sql: str, source_connection: object, target_connection: object, base_table: str = '', base_col: str = '', lower_limit: int = -1, upper_limit: int = -1) |
|
| execute_sql_file | execute_sql_file(file_name) |
|
| execute_set | execute_set(sql, alt_db = 0, quiet = 0, context = '') |
|
| escape_html | escape_html(text) |
|
| escape_sql | escape_sql(item_str: str) -> str |
|
| sql_format | sql_format(sql: str) -> str |
Format SQL into a readable multi-line statement. |
| text_format | text_format(text: str, width: int = 60) -> str |
Format text; SQL-looking text is routed through sql_format. |
| set_table | set_table(table) |
|
| get_table_primary | get_table_primary(table) |
|
| get_sql_epoch | get_sql_epoch(timeslip = 0) |
|
| get_epoch_string | get_epoch_string(date_time) |
|
| get_sql_epoch_string | get_sql_epoch_string(Datetime) |
|
| decode_description | decode_description(Fields) |
|
| read_description | read_description(cur, Key = '') |
|
| read_cursor | read_cursor(rec, prefix = '_') |
|
| read_sql_direct | read_sql_direct(InSql, DB = 0) |
|
| dict_read_object | dict_read_object(context: dict) -> None |
|
| sql_read_object | sql_read_object(in_sql: str, DB = 0, fields = '', prefix = '_') -> int |
|
| patch | patch(field, in_value) |
|
| transform | transform() |
|
| get_delete_sql | get_delete_sql(table: str = '', keys: Optional[list] = None) |
|
| get_update_sql | get_update_sql(table: str = '', keys: Optional[list] = None) |
|
| get_insert_sql | get_insert_sql(table: str = '', keys: Optional[list] = None) -> str |
|
| get_insert_ignore_sql | get_insert_ignore_sql(table: str = '', keys: Optional[list] = None) -> str |
|
| get_replace_sql | get_replace_sql(table: str = '', keys = []) -> str |
|
| commit | commit(do_insert = '') |
|
| render_field_base | render_field_base(field, value) |
|
| render_field | render_field(field, value) |
|
| update | update(table = '') |
|
| create | create(table = '') |
|
| EscapeHtml | EscapeHtml(Text) |
|
| SetTable | SetTable(Table) |
|
| GetTablePrimary | GetTablePrimary(Table) |
|
| Patch | Patch(Field, InValue) |
|
| Transform | Transform() |
|
| GetInsertSql | GetInsertSql(table: str = '', keys: Optional[list] = None) |
|
| GetInsertIgnoreSql | GetInsertIgnoreSql(table: str = '', keys: Optional[list] = None) |
|
| GetReplaceSql | GetReplaceSql(table: str = '', keys = []) |
|
| Commit | Commit(DoInsert = '') |
|
| BuildSchema | BuildSchema(Form = '', Formname = '') |
|
| GetForm | GetForm(Form = '') |
|
| RenderFieldName | RenderFieldName(Parameter) |
|
| RenderFieldBase | RenderFieldBase(Field, Value) |
|
| RegisterParameter | RegisterParameter(Parameter, Data, Calc) |
|
| RenderField | RenderField(Field, Value) |
|
| BuildObject | BuildObject(Keyvals) |
|
| Update | Update(table = '') |
|
| Create | Create(Table = '') |
|
| import_normalise | import_normalise(Obj) |
|
| get_table_types | get_table_types(table) |
|
| get_db_record | get_db_record(CurDB, cur) |
|
| db_reconnect | db_reconnect(error_connect: str | Exception, sql: str, db = 0) |
Attempt to reconnect the database if the connection is stale or lost. |
| check_cron | check_cron() |
|
| backup | backup(keys) -> None |
Store a snapshot of current attribute values for the given keys. |
| get_image | get_image(name: str = '', guid: str = '') -> tuple |
|
| get_webfile | get_webfile(name = '', guid = '') -> tuple |
|
| read_webfile | read_webfile(directory: str = '', filename: str = '') -> str |
Reads the content of a specified web file from a given directory |
| tag_markdown | tag_markdown(module: str, tag: str, content: str = '') -> None |
|
| preflight | preflight() |
Delegate to ObjPreflight when available, otherwise run legacy checks. |
| check_preflight | check_preflight() |
| Method | Signature | Description |
|---|---|---|
| test_Encryption | test_Encryption() |
|
| test_Remote | test_Remote() |
Returns a thread-local dictionary for caching remote connections.
Runs preflight checks to ensure the environment is set up correctly.
Creates database tables from a given YAML schema file.
Checks and displays the database's default character set and collation.
Test the InfluxDB connection and create the bucket if it does not exist.