question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_load should remove type_field from data before shema load

See original GitHub issue

Leaving the type field in the data dictionary generates errors when calling shema.load.

errors={'_schema': ['Unknown field name type.']})

It could be pop instead of get, but this would modify the data, so we have to copy the dict before.

Possible implementation:

    def _load(self, data, partial=None):
        data_copy = dict(data)
        data_type = data_copy.pop(self.type_field)
        [...]
        return schema.load(data_copy, many=False, partial=partial)

What do you think?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
maximkulkincommented, Nov 4, 2016

@lafrech Ok, I got this. Thanks for reporting and helping with repro!

1reaction
maximkulkincommented, Oct 20, 2016

Although I prefer forgiving schemas (ones that ignore extra fields) I agree that it makes sense to remove added type attribute. I will look into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference — marshmallow 3.19.0 documentation
Deserialize a data structure to an object defined by this Schema's fields. loads (json_data, *[ ... Same as load() , except it takes...
Read more >
ruby on rails - How to use db:schema:load without erasing data
(2) Work around: Before doing a db:schema:load, get a db_dump of your database. If you check rake db:migrate:status at this time, ...
Read more >
Loading CSV data from Cloud Storage | BigQuery
When you load CSV files into BigQuery, note the following: CSV files do not support nested or repeated data. Remove byte order mark...
Read more >
Ecto.Schema — Ecto v3.9.4 - HexDocs
An Ecto schema maps external data into Elixir structs. ... metadata holding the status of the struct, for example, if it has been...
Read more >
DataFrameReader (Spark 3.1.3 JavaDoc) - Apache Spark
Loads input in as a DataFrame , for data sources that don't require a path ( ... If the option is set to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found