19

I'm developing a web application based on MySQL DBMS I followed the tutorial in that answer in which it creates all the tables related to every model calling the create_all().

The only one thing I don't understand is how to create only one table and not all of them. I searched through google but can't find an answer.

Community
  • 1
  • 1
rh0x
  • 1,066
  • 1
  • 13
  • 33

1 Answers1

26

you can use create method

Model.__table__.create(session.bind)
r-m-n
  • 14,192
  • 4
  • 69
  • 68
  • 9
    Thank you! It works! I only want to notice one thing for coherence with the example I linked: the correct way to do this is **Model.__table__.create(db.session.bind, checkfirst=True)** – rh0x Dec 13 '15 at 16:45
  • 1
    This also works with drop: Model.__table__.drop(db.session.bind) – ZaxR Oct 20 '17 at 20:37