Skip to content

Using attr_name causes the field to be None #4

@ronlut

Description

@ronlut

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions