Skip to content

pyiceberg_maintenance

Type part of a name or a dotted path

pyiceberg_maintenance

Utilities for generating Apache Iceberg maintenance SQL (``CALL``) statements
from Python data structures.

Classes

NameDescription
RawSQLA wrapper to inject raw SQL expressions (e.g. TIMESTAMP '...', zorder

Functions

NameDescription
generate_iceberg_callGenerate an Apache Iceberg CALL statement with named arguments.

RawSQLclass#

class RawSQL(value: str)

A wrapper to inject raw SQL expressions (e.g. TIMESTAMP '...', zorder expressions) that bypass standard string-quoting so they appear verbatim in the generated statement. The value is not validated or escaped: only use trusted SQL expressions and never construct it from untrusted input.

Example::

RawSQL("TIMESTAMP '2021-06-30 00:00:00.000'")

valueattributeinstance attribute#

value = value

generate_iceberg_callfunction#

def generate_iceberg_call(catalog: str, procedure: str, arguments: Dict[str, Any]) -> str

Generate an Apache Iceberg CALL statement with named arguments.

Parameters

NameTypeDescription
catalogstrSpark catalog name (e.g. "spark_catalog" or "hive_prod").
procedurestrIceberg system procedure name (e.g. "rewrite_data_files").
argumentsDict[str, Any]Mapping of argument name → value. Values are converted to their Spark SQL representations by _format_sql_value. Catalog, procedure, and argument names are emitted as regular or delimited Spark SQL identifiers.

Returns

str
A complete one-line CALL statement.
Example:

generate_iceberg_call( … catalog=“spark_catalog”, … procedure=“rewrite_data_files”, … arguments={“table”: “db.sample”}, … ) “CALL spark_catalog.system.rewrite_data_files(table => ‘db.sample’)”