Exception using scan with undefined name
field
#44
Comments
Thanks for reporting! I gave it a quick go and wasn't able to reproduce the crash. The weird data format you're seeing returned makes me suspicious of the lower-level libraries. Could you give me the output of a |
I did some more investigating. I found a way to clearly reproduce the error on my side. Environment
(I used a clean virtual environment for testing) Steps to reproduceStep 1 run this script (name field declared) from flywheel import Model, Field, Engine
from flywheel.fields.types import StringType
import uuid
class Item(Model):
__metadata__ = {
'_name': 'test'
}
uuid = Field(data_type=StringType(), hash_key=True, nullable=False)
name = Field(data_type=StringType())
# setup
engine = Engine()
engine.connect_to_region('eu-west-1')
engine.register(Item)
engine.create_schema()
# create an item
unique_id = str(uuid.uuid1())
i = Item()
i.uuid = unique_id
i.name = 'a name'
engine.save(i) Step 2 run following script (no name field declared) from flywheel import Model, Field, Engine
from flywheel.fields.types import StringType
import uuid
class Item(Model):
__metadata__ = {
'_name': 'test'
}
uuid = Field(data_type=StringType(), hash_key=True, nullable=False)
# setup
engine = Engine()
engine.connect_to_region('eu-west-1')
engine.register(Item)
# scan
engine.scan(Item).all() # crash happens here (same trace as in the original post) Hope you can reproduce it this time. |
Got a related question or even the answer why this issue exists. I looked a bit at your unit tests. In "Extra string fields are stored as json strings" – what is reason behind this design decision? Doesn't it exactly break with my example above? Storing some fields first without transforming it to json and later try reading it as an overflow field that expects the stored value to valid json? |
I mention this a bit in #31, but basically it was just a horrible decision that should never have been made. I've even removed it in the 0.5 branch that I've been sitting on for more than a year. I wanted to get some more features into it before releasing it (like migrating to the newer dynamo query API), but I sadly don't have much time to work on flywheel anymore. Since you're hitting this now and I've seen a couple other people be bit by it, I'm going to try to find a couple hours this week to tidy up what I have on 0.5 and release it. I'm sorry you had to waste time on this and hopefully we'll bury it soon. |
Thanks for clarifying it. Looking forward to 0.5 |
0.5.0 is out! |
Do you have an Amazon Wishlist or favorite charity? Sincerely, On Mon, Aug 22, 2016 at 10:31 PM, Steven Arcangeli <notifications@github.com
|
Glad to hear that it's been useful for you! Patches and bug reports are always welcome. If you'd like to donate, I'd highly recommend Give Directly. They've been my favorite charity for a couple years now. |
There seems to be a bug where flywheel is trying to decode any string value for not defined
name
fields.Conditions seem to be:
name
field present in dynamodb table while no corresponding field defined in model__metadata__
and_name
scan
and notget
(did not checkquery
yet)Sample Code
Stack Trace
edit: I noticed something more. Actually running the script above works fine. But when you have a closer look at the content of the table / raw data returned by
dynamo3
for thescan
you will notice the additional"
:{'name': '"a name"', 'uuid': '5ebc745a-4def-11e6-864d-20c9d07f4883'}
Manually removing them (e.g.
{'name': 'a name', 'uuid': '6b87e066-4def-11e6-a7b2-20c9d07f4883'}
) will trigger the exception/bug described above. I didn't dig deeper why and where these"
get inserted. But there is definitely a problem relying on them when the data in the table also gets touched by other software.The text was updated successfully, but these errors were encountered: