관리-도구
편집 파일: horizontal_shard.cpython-37.pyc
B ��4]�# � @ sp d Z ddlmZ ddlmZ ddlmZ ddlmZ ddgZG dd� de�Z G d d � d e �ZG dd� de�ZdS ) a Horizontal sharding support. Defines a rudimental 'horizontal sharding' system which allows a Session to distribute queries and persistence operations across multiple databases. For a usage example, see the :ref:`examples_sharding` example included in the source distribution. � )�inspect)�util)�Query)�Session�ShardedSession�ShardedQueryc sP e Zd Z� fdd�Zdd� Zdd� Zdd� Zd� fd d� Zd� fdd � Z� Z S )r c s0 t t| �j||� | jj| _| jj| _d | _d S )N)�superr �__init__�session� id_chooser� query_chooser� _shard_id)�self�args�kwargs)� __class__� �R/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/ext/horizontal_shard.pyr s zShardedQuery.__init__c C s | � � }||_|S )z�return a new query, limited to a single shard ID. all subsequent operations with the returned query will be against the single shard regardless of other state. )Z_cloner )r �shard_id�qr r r � set_shard"