Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using attr_name causes the field to be None #4

Open
ronlut opened this issue Jan 27, 2019 · 0 comments
Open

Using attr_name causes the field to be None #4

ronlut opened this issue Jan 27, 2019 · 0 comments

Comments

@ronlut
Copy link

ronlut commented Jan 27, 2019

Hi.
I'm trying to use the package but I have a lot of fields in python mapped to fields named differently in Dynamo (using the attr_name).
Each of those fields results in a None value when serializing it, and in addition it uses the attr_name instead of the field name.
Example:

class Result(Model):
    app_id = NumberAttribute(attr_name="appId")
    domain = UnicodeAttribute()

class ResultSchema(ModelSchema):
    class Meta:
        model = Result

result = Result(app_id=5, domain='a.com')
ResultSchema().dump(result).data
>>> {'domain': 'a.com', 'appId': None}

Expected:
{'domain': 'a.com', 'app_id': 5}

Changing the model's attributes to the original attribute names is not an option as part of them have symbols that are not supported by python as valid names (appId#version for example)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants