{"action":"created","issue":{"url":"https://api.github.com/repos/spulec/moto/issues/1743","repository_url":"https://api.github.com/repos/spulec/moto","labels_url":"https://api.github.com/repos/spulec/moto/issues/1743/labels{/name}","comments_url":"https://api.github.com/repos/spulec/moto/issues/1743/comments","events_url":"https://api.github.com/repos/spulec/moto/issues/1743/events","html_url":"https://github.com/spulec/moto/issues/1743","id":346354235,"node_id":"MDU6SXNzdWUzNDYzNTQyMzU=","number":1743,"title":"moto.mock_dynamodb2 treats not equals as equals in filter expressions","user":{"login":"drewpearce","id":5270213,"node_id":"MDQ6VXNlcjUyNzAyMTM=","avatar_url":"https://avatars1.githubusercontent.com/u/5270213?v=4","gravatar_id":"","url":"https://api.github.com/users/drewpearce","html_url":"https://github.com/drewpearce","followers_url":"https://api.github.com/users/drewpearce/followers","following_url":"https://api.github.com/users/drewpearce/following{/other_user}","gists_url":"https://api.github.com/users/drewpearce/gists{/gist_id}","starred_url":"https://api.github.com/users/drewpearce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewpearce/subscriptions","organizations_url":"https://api.github.com/users/drewpearce/orgs","repos_url":"https://api.github.com/users/drewpearce/repos","events_url":"https://api.github.com/users/drewpearce/events{/privacy}","received_events_url":"https://api.github.com/users/drewpearce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-31T20:54:14Z","updated_at":"2018-09-22T21:07:10Z","closed_at":null,"author_association":"NONE","body":"when constructing a not equals filter expression like this:\r\n```python\r\nAttr('fieldname').ne('some value')\r\n```\r\nmoto appears to be treating as `eq` (equals)\r\n\r\n\r\n- How to duplicate\r\n  - See test script below\r\n- What you expect to happen\r\n  - The script should print out 3 scans of the table with sample data.\r\n    - Non filtered scan -- all 3 records\r\n    - filter with providerName eq aws -- 1 record, where providerName eq aws\r\n    - filter with providerName ne aws -- 2 records, where providerName ne aws\r\n- What actually happens\r\n  - Script prints out 3 scans of the table with sample data\r\n    - Non filtered scan -- all 3 records\r\n    - filter with providerName eq aws -- 1 record, where providerName eq aws\r\n    - filter with providerName ne aws -- 1 record, where providerName eq aws\r\n      - This demonstrates the reported bug\r\n- Version Info. I've tested on the following\r\n  - python 2.7.15 with moto 1.1.25 and boto3 1.7.40 installed via pip\r\n  - python 2.7.15 with moto 1.3.3 and boto3 1.7.66 installed via pip\r\n  - python 3.6.5 with moto 1.3.3 and boto3 1.7.66 installed via pip\r\n\r\n\r\ntest script\r\n```python\r\nimport boto3\r\nfrom boto3.dynamodb.conditions import Attr\r\nfrom moto import mock_dynamodb2\r\nimport os\r\nfrom pprint import pprint\r\n\r\n# set aws env vars\r\nos.environ['AWS_DEFAULT_REGION'] = 'us-east-1'\r\n\r\n# start mock\r\nmock = mock_dynamodb2()\r\nmock.start()\r\n\r\n# vars and objects\r\ntable_object = boto3.resource('dynamodb')\r\ntable_name = 'test_table'\r\ndata = [\r\n    {\r\n        'id': 1,\r\n        'providerName': 'aws'\r\n    }, {\r\n        'id': 2,\r\n        'providerName': 'azure'\r\n    }, {\r\n        'id': 3,\r\n        'providerName': 'google'\r\n    }\r\n]\r\n\r\n# create table\r\ncreate_table = table_object.create_table(\r\n    TableName=table_name,\r\n    KeySchema=[\r\n        {\r\n            'AttributeName': 'id',\r\n            'KeyType': 'HASH'\r\n        }\r\n    ],\r\n    AttributeDefinitions=[\r\n        {\r\n            'AttributeName': 'id',\r\n            'AttributeType': 'N'\r\n        }\r\n    ],\r\n    ProvisionedThroughput={\r\n        'ReadCapacityUnits': 1,\r\n        'WriteCapacityUnits': 5\r\n    }\r\n)\r\n\r\n# instantiate boto/moto table object\r\ntable = table_object.Table(table_name)\r\n\r\n# batch write data to table\r\nwith table.batch_writer() as batch:\r\n    for item in data:\r\n        batch.put_item(Item=item)\r\n\r\n# print all data\r\nprint('\\n\\n\\nALL ITEMS')\r\npprint(table.scan())\r\n\r\n# filter providerName eq aws\r\nfilter = Attr('providerName').eq('aws')\r\nprint('\\n\\n\\nPROVIDER NAME EQ aws')\r\npprint(table.scan(FilterExpression=filter))\r\n\r\n# filter providerName ne aws\r\nfilter = Attr('providerName').ne('aws')\r\nprint('\\n\\n\\nPROVIDER NAME NE aws')\r\npprint(table.scan(FilterExpression=filter))\r\n```"},"comment":{"url":"https://api.github.com/repos/spulec/moto/issues/comments/423773510","html_url":"https://github.com/spulec/moto/issues/1743#issuecomment-423773510","issue_url":"https://api.github.com/repos/spulec/moto/issues/1743","id":423773510,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzc3MzUxMA==","user":{"login":"spulec","id":292606,"node_id":"MDQ6VXNlcjI5MjYwNg==","avatar_url":"https://avatars2.githubusercontent.com/u/292606?v=4","gravatar_id":"","url":"https://api.github.com/users/spulec","html_url":"https://github.com/spulec","followers_url":"https://api.github.com/users/spulec/followers","following_url":"https://api.github.com/users/spulec/following{/other_user}","gists_url":"https://api.github.com/users/spulec/gists{/gist_id}","starred_url":"https://api.github.com/users/spulec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spulec/subscriptions","organizations_url":"https://api.github.com/users/spulec/orgs","repos_url":"https://api.github.com/users/spulec/repos","events_url":"https://api.github.com/users/spulec/events{/privacy}","received_events_url":"https://api.github.com/users/spulec/received_events","type":"User","site_admin":false},"created_at":"2018-09-22T21:07:10Z","updated_at":"2018-09-22T21:07:10Z","author_association":"OWNER","body":"I don't think we've implemented this yet. Setting as a feature request. Thanks!"}}
{"actor":{"display_login":"spulec"}}