Add pytest test example about connecting to a worker (#7386)

I noticed while reviewing #7203 that there as no example of executing
sql on a worker for the pytest README. Since this is a pretty common
thing that people want to do, this PR adds that.
pull/7388/head
Jelte Fennema-Nio 2024-01-18 13:05:24 +01:00 committed by GitHub
parent fcfedff8d1
commit 5ec056a172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -82,6 +82,7 @@ the name of the fixture. For example:
```python ```python
def test_some_query(cluster): def test_some_query(cluster):
cluster.coordinator.sql("SELECT 1") cluster.coordinator.sql("SELECT 1")
assert cluster.workers[0].sql_value('SELECT 2') == 2
``` ```
If you need a cluster of a specific size you can use the `cluster_factory` If you need a cluster of a specific size you can use the `cluster_factory`