Source: factory.core/Objects.py
Manages database connections and configuration-related details.
The Connection class encapsulates the functionalities required for configuring,
establishing, and handling connections with a database. It also includes utility methods
to read configuration values, manage redis settings, and manipulate database details for
...
| Method | Signature | Description |
|---|---|---|
| debug | debug(*args) |
Debug logging for Connection class. |
| get_local_db_name | get_local_db_name(host: str = '', client: str = '') -> str |
|
| transfer_detail | transfer_detail(DB, recon_db) |
Transfers details from one database object to another by attempting to assign attribute values |
| get_sql_set | get_sql_set(config_name = 'primary') -> list |
|
| connect_db | connect_db(DB = 0, remote: str = '', force_new: int = 0, reconnect: int = 0, config_name = 'primary') -> object |
Establishes and configures a database connection. |
Represents an Object class with various utility methods for database operations,
data manipulation, encryption, decryption, and system-level operations. The class
acts as a central component for handling a combination of functionalities such
as connecting to databases, dealing with Redis, process injection, and cryptographic
operations.
...
| Method | Signature | Description |
|---|---|---|
| close_db | close_db(db = 0) -> None |
|
| get_db_connections | get_db_connections() |
|
| encrypt | encrypt(message: str, package = '') -> str |
|
| decrypt | decrypt(message: str, package = '') -> str |
|
| get_deployment | get_deployment() -> str |
|
| get_host | get_host() -> str |
|
| get_role | get_role() -> str |
|
| DBType | DBType(AltDB = 0) -> str |
|
| safe_int | safe_int(value, default = 0) |
Safely convert a value to int. Returns default if conversion fails. |
| get_uuid | get_uuid(context: str = '') -> str |
|
| is_my_sql | is_my_sql(data_connector) -> int |
|
| is_ms_sql | is_ms_sql(data_connector) -> bool |
Return True when data_connector is a Microsoft SQL Server connection. |
| is_postgres | is_postgres(data_connector) -> bool |
Return True when data_connector is a PostgreSQL connection. |
| is_sqlite | is_sqlite(data_connector) -> bool |
Return True when data_connector is an SQLite connection. |
| is_mongo | is_mongo(data_connector) -> int |
|
| is_openobserve | is_openobserve(data_connector: object) -> int |
|
| is_docker | is_docker() -> int |
Check if running inside Docker. |
| is_kubernetes | is_kubernetes() -> int |
Check if running inside a Kubernetes pod. |
| patch_all | patch_all(term: str, key: str, value: str) -> str |
|
| patch_paramBuffer | patch_paramBuffer(term: str) -> str |
|
| get_acl | get_acl() |
Resolve the active ACL object when available. |
| patch_paramRun | patch_paramRun(term: str, depth: int = 0, local_db: int = 0) -> str |
|
| patch_param | patch_param(term: str, depth: int = 0) -> str |
|
| process_text | process_text(text: str = '') -> str |
|
| inject_hidden | inject_hidden(target: object) |
|
| inject | inject(target: object) -> None |
|
| inject_dictionary | inject_dictionary(inject_dict: dict) |
|
| EncodeClassJson | EncodeClassJson() -> str |
|
| EncodeJson | EncodeJson() -> str |
|
| decode_class_json | decode_class_json(d: dict) -> None |
|
| DecodeJson | DecodeJson(json_str: str) -> None |
|
| sql_escape | sql_escape(sql: str) -> str |
|
| command_line | command_line(prompt = 'Please select action', choices = None) |
|
| create_tables_from_yaml | create_tables_from_yaml(schema_name: str) |
Loads table schemas from a YAML file and creates them in the database if they don't exist. |
Get configuration value(s) from ConfigIni.
Get configuration value(s) as integer(s).
Get configuration value(s) as float(s).
Convert a value to bool using common truthy/falsy string patterns.
Get configuration value(s) as boolean(s).
Return database config with compatibility for legacy/mocked ConfigIni objects.
Checks if the script is running inside byobu, tmux, or screen.
Gathers detailed information about the multiplexer environment.
Runs the connect command.
Detects and prints the virtualization environment.
Objects CLI.