title: Serializing SQLAlchemy with Marshmallow
body: <p>I'm following a tutorial and using the below code. I'm also using Postman to view the status of the server for <a href="http://localhost:5000/planets" rel="nofollow noreferrer">http://localhost:5000/planets</a> , but I'm getting <strong>500 INTERNAL SERVER ERROR,</strong> when I should see my JSON data of the planets I created.
  In the command line I also see: <strong>AttributeError: 'list' object has no attribute 'data'</strong> </p>
  
  <p>I feel it might have to do with the line that has: return jsonify(result.data) but I'm not sure.</p>
  
  <pre><code>from flask import Flask, jsonify, request
  from flask_sqlalchemy import SQLAlchemy
  from sqlalchemy import Column, Integer, String, Float
  import os
  from flask_marshmallow import Marshmallow
  from marshmallow import Schema
  
  app = Flask(__name__)
  
  basedir = os.path.abspath(os.path.dirname(__file__))
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///C:/Users/krist/Py3/flask2/planets.db'
  
  db = SQLAlchemy(app)
  ma = Marshmallow(app)
  
  @app.cli.command('db_create')
  def db_create():
      db.create_all()
      print("DB Created")
  
  @app.cli.command('db_seed')
  def deb_seed():
      mercury = Planet(planet_name='Mercury',
                       planet_type='Class D',
                       home_star='Sol',
                       mass=3.25e23,
                       radius=1516,
                       distance=35.98e6)
  
      venus = Planet(planet_name='Venus',
                       planet_type='Class K',
                       home_star='Sol',
                       mass=8.95e24,
                       radius=3516,
                       distance=67.98e6)
  
      earth = Planet(planet_name='Earth',
                       planet_type='Class M',
                       home_star='Sol',
                       mass=5.97e24,
                       radius=3916,
                       distance=92.96e6)
  
      db.session.add(mercury)
      db.session.add(venus)
      db.session.add(earth)
  
      test_user = User(first_name='William',
                       last_name='Hershel',
                       email='test@test.com',
                       password='p@ssw0rd')
  
      db.session.add(test_user)
      db.session.commit()
      print("DB Seeded")
  
  @app.route('/planets', methods=['GET'])
  def planets():
      planets_list = Planet.query.all()
      result = planets_schema.dump(planets_list)
      return jsonify(result.data)
  
  
  class User(db.Model):
      __tablename__ = 'users'
      id = Column(Integer, primary_key=True)
      first_name = Column(String)
      last_name = Column(String)
      email = Column(String, unique=True)
      password = Column(String)
  
  class Planet(db.Model):
      __tablename__ = 'planets'
      planet_id = Column(Integer, primary_key=True)
      planet_name = Column(String)
      planet_type = Column(String)
      home_star = Column(String)
      mass = Column(Float)
      radius = Column(Float)
      distance = Column(Float)
  
  
  class UserSchema(ma.Schema):
      class Meta:
          fields = ('id', 'first_name', 'last_name', 'email', 'password')
  
  class PlanetSchema(ma.Schema):
      class Meta:
          fields = ('planet_id', 'planet_name', 'planet_type', 'home_star', 'mass', 'radius', 'distance')
  
  user_schema = UserSchema()
  users_schema = UserSchema(many=True)
  
  planet_schema = PlanetSchema()
  planets_schema = PlanetSchema(many=True)
  
  
  if __name__ == '__main__':
      app.run()
  </code></pre>