o
    uyi	                     @   s`   d dl mZmZ d dlmZ d dlmZmZmZm	Z	m
Z
 er$d dlmZ G dd de
d ZdS )    )TYPE_CHECKINGTuple)StatisticsFile)RemoveStatisticsUpdateSetStatisticsUpdateTableUpdateUpdatesAndRequirementsUpdateTableMetadata)Transactionc                       sj   e Zd ZU dZdZeedf ed< d fd	d
Zde	dd fddZ
dedd fddZdefddZ  ZS )UpdateStatisticsaR  
    Run statistics management operations using APIs.

    APIs include set_statistics and remove statistics operations.

    Use table.update_statistics().<operation>().commit() to run a specific operation.
    Use table.update_statistics().<operation-one>().<operation-two>().commit() to run multiple operations.

    Pending changes are applied on commit.

    We can also use context managers to make more changes. For example:

    with table.update_statistics() as update:
        update.set_statistics(statistics_file=statistics_file)
        update.remove_statistics(snapshot_id=2)
     ._updatestransactionr
   returnNc                    s   t  | d S )N)super__init__)selfr   	__class__r   d/home/ubuntu/maya3_transcribe/venv/lib/python3.10/site-packages/pyiceberg/table/update/statistics.pyr   4   s   zUpdateStatistics.__init__statistics_filec                 C   s   |  j t|df7  _ | S )N)
statistics)r   r   )r   r   r   r   r   set_statistics7   s   zUpdateStatistics.set_statisticssnapshot_idc                 C   s   t |df| _| S )N)r   )r   r   )r   r   r   r   r   remove_statistics@   s
   z"UpdateStatistics.remove_statisticsc                 C   s
   | j dfS )Nr   )r   )r   r   r   r   _commitI   s   
zUpdateStatistics._commit)r   r
   r   N)__name__
__module____qualname____doc__r   r   r   __annotations__r   r   r   intr   r   r   __classcell__r   r   r   r   r       s   
 		r   N)typingr   r   pyiceberg.table.statisticsr   pyiceberg.table.updater   r   r   r   r	   pyiceberg.tabler
   r   r   r   r   r   <module>   s   