Commit Graph

217 Commits

Author SHA1 Message Date
Steve Pulec
1f2e6b8925
Merge pull request #3071 from bblommers/dynamodb_gsi_add_throughput
DynamoDB - Add default GSI throughput
2020-06-13 18:59:33 -05:00
Bert Blommers
bbe1320e7c DynamoDB - Add default GSI throughput 2020-06-13 20:27:05 +01:00
Bert Blommers
d21088699e Linting 2020-06-03 17:14:48 +01:00
Bert Blommers
b0da78c29d
Update test_dynamodb.py 2020-06-03 16:15:46 +01:00
Bert Blommers
9ca10e3630 #3046 - DynamoDB - Add Key-size Validation for BatchGetItem 2020-06-03 15:36:32 +01:00
Bert Blommers
48aa8ec3f9 #2985 - DynamoDB - TransactWriteItems - Fix error-type returned 2020-05-11 15:33:24 +01:00
Anton Grübel
65e790c4eb
Add dynamodb continuous backups (#2976)
* remove print statement

* Add dynamodb.describe_continuous_backups

* Add dynamodb.update_continuous_backups

* Fix Python 2 timestamp error
2020-05-08 15:57:48 +01:00
pvbouwel
9e7803dc36
[Bugfix] UpdateExpression using ADD from zero (#2975)
When using the ADD syntax to sum up different components
the path that is provided is allowed to be non-existent.
In such a case DynamoDB will initialize it depending on
the type of the value.
If it is a number it will be initialized with 0.
If it is a set it will be initialized with an empty set.
2020-05-07 21:29:20 +01:00
Bert Blommers
2e737a6102 DynamoDB - Add tests to verify Atomic Counter functionality 2020-05-01 14:19:20 +01:00
Steve Pulec
30a98de687
Merge pull request #2924 from pvbouwel/ddb_full_parsing_executor
Improve DDB expressions support4: Execution using AST
2020-04-26 15:53:25 -05:00
pvbouwel
ec731ac901 Improve DDB expressions support4: Execution using AST
Part of structured approach for UpdateExpressions:
 1) Expression gets parsed into a tokenlist (tokenized)
 2) Tokenlist get transformed to expression tree (AST)
 3) The AST gets validated (full semantic correctness)
 4) AST gets processed to perform the update -> this commit

This commit uses the AST to execute the UpdateExpression.
All the existing tests pass. The only tests that have been
updated are in test_dynamodb_table_with_range_key.py because
they wrongly allow adding a set to a path that doesn't exist.
This has been alligend to correspond to the behavior of AWS
DynamoDB.

This commit will resolve https://github.com/spulec/moto/issues/2806
Multiple tests have been implemented that verify this.
2020-04-26 15:59:12 +01:00
Bert Blommers
56aa454397 Merge branch 'master' into feature/dynamodb_transact_write_items 2020-04-26 10:24:27 +01:00
Steve Pulec
8595493aee
Merge branch 'master' into feature/dynamodb_item_limit 2020-04-25 18:38:08 -05:00
Steve Pulec
dbeb16d9b9
Merge pull request #2823 from bblommers/bug/2797
DynamoDB - Allow case insensitive AND in KeyConditionExpression
2020-04-25 18:35:51 -05:00
Dmitry Ryzhikov
e866df9b9d Merge branch 'master' into fix/table-filter-value-error 2020-04-22 20:08:05 +03:00
Dmitry Ryzhikov
1a3a7d6a92 Add test for missing table name 2020-04-20 20:23:37 +03:00
pvbouwel
e6b51a28ee Enable AST Validation
This commit puts AST validation on the execution path. This means updates get
validated prior to being executed. There were quite a few tests that were not
working against Amazon DDB. These tests I considered broken and as such this
commit adapts them such that they pass against Amazon DDB.

test_update_item_on_map()
=> One of the SET actions would try to set a nested element by specifying the nesting on the path
   rather than by putting a map as a value for a non-existent key. This got changed.

test_item_size_is_under_400KB
=> Used the keyword "item" which DDB doesn't like. Change to cont in order to keep the same sizings.
=> Secondly the size error messages differs a bit depending whether it is part of the update or part
   of a put_item. For an update it should be:
   Item size to update has exceeded the maximum allowed size
   otherwise it is
   Item size has exceeded the maximum allowed size'

test_remove_top_level_attribute
=> Used a keyword item.  Use ExpressionAttributeNames

test_update_item_double_nested_remove
=> Used keywords name & first. Migrated to non-deprecated API and use ExpressionAttributeNames

test_update_item_set &
test_boto3_update_item_conditions_pass &
test_boto3_update_item_conditions_pass_because_expect_not_exists &
test_boto3_update_item_conditions_pass_because_expect_not_exists_by_compare_to_null &
test_boto3_update_item_conditions_pass_because_expect_exists_by_compare_to_not_null &
test_boto3_update_item_conditions_fail &
test_boto3_update_item_conditions_fail_because_expect_not_exists &
test_boto3_update_item_conditions_fail_because_expect_not_exists_by_compare_to_null
=> Were broken tests which had string literal instead of value placeholder
2020-04-19 16:58:46 +01:00
pvbouwel
fc4d88401d Improve DDB expressions support3: AST Validation
Part of structured approach for UpdateExpressions:
 1) Expression gets parsed into a tokenlist (tokenized)
 2) Tokenlist get transformed to expression tree (AST)
 3) The AST gets validated (full semantic correctness) -> this commit
 4) AST gets processed to perform the update

This commit uses the AST to perform validation.  Validation makes sure the
nodes encounterd have valid values and they will also resolve values for
references that refer to item state or values passed into the expression.
2020-04-19 16:58:07 +01:00
pvbouwel
9ed613e197 Better DDB expressions support2: ExpressionTree
Part of structured approach for UpdateExpressions:
 1) Expression gets parsed into a tokenlist (tokenized)
 2) Tokenlist get transformed to expression tree (AST) -> This commit
 3) The AST gets validated (full semantic correctness)
 4) AST gets processed to perform the update

This commit uses the tokenlist to build an expression tree. This tree is not
yet used. Still it allows to raise additional Validation Exceptions which
previously were missed silently therefore it allows tests to catch these type of
ValidationException. For that reason DDB UpdateExpressions will be parsed
already. It also makes sure we won't break existing tests.

One of the existing tests had to be changed in order to still pass:
 - test_dynamodb_table_with_range_key.test_update_item_with_expression

This test passed in a numeric literal which is not supported by DynamoDB
and with the current tokenization it would get the same error as in AWS
DynamoDB.
2020-04-18 09:19:03 +01:00
pvbouwel
7ea419dd54 Better DDB expressions support1: TokenizationDDB
Currently the mock for DynamoDB has adhoc code to implement
its updateExpression functionality.  This series will
transform the logic such that Update Expressions are processed
as follows:
 1) Expression gets parsed into a tokenlist (tokenized) -> This commit
 2) Tokenlist get transformed to expression tree (AST)
 3) The AST gets validated (full semantic correctness)
 4) AST gets processed to perform the update

This alows for a more realistic mocking. It will throw exceptions much
more aggressively avoiding situations where a test passes against the
mock but fails with an exception when running against AWS.

Introduction of step 3 also allows to have the update expression as an
atomic unit of work. So updates at the start of the expression cannot
be performed if there is an error further down the expression.

This specific commit will tokenize expressions but the tokenlist is not
yet used. It is purely to keep clear boundaries.  It does do a minor
refactoring of the exceptions to allow more re-use and to ease testing.

This series of changes is to aid providing a long-term solution for
https://github.com/spulec/moto/issues/2806.
2020-04-18 09:16:23 +01:00
Bert Blommers
870b34ba76 Spacing 2020-04-16 07:09:50 +01:00
Bert Blommers
47d80621f9 Merge branch 'master' into feature/dynamodb_item_limit 2020-04-16 07:07:59 +01:00
Bert Blommers
a6902e8713
Update tests/test_dynamodb2/test_dynamodb.py
Co-Authored-By: Guilherme Martins Crocetti <gmcrocetti@gmail.com>
2020-04-15 07:26:09 +01:00
Bert Blommers
c2b4c397f2 DDB test - Fix KeySchema, and set BillingMode for easier online testing 2020-04-14 07:53:15 +01:00
Bert Blommers
54f51fc7c1 DynamoDB - TransactWriteItems implementation 2020-04-08 10:49:58 +01:00
Andrea Amorosi
349b381390 Fixed dynamodb2 put_item ValidationException 2020-03-28 17:59:42 +00:00
Bert Blommers
e82e1e3f39 DynamoDB - Add 1MB item size check 2020-03-21 12:20:09 +00:00
Bert Blommers
b1da99aeda #2797 - DynamoDB - Allow case insensitive AND in KeyConditionExpression 2020-03-20 12:29:04 +00:00
Steve Pulec
14b2811157
Merge pull request #2819 from bblommers/dynamodb_global_index_ordering
Dynamodb - Global index ordering
2020-03-19 19:39:09 -05:00
Steve Pulec
78f5541953
Merge pull request #2817 from bblommers/dynamodb_add_index_status
DynamoDB - Add status to Global Indexes
2020-03-19 19:37:49 -05:00
Bert Blommers
71bf314a0f
Merge pull request #2799 from ImFlog/fix_dynamodb_updated_new
Fix UPDATED_NEW return values differences
2020-03-18 08:21:01 +00:00
Bert Blommers
aead80c392
Add missing region 2020-03-17 17:11:35 +00:00
Bert Blommers
67c7fce85e #2760 - DynamoDB - Ensure proper ordering for Numeric sort keys 2020-03-17 16:28:49 +00:00
Bert Blommers
b7da6b9481 #2813 - DynamoDB - Add Global Index Status 2020-03-17 15:41:50 +00:00
Steve Pulec
77b1cc2321
Merge pull request #2809 from bblommers/feature/dynamodb-transact-get-items
Feature - DynamoDB: transact_get_items
2020-03-15 16:45:03 -05:00
ImFlog
7f6c6660aa Add some new update_new tests 2020-03-13 09:37:50 +01:00
Bert Blommers
71d3941daf Linting 2020-03-12 14:26:23 +00:00
Bert Blommers
caebe222d7 DynamoDB - Transact_get_items - Remove error condition 2020-03-12 14:24:53 +00:00
Tomoya Iwata
b74625db0c add support for dynamodb transact_get_items 2020-03-12 14:15:13 +00:00
ImFlog
ba1bf09474 Fix UPDATED_NEW return values differences between moto and dynamoDB 2020-03-10 18:22:54 +01:00
Bert Blommers
315ac32f09
Add region to test case 2020-03-10 14:28:12 +00:00
Bert Blommers
6ba00d9ad1 #1054 - DynamoDB - Improve error handling for put_item without keys 2020-03-10 13:25:40 +00:00
heyder.dias
f5080e539d fix lint check 2020-03-05 18:39:20 -03:00
heyder.dias
fa7f83bc2f add test to nested if_not_exists and property already exists 2020-03-05 17:05:00 -03:00
Bert Blommers
2bd93a76fc Add region to DDB tests 2020-02-09 11:58:41 +00:00
Bert Blommers
936d686392 #2580 - DynamoDB update_item: Allow list_append and if_not_exists-functions in one expression 2020-02-09 11:47:02 +00:00
Nikita Antonenkov
d4caf14b61 Fixed UnboundLocalError in dynamodb2.query when no filters are passed 2020-02-07 23:39:31 +01:00
Steve Pulec
663d7c289b
Merge pull request #2675 from bblommers/bugfix/#2674
DynamoDB - ListAppend should also work when adding maps to a list
2020-01-22 20:01:53 -06:00
Bert Blommers
7ff7ee4e8e Test fix - Region must be specified 2020-01-22 11:42:06 +00:00
Bert Blommers
6f02782624 #2627 - Change comparison to differentiate between 0 and None 2020-01-22 11:30:17 +00:00