Ë
    ¼vëj  ã                  ó8   — d Z ddlmZ dZd	d„Zd
d„Zd
d„Zdd„Zy)a{  How much the organisation holds, measured in its own schema.

Vectors are measured from the database itself: every table in the schema with a vector or float-array column,
indexes included, so a new product's vector table is counted the day it appears and nothing has to be registered.
Cloud objects are the sum of what products recorded in storage_objects and have not deleted.
é    )Úannotations)ÚvectorÚ_float4Ú_float8c                ó`   — | j                  d|t        t        «      f«      j                  «       S )z@(table, bytes) for every table in the schema that holds vectors.a}  SELECT c.table_name, pg_total_relation_size(quote_ident(c.table_schema) || '.' || quote_ident(c.table_name)) FROM information_schema.columns c JOIN information_schema.tables t   ON t.table_schema = c.table_schema AND t.table_name = c.table_name AND t.table_type = 'BASE TABLE' WHERE c.table_schema = %s AND c.udt_name = ANY(%s) GROUP BY c.table_name, c.table_schema ORDER BY 2 DESC)ÚexecuteÚlistÚVECTOR_COLUMN_TYPESÚfetchall©ÚconnÚschemas     ú^/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/galaxiq_utils/storage/measure.pyÚvector_tablesr      s2   € à�<‰<ð	@ð
 
”Ô)Ó*Ð+ó-÷ .6©X«Zð8ó    c                ó:   — t        d„ t        | |«      D «       «      S )Nc              3  ó8   K  — | ]  \  }}t        |«      –— Œ y ­w)N)Úint)Ú.0Ú_Úsizes      r   ú	<genexpr>zvector_bytes.<locals>.<genexpr>   s   è ø€ ÒD™W˜Q Œs�4�yÑDùs   ‚)Úsumr   r   s     r   Úvector_bytesr      s   € ÜÑD¬°d¸FÓ(CÔDÓDÐDr   c                ól   — | j                  d|› d�«      j                  «       }t        |d   xs d«      S )Nz%SELECT coalesce(sum(bytes), 0) FROM "z*".storage_objects WHERE deleted_at IS NULLr   )r   Úfetchoner   )r   r   Úrows      r   Úcloud_bytesr      s7   € Ø
�,‰,Ð>¸v¸hÐFpÐqÓ
r×
{Ñ
{Ó
}€CÜˆs�1‰vŠ{˜ÓÐr   c           
     ó²   — | j                  d|› d�«      j                  «       }|D ���ci c]  \  }}}|t        |«      t        |«      dœ“Œ  c}}}S c c}}}w )Nz8SELECT product, coalesce(sum(bytes), 0), count(*) FROM "zK".storage_objects WHERE deleted_at IS NULL GROUP BY product ORDER BY 2 DESC)ÚbytesÚobjects)r   r   r   )r   r   ÚrowsÚproductr   Úns         r   Úcloud_by_productr%       sd   € Ø�<‰<ÐRÐSYÐRZð [Tð Tó UßU]ÑU]ÓU_ð 	àUY×ZÐZÑAQÀÈ$ÐPQˆGœs 4›y´S¸³VÑ<Ñ<ÔZÐZùÔZs   ª#AN)r   ÚstrÚreturnr	   )r   r&   r'   r   )r   r&   r'   Údict)Ú__doc__Ú
__future__r   r
   r   r   r   r%   © r   r   ú<module>r,      s+   ðñõ #à6Ð ó8óEóô
[r   