Skip to content

Commit 424d564

Browse files
Merge pull request #683 from pyathena-dev/refactor/rename-aconnect-to-aio-connect
Rename aconnect to aio_connect
2 parents 324e66f + a8b63b4 commit 424d564

File tree

16 files changed

+77
-77
lines changed

16 files changed

+77
-77
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ Native asyncio is also supported:
5656

5757
```python
5858
import asyncio
59-
from pyathena import aconnect
59+
from pyathena import aio_connect
6060

6161
async def main():
62-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
62+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
6363
region_name="us-west-2") as conn:
6464
cursor = conn.cursor()
6565
await cursor.execute("SELECT 1")

docs/aio.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PyAthena has two families of async cursors:
1414
|---|---|---|
1515
| **Concurrency model** | `concurrent.futures.ThreadPoolExecutor` | Native `asyncio` (`await` / `async for`) |
1616
| **Event loop** | Blocks a thread per query | Non-blocking |
17-
| **Connection** | `connect()` (sync) | `aconnect()` (async) |
17+
| **Connection** | `connect()` (sync) | `aio_connect()` (async) |
1818
| **execute()** returns | `(query_id, Future)` | Awaitable cursor (self) |
1919
| **Fetch methods** | Sync (via `Future.result()`) | `await cursor.fetchone()` for streaming cursors |
2020
| **Iteration** | `for row in result_set` | `async for row in cursor` |
@@ -29,22 +29,22 @@ from synchronous code.
2929

3030
## Connection
3131

32-
Use the `aconnect()` function to create an async connection.
32+
Use the `aio_connect()` function to create an async connection.
3333
It returns an `AioConnection` that produces `AioCursor` instances by default.
3434

3535
```python
36-
from pyathena import aconnect
36+
from pyathena import aio_connect
3737

38-
conn = await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
38+
conn = await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
3939
region_name="us-west-2")
4040
```
4141

4242
The connection supports the async context manager protocol:
4343

4444
```python
45-
from pyathena import aconnect
45+
from pyathena import aio_connect
4646

47-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
47+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
4848
region_name="us-west-2") as conn:
4949
cursor = conn.cursor()
5050
await cursor.execute("SELECT 1")
@@ -59,10 +59,10 @@ AioCursor is a native asyncio cursor that uses `await` for query execution and r
5959
It follows the DB API 2.0 interface adapted for async usage.
6060

6161
```python
62-
from pyathena import aconnect
62+
from pyathena import aio_connect
6363
from pyathena.aio.cursor import AioCursor
6464

65-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
65+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
6666
region_name="us-west-2") as conn:
6767
cursor = conn.cursor()
6868
await cursor.execute("SELECT * FROM many_rows")
@@ -74,9 +74,9 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
7474
The cursor supports the `async with` context manager:
7575

7676
```python
77-
from pyathena import aconnect
77+
from pyathena import aio_connect
7878

79-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
79+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
8080
region_name="us-west-2") as conn:
8181
async with conn.cursor() as cursor:
8282
await cursor.execute("SELECT * FROM many_rows")
@@ -86,9 +86,9 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
8686
You can iterate over results with `async for`:
8787

8888
```python
89-
from pyathena import aconnect
89+
from pyathena import aio_connect
9090

91-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
91+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
9292
region_name="us-west-2") as conn:
9393
async with conn.cursor() as cursor:
9494
await cursor.execute("SELECT * FROM many_rows")
@@ -99,9 +99,9 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
9999
Execution information of the query can also be retrieved:
100100

101101
```python
102-
from pyathena import aconnect
102+
from pyathena import aio_connect
103103

104-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
104+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
105105
region_name="us-west-2") as conn:
106106
async with conn.cursor() as cursor:
107107
await cursor.execute("SELECT * FROM many_rows")
@@ -121,9 +121,9 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
121121
To cancel a running query:
122122

123123
```python
124-
from pyathena import aconnect
124+
from pyathena import aio_connect
125125

126-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
126+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
127127
region_name="us-west-2") as conn:
128128
async with conn.cursor() as cursor:
129129
await cursor.execute("SELECT * FROM many_rows")
@@ -137,10 +137,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
137137
AioDictCursor is an AioCursor that returns rows as dictionaries with column names as keys.
138138

139139
```python
140-
from pyathena import aconnect
140+
from pyathena import aio_connect
141141
from pyathena.aio.cursor import AioDictCursor
142142

143-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
143+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
144144
region_name="us-west-2") as conn:
145145
cursor = conn.cursor(AioDictCursor)
146146
await cursor.execute("SELECT * FROM many_rows LIMIT 10")
@@ -152,10 +152,10 @@ If you want to change the dictionary type (e.g., use OrderedDict):
152152

153153
```python
154154
from collections import OrderedDict
155-
from pyathena import aconnect
155+
from pyathena import aio_connect
156156
from pyathena.aio.cursor import AioDictCursor
157157

158-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
158+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
159159
region_name="us-west-2") as conn:
160160
cursor = conn.cursor(AioDictCursor, dict_type=OrderedDict)
161161
await cursor.execute("SELECT * FROM many_rows LIMIT 10")

docs/api/aio.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Connection
99
----------
1010

1111
.. automodule:: pyathena
12-
:members: aconnect
12+
:members: aio_connect
1313

1414
.. autoclass:: pyathena.aio.connection.AioConnection
1515
:members:

docs/arrow.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,10 @@ Unlike AsyncArrowCursor which uses `concurrent.futures`, this cursor uses
491491
keeping the event loop free.
492492

493493
```python
494-
from pyathena import aconnect
494+
from pyathena import aio_connect
495495
from pyathena.aio.arrow.cursor import AioArrowCursor
496496

497-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
497+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
498498
region_name="us-west-2") as conn:
499499
cursor = conn.cursor(AioArrowCursor)
500500
table = (await cursor.execute("SELECT * FROM many_rows")).as_arrow()
@@ -507,10 +507,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
507507
Support fetch and iterate query results:
508508

509509
```python
510-
from pyathena import aconnect
510+
from pyathena import aio_connect
511511
from pyathena.aio.arrow.cursor import AioArrowCursor
512512

513-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
513+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
514514
region_name="us-west-2") as conn:
515515
cursor = conn.cursor(AioArrowCursor)
516516
await cursor.execute("SELECT * FROM many_rows")
@@ -520,10 +520,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
520520
```
521521

522522
```python
523-
from pyathena import aconnect
523+
from pyathena import aio_connect
524524
from pyathena.aio.arrow.cursor import AioArrowCursor
525525

526-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
526+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
527527
region_name="us-west-2") as conn:
528528
cursor = conn.cursor(AioArrowCursor)
529529
await cursor.execute("SELECT * FROM many_rows")
@@ -534,10 +534,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
534534
The `as_polars()` method converts the result to a Polars DataFrame:
535535

536536
```python
537-
from pyathena import aconnect
537+
from pyathena import aio_connect
538538
from pyathena.aio.arrow.cursor import AioArrowCursor
539539

540-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
540+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
541541
region_name="us-west-2") as conn:
542542
cursor = conn.cursor(AioArrowCursor)
543543
await cursor.execute("SELECT * FROM many_rows")
@@ -547,10 +547,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
547547
The unload option is also available:
548548

549549
```python
550-
from pyathena import aconnect
550+
from pyathena import aio_connect
551551
from pyathena.aio.arrow.cursor import AioArrowCursor
552552

553-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
553+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
554554
region_name="us-west-2") as conn:
555555
cursor = conn.cursor(AioArrowCursor, unload=True)
556556
await cursor.execute("SELECT * FROM many_rows")
@@ -560,10 +560,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
560560
AioArrowCursor also supports S3 timeout configuration:
561561

562562
```python
563-
from pyathena import aconnect
563+
from pyathena import aio_connect
564564
from pyathena.aio.arrow.cursor import AioArrowCursor
565565

566-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
566+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
567567
region_name="us-west-2") as conn:
568568
cursor = conn.cursor(AioArrowCursor, connect_timeout=10.0, request_timeout=30.0)
569569
await cursor.execute("SELECT * FROM many_rows")

docs/pandas.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,10 @@ Unlike AsyncPandasCursor which uses `concurrent.futures`, this cursor uses
778778
keeping the event loop free.
779779

780780
```python
781-
from pyathena import aconnect
781+
from pyathena import aio_connect
782782
from pyathena.aio.pandas.cursor import AioPandasCursor
783783

784-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
784+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
785785
region_name="us-west-2") as conn:
786786
cursor = conn.cursor(AioPandasCursor)
787787
await cursor.execute("SELECT * FROM many_rows")
@@ -793,10 +793,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
793793
Support fetch and iterate query results:
794794

795795
```python
796-
from pyathena import aconnect
796+
from pyathena import aio_connect
797797
from pyathena.aio.pandas.cursor import AioPandasCursor
798798

799-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
799+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
800800
region_name="us-west-2") as conn:
801801
cursor = conn.cursor(AioPandasCursor)
802802
await cursor.execute("SELECT * FROM many_rows")
@@ -806,10 +806,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
806806
```
807807

808808
```python
809-
from pyathena import aconnect
809+
from pyathena import aio_connect
810810
from pyathena.aio.pandas.cursor import AioPandasCursor
811811

812-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
812+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
813813
region_name="us-west-2") as conn:
814814
cursor = conn.cursor(AioPandasCursor)
815815
await cursor.execute("SELECT * FROM many_rows")
@@ -820,10 +820,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
820820
The unload option is also available:
821821

822822
```python
823-
from pyathena import aconnect
823+
from pyathena import aio_connect
824824
from pyathena.aio.pandas.cursor import AioPandasCursor
825825

826-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
826+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
827827
region_name="us-west-2") as conn:
828828
cursor = conn.cursor(AioPandasCursor, unload=True)
829829
await cursor.execute("SELECT * FROM many_rows")

docs/polars.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,10 @@ Unlike AsyncPolarsCursor which uses `concurrent.futures`, this cursor uses
585585
keeping the event loop free.
586586

587587
```python
588-
from pyathena import aconnect
588+
from pyathena import aio_connect
589589
from pyathena.aio.polars.cursor import AioPolarsCursor
590590

591-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
591+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
592592
region_name="us-west-2") as conn:
593593
cursor = conn.cursor(AioPolarsCursor)
594594
await cursor.execute("SELECT * FROM many_rows")
@@ -600,10 +600,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
600600
Support fetch and iterate query results:
601601

602602
```python
603-
from pyathena import aconnect
603+
from pyathena import aio_connect
604604
from pyathena.aio.polars.cursor import AioPolarsCursor
605605

606-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
606+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
607607
region_name="us-west-2") as conn:
608608
cursor = conn.cursor(AioPolarsCursor)
609609
await cursor.execute("SELECT * FROM many_rows")
@@ -613,10 +613,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
613613
```
614614

615615
```python
616-
from pyathena import aconnect
616+
from pyathena import aio_connect
617617
from pyathena.aio.polars.cursor import AioPolarsCursor
618618

619-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
619+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
620620
region_name="us-west-2") as conn:
621621
cursor = conn.cursor(AioPolarsCursor)
622622
await cursor.execute("SELECT * FROM many_rows")
@@ -627,10 +627,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
627627
The `as_arrow()` method converts the result to an Apache Arrow Table:
628628

629629
```python
630-
from pyathena import aconnect
630+
from pyathena import aio_connect
631631
from pyathena.aio.polars.cursor import AioPolarsCursor
632632

633-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
633+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
634634
region_name="us-west-2") as conn:
635635
cursor = conn.cursor(AioPolarsCursor)
636636
await cursor.execute("SELECT * FROM many_rows")
@@ -640,10 +640,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
640640
The unload option is also available:
641641

642642
```python
643-
from pyathena import aconnect
643+
from pyathena import aio_connect
644644
from pyathena.aio.polars.cursor import AioPolarsCursor
645645

646-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
646+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
647647
region_name="us-west-2") as conn:
648648
cursor = conn.cursor(AioPolarsCursor, unload=True)
649649
await cursor.execute("SELECT * FROM many_rows")

docs/s3fs.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ Since `AthenaS3FSResultSet` lazily streams rows from S3 via a CSV reader,
380380
fetch methods are async and require `await`.
381381

382382
```python
383-
from pyathena import aconnect
383+
from pyathena import aio_connect
384384
from pyathena.aio.s3fs.cursor import AioS3FSCursor
385385

386-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
386+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
387387
region_name="us-west-2") as conn:
388388
cursor = conn.cursor(AioS3FSCursor)
389389
await cursor.execute("SELECT * FROM many_rows")
@@ -395,10 +395,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
395395
Async iteration is supported:
396396

397397
```python
398-
from pyathena import aconnect
398+
from pyathena import aio_connect
399399
from pyathena.aio.s3fs.cursor import AioS3FSCursor
400400

401-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
401+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
402402
region_name="us-west-2") as conn:
403403
cursor = conn.cursor(AioS3FSCursor)
404404
await cursor.execute("SELECT * FROM many_rows")
@@ -409,10 +409,10 @@ async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
409409
Execution information of the query can also be retrieved:
410410

411411
```python
412-
from pyathena import aconnect
412+
from pyathena import aio_connect
413413
from pyathena.aio.s3fs.cursor import AioS3FSCursor
414414

415-
async with await aconnect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
415+
async with await aio_connect(s3_staging_dir="s3://YOUR_S3_BUCKET/path/to/",
416416
region_name="us-west-2") as conn:
417417
cursor = conn.cursor(AioS3FSCursor)
418418
await cursor.execute("SELECT * FROM many_rows")

0 commit comments

Comments
 (0)