Skip to content

Commit f0362b7

Browse files
authored
Merge branch 'main' into release-3.0.0
2 parents 9ea8e7e + 04d32f9 commit f0362b7

File tree

4 files changed

+102
-10
lines changed

4 files changed

+102
-10
lines changed

awswrangler/redshift.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ def connect(
434434
timeout: Optional[int] = None,
435435
max_prepared_statements: int = 1000,
436436
tcp_keepalive: bool = True,
437+
**kwargs: Any,
437438
) -> redshift_connector.Connection:
438439
"""Return a redshift_connector connection from a Glue Catalog or Secret Manager.
439440
@@ -455,23 +456,23 @@ def connect(
455456
456457
Parameters
457458
----------
458-
connection : Optional[str]
459+
connection : str, optional
459460
Glue Catalog Connection name.
460461
secret_id : Optional[str]:
461462
Specifies the secret containing the connection details that you want to retrieve.
462463
You can specify either the Amazon Resource Name (ARN) or the friendly name of the secret.
463464
catalog_id : str, optional
464465
The ID of the Data Catalog.
465466
If none is provided, the AWS account ID is used by default.
466-
dbname : Optional[str]
467+
dbname : str, optional
467468
Optional database name to overwrite the stored one.
468469
boto3_session : boto3.Session(), optional
469470
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
470471
ssl : bool
471472
This governs SSL encryption for TCP/IP sockets.
472473
This parameter is forward to redshift_connector.
473474
https://github.com/aws/amazon-redshift-python-driver
474-
timeout : Optional[int]
475+
timeout : int, optional
475476
This is the time in seconds before the connection to the server will time out.
476477
The default is None which means no timeout.
477478
This parameter is forward to redshift_connector.
@@ -483,6 +484,9 @@ def connect(
483484
If True then use TCP keepalive. The default is True.
484485
This parameter is forward to redshift_connector.
485486
https://github.com/aws/amazon-redshift-python-driver
487+
**kwargs : Any
488+
Forwarded to redshift_connector.connect.
489+
e.g. is_serverless=True, serverless_acct_id='...', serverless_work_group='...'
486490
487491
Returns
488492
-------
@@ -527,6 +531,7 @@ def connect(
527531
timeout=timeout,
528532
max_prepared_statements=max_prepared_statements,
529533
tcp_keepalive=tcp_keepalive,
534+
**kwargs,
530535
)
531536

532537

@@ -542,6 +547,7 @@ def connect_temp(
542547
timeout: Optional[int] = None,
543548
max_prepared_statements: int = 1000,
544549
tcp_keepalive: bool = True,
550+
**kwargs: Any,
545551
) -> redshift_connector.Connection:
546552
"""Return a redshift_connector temporary connection (No password required).
547553
@@ -571,7 +577,7 @@ def connect_temp(
571577
This governs SSL encryption for TCP/IP sockets.
572578
This parameter is forward to redshift_connector.
573579
https://github.com/aws/amazon-redshift-python-driver
574-
timeout : Optional[int]
580+
timeout : int, optional
575581
This is the time in seconds before the connection to the server will time out.
576582
The default is None which means no timeout.
577583
This parameter is forward to redshift_connector.
@@ -583,6 +589,9 @@ def connect_temp(
583589
If True then use TCP keepalive. The default is True.
584590
This parameter is forward to redshift_connector.
585591
https://github.com/aws/amazon-redshift-python-driver
592+
**kwargs : Any
593+
Forwarded to redshift_connector.connect.
594+
e.g. is_serverless=True, serverless_acct_id='...', serverless_work_group='...'
586595
587596
Returns
588597
-------
@@ -623,6 +632,7 @@ def connect_temp(
623632
max_prepared_statements=max_prepared_statements,
624633
tcp_keepalive=tcp_keepalive,
625634
db_groups=db_groups,
635+
**kwargs,
626636
)
627637

628638

awswrangler/s3/_list.pyi

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import datetime
2+
from typing import Any, Dict, Iterator, List, Literal, Optional, Sequence, Union, overload
3+
4+
import boto3
5+
6+
def _path2list(
7+
path: Union[str, Sequence[str]],
8+
boto3_session: boto3.Session,
9+
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
10+
last_modified_begin: Optional[datetime.datetime] = ...,
11+
last_modified_end: Optional[datetime.datetime] = ...,
12+
suffix: Union[str, List[str], None] = ...,
13+
ignore_suffix: Union[str, List[str], None] = ...,
14+
ignore_empty: bool = ...,
15+
) -> List[str]: ...
16+
def _prefix_cleanup(prefix: str) -> str: ...
17+
def does_object_exist(
18+
path: str,
19+
s3_additional_kwargs: Optional[Dict[str, Any]] = ...,
20+
boto3_session: Optional[boto3.Session] = ...,
21+
version_id: Optional[str] = ...,
22+
) -> bool: ...
23+
def list_buckets(boto3_session: Optional[boto3.Session] = ...) -> List[str]: ...
24+
@overload
25+
def list_directories(
26+
path: str,
27+
chunked: Literal[False],
28+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
29+
boto3_session: Optional[boto3.Session] = ...,
30+
) -> List[str]: ...
31+
@overload
32+
def list_directories(
33+
path: str,
34+
*,
35+
boto3_session: Optional[boto3.Session] = ...,
36+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
37+
) -> List[str]: ...
38+
@overload
39+
def list_directories(
40+
path: str,
41+
chunked: Literal[True],
42+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
43+
boto3_session: Optional[boto3.Session] = ...,
44+
) -> Iterator[List[str]]: ...
45+
@overload
46+
def list_directories(
47+
path: str,
48+
chunked: bool,
49+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
50+
boto3_session: Optional[boto3.Session] = ...,
51+
) -> Union[List[str], Iterator[List[str]]]: ...
52+
@overload
53+
def list_objects(
54+
path: str,
55+
chunked: Literal[False],
56+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
57+
boto3_session: Optional[boto3.Session] = ...,
58+
) -> List[str]: ...
59+
@overload
60+
def list_objects(
61+
path: str,
62+
*,
63+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
64+
boto3_session: Optional[boto3.Session] = ...,
65+
) -> List[str]: ...
66+
@overload
67+
def list_objects(
68+
path: str,
69+
chunked: Literal[True],
70+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
71+
boto3_session: Optional[boto3.Session] = ...,
72+
) -> Iterator[List[str]]: ...
73+
@overload
74+
def list_objects(
75+
path: str,
76+
chunked: bool,
77+
s3_additional_kwargs: Union[Dict[str, Any], Dict[str, str], None] = ...,
78+
boto3_session: Optional[boto3.Session] = ...,
79+
) -> Union[List[str], Iterator[List[str]]]: ...

tests/test_catalog.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ def test_create_table(path: str, glue_database: str, glue_table: str, table_type
3636
assert wr.catalog.does_table_exist(database=glue_database, table=glue_table) is True
3737

3838

39-
@pytest.mark.parametrize("table_type", ["EXTERNAL_TABLE", "GOVERNED"])
40-
@pytest.mark.parametrize("start_transaction", [True, False])
39+
@pytest.mark.parametrize(
40+
("table_type", "start_transaction"),
41+
[
42+
("EXTERNAL_TABLE", False),
43+
("EXTERNAL_TABLE", True),
44+
pytest.param("GOVERNED", False, marks=pytest.mark.xfail(reason="TransactionCommitInProgressException")),
45+
],
46+
)
4147
def test_catalog(
4248
path: str, glue_database: str, glue_table: str, table_type: Optional[str], start_transaction: bool, account_id: str
4349
) -> None:
44-
if table_type != "GOVERNED" and start_transaction:
45-
pytest.skip()
46-
4750
transaction_id = wr.lakeformation.start_transaction() if table_type == "GOVERNED" else None
4851
wr.catalog.create_parquet_table(
4952
database=glue_database,

tests/test_redshift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def redshift_con():
2828

2929

3030
def test_connection():
31-
wr.redshift.connect("aws-data-wrangler-redshift", timeout=10).close()
31+
wr.redshift.connect("aws-data-wrangler-redshift", timeout=10, force_lowercase=False).close()
3232

3333

3434
def test_read_sql_query_simple(databases_parameters):

0 commit comments

Comments
 (0)