Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SQLAlchemy CREATE and DROP

  • metadata.create_all(engine, checkfirst=True|False) emits CREATE statement for all tables.
  • table.create(engine, checkfirst=False|True) emits CREATE statement for a single table.
  • metadata.drop_all(engine, checkfirst=True|False) emits DROPT statement for all the tables.
  • table.drop(engine, checkfirst=False|True) emits DROPT statement for a single table.

metada can create (or drop) the tables in the correct order to maintain the dependencies.