Commit Graph

63 Commits

Author SHA1 Message Date
Bert Blommers
14a69c7524
Techdebt: Enable pylint rules (#4432) 2021-10-18 19:44:29 +00:00
Bert Blommers
7f912b7a5b
DynamoDB - Throw exception when updating key using SET operation (#4245) 2021-10-09 21:02:53 +00:00
Bert Blommers
9d1dd79813
Rewrite deprecated DynamoDB2 tests (#3904) 2021-09-22 18:13:28 +00:00
David Pedrosa
ba0f0bd513
Improve dynamodb query case sensitivity (#3799) (#3800)
* between clause is not case-sensitive anymore

* begins_with will raise an exception unless lower-case is used

Co-authored-by: David Pedrosa <d.pedrosa@indizen.com>
2021-03-25 20:22:36 +00:00
Matěj Cepl
ea489bce6c Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
Matěj Cepl
77dc60ea97 Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of
failures is left to the next commit.
2020-11-10 08:23:44 +01:00
Bert Blommers
bbe1320e7c DynamoDB - Add default GSI throughput 2020-06-13 20:27:05 +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
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
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
Bert Blommers
b7da6b9481 #2813 - DynamoDB - Add Global Index Status 2020-03-17 15:41:50 +00:00
Bert Blommers
e41bc9fc58 DynamoDB - DELETE item from nested sets 2019-11-28 13:22:20 +00:00
Bert Blommers
6d7ad717df DynamoDB - ADD item to nested sets 2019-11-27 12:36:42 +00:00
Asher Foa
96e5b1993d Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
Bert Blommers
c783b8721f #2445 - DynamoDB - Fix tests after adding AttributeDefinitions-validation 2019-10-03 11:57:14 +01:00
Ber Zoidberg
1088c421d2 #2212 add support for delete on update_with_attribute_updates (#2213)
* add support for delete on update_with_attribute_updates
2019-05-22 10:47:02 +01:00
cm-iwata
9bf8fd3417 fix #2011 (#2012)
add support for Scan method using LSI or GSI
2019-05-21 17:45:30 +01:00
Brian Rower
0097ab4c67 Improve code coverage 2017-09-12 23:41:12 -07:00
Brian Rower
6affc7a4ec Add basic support for the add operation in an update operation
Add basic delete functionality


Improve testing coverage and make behave more like actual dynamo on errors


Lint fix
2017-09-12 21:42:29 -07:00
Brian Rower
386ac94abe Allow doing an ADD update of a string set
Fix test
2017-09-11 12:07:34 -07:00
Steve Pulec
15b811901b Merge pull request #925 from JackDanger/idempotent-dynamodb2-deletes
Idempotent Dynamodb2 deletes
2017-05-10 22:07:12 -04:00
Steve Pulec
0adebeed24 Merge #913. 2017-05-10 21:58:42 -04:00
Jack Danger Canty
02edc6fa00 Idempotent Dynamodb2 deletes
Fixes #873
2017-05-01 12:31:31 -07:00
Ian Auld
cdc007fc63 Added test for query using an attribute that is not a range/hash key 2017-04-21 14:55:25 -07:00
Steve Pulec
f37bad0e00 Lints. 2017-02-23 21:37:43 -05:00
Steve Pulec
fde721bed7 Testing new version of decorator. 2017-02-15 22:35:45 -05:00
Nuno Santos
71c1fbadbe Add DynamoDB tests for update_item() with UpdateExpression, support spaces in the UpdateExpression. (#758)
Fixes #745.
2016-11-11 17:04:14 -05:00
Nuno Santos
bfc664cca8 Add additional put_item test with an attribute_exists condition. 2016-11-04 13:29:53 +01:00
Nuno Santos
74b56faafd Attempt to parse simple ConditionExpressions in DynamoDB put_item().
Internally these get converted into simpler Expected={} parameters, so
for now only `attribute_exists` and `attribute_not_exists` are supported;
OR is also not suported since `expected` does not support it.
2016-11-04 12:37:10 +01:00
Steve Pulec
196e5a7d8d Fix dynamodb2 comparisons. Closes #601. 2016-05-05 23:39:14 -04:00
Steve Pulec
6803444d61 Fix Dynamodb table key name. Closes #524. 2016-05-05 22:14:23 -04:00
Ian Auld
cc1dee03f5 Reorganized tests 2016-03-16 21:32:54 -07:00
Ian Auld
56425c9479 Added tests for index comparisons 2016-03-14 09:39:03 -07:00
Brian Cavagnolo
6bab725b36 add dynamodb pagination 2016-03-01 15:00:23 -08:00
Steve Pulec
9596772546 Merge pull request #510 from pcraciunoiu/feature/dynamodb-add-value
Add value and UPDATE fixes
2016-01-17 15:40:07 -05:00
Paul Craciunoiu
4e9f4bfbbf Fix for ReturnValues. 2016-01-15 11:53:45 -07:00
Paul Craciunoiu
bdd4ae824b Support ADD for numeric values 2016-01-15 11:53:43 -07:00
Paul Craciunoiu
88cd009c4d Return Item even when item is not found. 2016-01-14 16:20:33 -07:00
Ian Auld
06af5365ed Updated tests 2016-01-14 14:25:04 -08:00
Ian Auld
582db74dee Added test for creating a table with a local index. 2016-01-14 11:35:23 -08:00
Steve Pulec
96479bf1dc Merge pull request #505 from joshink/master
Reverse before limit
2016-01-10 00:31:13 -05:00
Joshua Inkenbrandt
72bda6d901 Don't do python 2 things in python 3 2016-01-09 18:29:21 -08:00
Joshua Inkenbrandt
33f31652ea Reverse before limit 2016-01-09 17:58:06 -08:00
Paul Craciunoiu
7a6e85517a Quick fix for test in python3.3 2016-01-08 17:46:55 -07:00
Paul Craciunoiu
f1099dd006 Support update_item with map and numeric types. 2016-01-08 17:33:14 -07:00
Paul Craciunoiu
fef748b1c1 Add test. 2016-01-08 17:28:06 -07:00
Steve Pulec
9b0bce93dc Merge pull request #499 from im-auld/partial-save-support-with-range-key
Partial save support with range key
2016-01-08 17:23:04 -05:00
Ian Auld
159e88db53 Added test for supporting partial_save 2015-12-31 10:17:08 -08:00
Paul Craciunoiu
2a367ca4bf Add boto3 GSI and query tests.
* Test query and condition ordering
* Test GSI create/update/delete
* Test throughput
2015-12-14 17:13:35 -07:00
Steve Pulec
e4408152d1 Add KeyConditionExpression to dynamo. 2015-08-01 19:32:33 -04:00