title: Flask - TypeError: __init__() missing 2 required positional arguments: 'name' and 'user_id'
body: <p>When I used Python to insert data, I had the following problem:</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/Documents/python/dbFlask/web/models.py", line 42, in &lt;module&gt;
      env = Env()
  TypeError: __init__() missing 2 required positional arguments: 'name' and 'user_id'
  </code></pre>
  
  <p>My <strong>init</strong>.py like this:</p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  app.config["SQLALCHEMY_DATABASE_URI"] = 
  "mysql+pymysql://root:123@127.0.0.1:3306/env"
  </code></pre>
  
  <p>The key code of my operateDB.py like this:</p>
  
  <pre><code>class Env(db.Model):
  
      def __init__(self, name, user_id):
          self.name = name
          self.user_id = user_id
  
  id = db.Column(db.Integer, primary_key=True)
  name = db.Column(db.String(255), unique=True)
  user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
  env = Env()
  env.name = 'test01'
  env.user_id = '1'
  db.session.add(env)
  db.session.commit()
  </code></pre>
  
  <p>The problem happened after I run the operateDB.py. I can't find the solution of the problem.</p>