title: Marshmallow deserializing fails when structure is nested
body: <p>I am trying to deserialize a deep structure with marshmallow. For example:</p>
  
  <pre><code>hour = {
      'day': {
          'name': 'monday'
      }
  }
  loaded_hour, error = HoursSerializationSchema().load(hour) # this works
  
  new_practitioner_at_location = {
      'hours': [
          hour
      ]
  }
  loaded, error = PractitionerToServiceLocationSerializationSchema().load(new_practitioner_at_location) # this fails
  </code></pre>
  
  <p>When I try to deserialize the <code>new_practitioner_at_location</code> I get the following (occurs when the serializer is working on the 'day' key):</p>
  
  <p><code>AttributeError: 'dict' object has no attribute '_sa_instance_state'</code></p>
  
  <p>Note that the same schema works to deserialize the same data structure (hour) when that structure is not nested inside the <code>new_practitioner_at_location</code>.</p>
  
  <p>self-contained script showing the problem:</p>
  
  <pre><code>from sqlalchemy import Column, Integer, ForeignKey, String
  from sqlalchemy.orm import relationship, backref
  from sqlalchemy.ext.declarative import declarative_base
  import os
  from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from flask_marshmallow import Marshmallow
  from flask_migrate import Migrate
  
  base = declarative_base()
  
  
  class HoursDay(base):
      __tablename__ = 'HoursDay'
      uid = Column(Integer, primary_key=True)
  
      name = Column(String)
  
      hour_id = Column(Integer, ForeignKey('Hours.uid'))
      hour = relationship("Hours", back_populates="day")
  
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
  
  
  class Hours(base):
      __tablename__ = 'Hours'
      uid = Column(Integer, primary_key=True)
  
      practitioner_at_location_id = Column(Integer, ForeignKey('PractitionerToServiceLocation.uid'))
      practitioner_at_location = relationship('PractitionerToServiceLocation', back_populates="hours")
  
      day = relationship(HoursDay, uselist=False, back_populates="hour")
  
      def __repr__(self):
          return f'&lt;Hours {self.uid}&gt;'
  
  
  class PractitionerToServiceLocation(base):
      """
      A practitioner practices at a number of service locations.
      """
      __tablename__ = 'PractitionerToServiceLocation'
      uid = Column(Integer, primary_key=True)
  
      hours = relationship("Hours", back_populates="practitioner_at_location")
  
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
  
      def __repr__(self):
          return f'&lt;PractitionerToServiceLocation {self.uid}&gt;'
  
  
  app = Flask(__name__)
  app.config.from_object(os.environ['APP_SETTINGS'])
  db = SQLAlchemy(app, model_class=base)
  ma = Marshmallow(app)
  migrate = Migrate(app, db)
  
  from marshmallow import fields
  
  
  class HoursDaySerializationSchema(ma.ModelSchema):
      class Meta:
          model = HoursDay
  
  
  class HoursSerializationSchema(ma.ModelSchema):
      class Meta:
          model = Hours
  
      day = fields.Nested(HoursDaySerializationSchema)
  
  
  class PractitionerToServiceLocationSerializationSchema(ma.ModelSchema):
      class Meta:
          model = PractitionerToServiceLocation
  
          hours = fields.Nested('HoursSerializationSchema', many=True)
  
  
  if __name__ == "__main__":
      hour = {
          'day': {
              'name': 'monday'
          }
      }
      loaded_hour, error = HoursSerializationSchema().load(hour) # this works
  
      new_practitioner_at_location = {
          'hours': [
              hour
          ]
      }
      loaded, error = PractitionerToServiceLocationSerializationSchema().load(new_practitioner_at_location) # this fails
      print('hi')
  </code></pre>
  
  <p>Update:</p>
  
  <p>I think that what is happening is that marshmallow is not attempting to deserialize the <code>HoursDay</code> object when trying to deserialize the <code>new_practitioner_at_location</code> dict. If I remove the <code>backpopulates</code> behavior from the <code>HoursDay.hour</code> field then you can see it just assign the unserialized data struct to the field. This makes no sense at all to me, especially since it works when you just deserialize the <code>hour</code> dict directly instead of embedding it inside <code>new_practitioner_at_location</code>.
  Any help would be appreciated.  </p>