diff --git a/CHANGELOG.md b/CHANGELOG.md index 40200d44a..520d6a482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,43 @@ Moto Changelog ============== +4.2.6 +----- +Docker Digest for 4.2.6: + + New Services: + * IVS: + * batch_get_channel() + * create_channel() + * delete_channel() + * get_channel() + * list_channels() + * update_channel() + + New Methods: + * LakeFormation: + * add_lf_tags_to_resource() + * get_resource_lf_tags() + * remove_lf_tags_from_resource() + * update_lf_tag() + + * Sagemaker: + * describe_model_package_group() + * update_model_package() + + Miscellaneous: + * Batch: submit_job() now behaves correctly when passing the arrayProperties-parameter + * DynamoDB: Improved PartiQL parser, with support for different types (Decimals/Booleans) and queries with quoted table-names + * EC2: TagSpecifications now throw an error if the ResourceType is not provided + * EC2: run_instances()/describe_instances() now always return the same attributes (before, both operations were missing different fields) + * EC2: associate_dhcp_options() now supports DhcpOptionsId=default + * EC2: create_key_pair() now supports the KeyType-parameter + * EC2: run_instances() now returns the Placement.HostId attribute + * ELBv2: modify_target_group_attributes() now has additional validations + * Events: put_events() now throws a warning when Detail field is not a dict + * IOT: update_thing() now behaves correctly with empty attributes + * S3: head_object() now raises a MethodNotAllowed for DeleteMarkers + 4.2.5 ----- Docker Digest for 4.2.5: _sha256:076cecca9b8ba35b545d23eb5bf780902fbf23eb3610f332eef7adea1f4d2ef7_ diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index c9302c490..670b531aa 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -2272,6 +2272,7 @@ - [X] disable_ebs_encryption_by_default - [ ] disable_fast_launch - [ ] disable_fast_snapshot_restores +- [ ] disable_image - [ ] disable_image_block_public_access - [ ] disable_image_deprecation - [ ] disable_ipam_organization_admin_account @@ -2299,6 +2300,7 @@ - [X] enable_ebs_encryption_by_default - [ ] enable_fast_launch - [ ] enable_fast_snapshot_restores +- [ ] enable_image - [ ] enable_image_block_public_access - [ ] enable_image_deprecation - [ ] enable_ipam_organization_admin_account @@ -7258,21 +7260,33 @@ ## textract
-15% implemented +8% implemented - [ ] analyze_document - [ ] analyze_expense - [ ] analyze_id +- [ ] create_adapter +- [ ] create_adapter_version +- [ ] delete_adapter +- [ ] delete_adapter_version - [ ] detect_document_text +- [ ] get_adapter +- [ ] get_adapter_version - [ ] get_document_analysis - [X] get_document_text_detection - [ ] get_expense_analysis - [ ] get_lending_analysis - [ ] get_lending_analysis_summary +- [ ] list_adapter_versions +- [ ] list_adapters +- [ ] list_tags_for_resource - [ ] start_document_analysis - [X] start_document_text_detection - [ ] start_expense_analysis - [ ] start_lending_analysis +- [ ] tag_resource +- [ ] untag_resource +- [ ] update_adapter
## timestream-write @@ -7468,6 +7482,7 @@ - cur - customer-profiles - dataexchange +- datazone - detective - devicefarm - devops-guru diff --git a/docs/docs/services/ec2.rst b/docs/docs/services/ec2.rst index a83b302b4..57b48a142 100644 --- a/docs/docs/services/ec2.rst +++ b/docs/docs/services/ec2.rst @@ -431,6 +431,7 @@ ec2 - [X] disable_ebs_encryption_by_default - [ ] disable_fast_launch - [ ] disable_fast_snapshot_restores +- [ ] disable_image - [ ] disable_image_block_public_access - [ ] disable_image_deprecation - [ ] disable_ipam_organization_admin_account @@ -458,6 +459,7 @@ ec2 - [X] enable_ebs_encryption_by_default - [ ] enable_fast_launch - [ ] enable_fast_snapshot_restores +- [ ] enable_image - [ ] enable_image_block_public_access - [ ] enable_image_deprecation - [ ] enable_ipam_organization_admin_account diff --git a/docs/docs/services/sagemaker.rst b/docs/docs/services/sagemaker.rst index 33b60af53..52d099cea 100644 --- a/docs/docs/services/sagemaker.rst +++ b/docs/docs/services/sagemaker.rst @@ -167,7 +167,7 @@ sagemaker - [ ] describe_model_card_export_job - [ ] describe_model_explainability_job_definition - [X] describe_model_package -- [ ] describe_model_package_group +- [X] describe_model_package_group - [ ] describe_model_quality_job_definition - [ ] describe_monitoring_schedule - [ ] describe_notebook_instance @@ -319,7 +319,7 @@ sagemaker - [ ] update_image_version - [ ] update_inference_experiment - [ ] update_model_card -- [ ] update_model_package +- [X] update_model_package - [ ] update_monitoring_alert - [ ] update_monitoring_schedule - [ ] update_notebook_instance diff --git a/docs/docs/services/textract.rst b/docs/docs/services/textract.rst index ddb2a3371..28f84aafb 100644 --- a/docs/docs/services/textract.rst +++ b/docs/docs/services/textract.rst @@ -30,7 +30,13 @@ textract - [ ] analyze_document - [ ] analyze_expense - [ ] analyze_id +- [ ] create_adapter +- [ ] create_adapter_version +- [ ] delete_adapter +- [ ] delete_adapter_version - [ ] detect_document_text +- [ ] get_adapter +- [ ] get_adapter_version - [ ] get_document_analysis - [X] get_document_text_detection @@ -40,6 +46,9 @@ textract - [ ] get_expense_analysis - [ ] get_lending_analysis - [ ] get_lending_analysis_summary +- [ ] list_adapter_versions +- [ ] list_adapters +- [ ] list_tags_for_resource - [ ] start_document_analysis - [X] start_document_text_detection @@ -48,4 +57,7 @@ textract - [ ] start_expense_analysis - [ ] start_lending_analysis +- [ ] tag_resource +- [ ] untag_resource +- [ ] update_adapter diff --git a/moto/dynamodb/models/__init__.py b/moto/dynamodb/models/__init__.py index 704f02753..71123a97c 100644 --- a/moto/dynamodb/models/__init__.py +++ b/moto/dynamodb/models/__init__.py @@ -1,5 +1,4 @@ import copy -import json import re from collections import OrderedDict @@ -26,7 +25,6 @@ from moto.dynamodb.exceptions import ( TransactWriteSingleOpException, ) from moto.dynamodb.models.dynamo_type import DynamoType, Item -from moto.dynamodb.models.dynamo_type import serializer, deserializer from moto.dynamodb.models.table import ( Table, RestoredTable, @@ -787,18 +785,11 @@ class DynamoDBBackend(BaseBackend): # Just pass all tables to PartiQL source_data: Dict[str, str] = dict() for table in self.tables.values(): - source_data[table.name] = "\n".join( - [json.dumps(item.to_regular_json()) for item in table.all_items()] - ) + source_data[table.name] = [ # type: ignore + item.to_json()["Attributes"] for item in table.all_items() + ] - # Parameters are in DynamoDB JSON form ({"S": "value"}) - we only want the value itself - parameters = [deserializer.deserialize(param) for param in parameters] - - regular_json = partiql.query(statement, source_data, parameters) - return [ - {key: serializer.serialize(value) for key, value in item.items()} - for item in regular_json - ] + return partiql.query(statement, source_data, parameters) def execute_transaction( self, statements: List[Dict[str, Any]] diff --git a/setup.cfg b/setup.cfg index 6a79236dc..992845b0a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -52,7 +52,7 @@ all = openapi-spec-validator>=0.2.8 pyparsing>=3.0.7 jsondiff>=1.1.2 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 aws-xray-sdk!=0.96,>=0.93 setuptools multipart @@ -67,7 +67,7 @@ proxy = openapi-spec-validator>=0.2.8 pyparsing>=3.0.7 jsondiff>=1.1.2 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 aws-xray-sdk!=0.96,>=0.93 setuptools multipart @@ -82,7 +82,7 @@ server = openapi-spec-validator>=0.2.8 pyparsing>=3.0.7 jsondiff>=1.1.2 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 aws-xray-sdk!=0.96,>=0.93 setuptools flask!=2.2.0,!=2.2.1 @@ -116,7 +116,7 @@ cloudformation = openapi-spec-validator>=0.2.8 pyparsing>=3.0.7 jsondiff>=1.1.2 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 aws-xray-sdk!=0.96,>=0.93 setuptools cloudfront = @@ -139,10 +139,10 @@ dms = ds = sshpubkeys>=3.1.0 dynamodb = docker>=3.0.0 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 dynamodbstreams = docker>=3.0.0 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 ebs = sshpubkeys>=3.1.0 ec2 = sshpubkeys>=3.1.0 ec2instanceconnect = @@ -205,15 +205,15 @@ resourcegroupstaggingapi = openapi-spec-validator>=0.2.8 pyparsing>=3.0.7 jsondiff>=1.1.2 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 route53 = route53resolver = sshpubkeys>=3.1.0 s3 = PyYAML>=5.1 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 s3crc32c = PyYAML>=5.1 - py-partiql-parser==0.3.8 + py-partiql-parser==0.4.0 crc32c s3control = sagemaker = diff --git a/tests/test_dynamodb/test_dynamodb_statements.py b/tests/test_dynamodb/test_dynamodb_statements.py index 952487321..549035eaa 100644 --- a/tests/test_dynamodb/test_dynamodb_statements.py +++ b/tests/test_dynamodb/test_dynamodb_statements.py @@ -11,6 +11,7 @@ item1 = { "pk": {"S": "msg1"}, "body": {"S": "some text"}, "nested_attrs": {"M": {"some": {"S": "key"}}}, + "price": {"N": "123.4"}, "list_attrs": {"L": [{"BOOL": True}, {"BOOL": False}]}, "bool_attr": {"BOOL": True}, } @@ -35,7 +36,7 @@ def test_execute_statement_select_star(table_name=None): @pytest.mark.aws_verified @dynamodb_aws_verified -def test_execute_statement_select_unique(table_name=None): +def test_execute_statement_select_attr(table_name=None): client = boto3.client("dynamodb", "us-east-1") create_items(table_name) items = client.execute_statement(Statement=f"select unique_key from {table_name}")[ @@ -45,6 +46,16 @@ def test_execute_statement_select_unique(table_name=None): assert {"unique_key": {"S": "key"}} in items +@pytest.mark.aws_verified +@dynamodb_aws_verified +def test_execute_statement_with_quoted_table(table_name=None): + client = boto3.client("dynamodb", "us-east-1") + create_items(table_name) + items = client.execute_statement(Statement=f'select * from "{table_name}"')["Items"] + assert item1 in items + assert item2 in items + + @pytest.mark.aws_verified @dynamodb_aws_verified def test_execute_statement_with_parameter(table_name=None):