# pyiceberg_maintenance

*module*

pyiceberg_maintenance
~~~~~~~~~~~~~~~~~~~~~

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

> **Public API**
>
> - :class:`RawSQL`              – wrap a literal SQL expression to skip quoting
> - :func:`generate_iceberg_call` – build a ``CALL`` statement
>   SQL statement

[View source](https://github.com/PySparky/pyiceberg-procedure/blob/f01b27084c34cbf95462947f4405f5a5a9628d24/src/pyiceberg_maintenance/__init__.py#L1-L1)

## pyiceberg_maintenance.RawSQL

*class*

```python
class RawSQL
```

Re-exported from: `pyiceberg_maintenance.procedure_builder`

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'")

[View source](https://github.com/PySparky/pyiceberg-procedure/blob/f01b27084c34cbf95462947f4405f5a5a9628d24/src/pyiceberg_maintenance/procedure_builder.py#L11-L37)

### pyiceberg_maintenance.RawSQL.value

*attribute* · *instance attribute*

```python
value = value
```

[View source](https://github.com/PySparky/pyiceberg-procedure/blob/f01b27084c34cbf95462947f4405f5a5a9628d24/src/pyiceberg_maintenance/procedure_builder.py#L26-L26)

## pyiceberg_maintenance.generate_iceberg_call

*function*

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

Re-exported from: `pyiceberg_maintenance.procedure_builder`

Generate an Apache Iceberg ``CALL`` statement with named arguments.

**Parameters**

- `catalog` (`str`) — Spark catalog name (e.g. ``"spark_catalog"`` or ``"hive_prod"``).
- `procedure` (`str`) — Iceberg system procedure name (e.g. ``"rewrite_data_files"``).
- `arguments` (`Dict[str, Any]`) — Mapping of argument name → value.  Values are converted to their Spark SQL representations by :func:`_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')"

[View source](https://github.com/PySparky/pyiceberg-procedure/blob/f01b27084c34cbf95462947f4405f5a5a9628d24/src/pyiceberg_maintenance/procedure_builder.py#L111-L156)

**Modules**

- `pyiceberg_maintenance.procedure_builder`
