diff --git a/moto/glue/utils.py b/moto/glue/utils.py index 11b063692..04cacbd85 100644 --- a/moto/glue/utils.py +++ b/moto/glue/utils.py @@ -1,7 +1,6 @@ import abc import operator import re -import warnings from datetime import date, datetime from itertools import repeat from typing import Any, Dict, List, Optional, Union @@ -16,13 +15,19 @@ from pyparsing import ( Suppress, Word, alphanums, - delimited_list, exceptions, infix_notation, one_of, pyparsing_common, ) +try: + # TODO import directly when depending on pyparsing>=3.1.0 + from pyparsing import DelimitedList +except ImportError: + # delimited_list is deprecated in favor of DelimitedList in pyparsing 3.1.0 + from pyparsing import delimited_list as DelimitedList # type: ignore[assignment] + from .exceptions import ( InvalidInputException, InvalidStateException, @@ -280,7 +285,7 @@ class _PartitionFilterExpressionCache: string <<= QuotedString(quote_char="'", esc_quote="''") | lpar + string + rpar # type: ignore literal = (number | string).set_name("literal") - literal_list = delimited_list(literal, min=1).set_name("list") + literal_list = DelimitedList(literal, min=1).set_name("list") bin_op = one_of("<> >= <= > < =").set_name("binary op") @@ -352,7 +357,6 @@ class PartitionFilter: if expression is None: return True - warnings.warn("Expression filtering is experimental") versions = list(self.fake_table.versions.values()) return expression.eval( part_keys=versions[-1].get("PartitionKeys", []), diff --git a/tests/test_glue/test_partition_filter.py b/tests/test_glue/test_partition_filter.py index 4bfa6aa1b..12bf31fcd 100644 --- a/tests/test_glue/test_partition_filter.py +++ b/tests/test_glue/test_partition_filter.py @@ -346,12 +346,11 @@ def test_get_partition_expression_warnings_and_exceptions(): kwargs = {"DatabaseName": database_name, "TableName": table_name} - with pytest.warns(match="Expression filtering is experimental"): - response = client.get_partitions(**kwargs, Expression="string_col = 'test'") - partitions = response["Partitions"] - partitions.should.have.length_of(1) - partition = partitions[0] - partition["Values"].should.equal(["test", "int", "3.14"]) + response = client.get_partitions(**kwargs, Expression="string_col = 'test'") + partitions = response["Partitions"] + partitions.should.have.length_of(1) + partition = partitions[0] + partition["Values"].should.equal(["test", "int", "3.14"]) with pytest.raises(ClientError) as exc: client.get_partitions(**kwargs, Expression="float_col = 3.14")