crate.operator.sql module

class crate.operator.sql.SQLResult(rowcount, rows, error_code, error_message)

Bases: object

Parameters:
error_code: int | None
error_message: str | None
property ok: bool
rowcount: int | None
rows: list | None
async crate.operator.sql.execute_sql(*, namespace, name, pod_name, scheme, sql, args, logger)
Parameters:
Return type:

SQLResult

async crate.operator.sql.execute_sql_via_crate_control(*, namespace, name, sql, args, logger)
Parameters:
crate.operator.sql.normalize_crash(output)
Parameters:

output (str)

Return type:

SQLResult

crate.operator.sql.normalize_crate_control(resp)
Parameters:

resp (dict)

Return type:

SQLResult

crate.operator.sql.parse_crash_table(output)
Parameters:

output (str)

Return type:

List[Tuple[Any, ...]]

async crate.operator.sql.run_crash_command(namespace, pod_name, scheme, command, logger, delay=30)

This connects to a CrateDB pod and executes a crash command in the crate container. It returns the result of the execution.

Parameters:
  • namespace (str) – The Kubernetes namespace of the CrateDB cluster.

  • pod_name (str) – The pod name where the command should be run.

  • scheme (str) – The host scheme for running the command.

  • command (str) – The SQL query that should be run.

  • logger – the logger on which we’re logging

  • delay (int) – Time in seconds between the retries when executing the query.