Skip to content

Commit 9e3c9a8

Browse files
Safe get on table columns comments (#779)
* Minor - Safe get on col comments * xfail Athena 2 tests Co-authored-by: kukushking <[email protected]>
1 parent f98d6ba commit 9e3c9a8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

awswrangler/catalog/_get.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@ def get_columns_comments(
834834
)
835835
comments: Dict[str, str] = {}
836836
for c in response["Table"]["StorageDescriptor"]["Columns"]:
837-
comments[c["Name"]] = c["Comment"]
837+
comments[c["Name"]] = c.get("Comment")
838838
if "PartitionKeys" in response["Table"]:
839839
for p in response["Table"]["PartitionKeys"]:
840-
comments[p["Name"]] = p["Comment"]
840+
comments[p["Name"]] = p.get("Comment")
841841
return comments
842842

843843

tests/test_athena.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def test_athena_ctas_empty(glue_database):
255255
assert len(list(wr.athena.read_sql_query(sql=sql, database=glue_database, chunksize=1))) == 1
256256

257257

258+
@pytest.mark.xfail()
258259
def test_athena_struct(glue_database):
259260
sql = "SELECT CAST(ROW(1, 'foo') AS ROW(id BIGINT, value VARCHAR)) AS col0"
260261
with pytest.raises(wr.exceptions.UnsupportedType):
@@ -469,6 +470,7 @@ def test_read_sql_query_wo_results(path, glue_database, glue_table):
469470
ensure_athena_query_metadata(df=df, ctas_approach=False, encrypted=False)
470471

471472

473+
@pytest.mark.xfail()
472474
def test_read_sql_query_wo_results_ctas(path, glue_database, glue_table):
473475
wr.catalog.create_parquet_table(database=glue_database, table=glue_table, path=path, columns_types={"c0": "int"})
474476
sql = f"ALTER TABLE {glue_database}.{glue_table} SET LOCATION '{path}dir/'"

0 commit comments

Comments
 (0)