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. The shard_id can be passed for a 2.0 style execution to the bind_arguments dictionary of :meth:`.Session.e
(self, shard_id: ShardIdentifier)
| 120 | self._shard_id = None |
| 121 | |
| 122 | def set_shard(self, shard_id: ShardIdentifier) -> Self: |
| 123 | """Return a new query, limited to a single shard ID. |
| 124 | |
| 125 | All subsequent operations with the returned query will |
| 126 | be against the single shard regardless of other state. |
| 127 | |
| 128 | The shard_id can be passed for a 2.0 style execution to the |
| 129 | bind_arguments dictionary of :meth:`.Session.execute`:: |
| 130 | |
| 131 | results = session.execute(stmt, bind_arguments={"shard_id": "my_shard"}) |
| 132 | |
| 133 | """ # noqa: E501 |
| 134 | return self.execution_options(_sa_shard_id=shard_id) |
| 135 | |
| 136 | |
| 137 | class ShardedSession(Session): |