title: How to create a single table using SqlAlchemy declarative_base
body: <p>To create the <code>User</code> table I have to use <code>drop_all</code> and then <code>create_all</code> methods. But these two functions re-initiate an entire database. I wonder if there is a way to create the <code>User</code> table without erasing (or dropping) any existing tables in a database?</p>
  
  <pre><code>import sqlalchemy
  from sqlalchemy.ext.declarative import declarative_base
  Base = declarative_base()
  
  
  class User(Base):
      __tablename__ = 'users'
      id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
      name = sqlalchemy.Column(sqlalchemy.String)
  
      def __init__(self, code=None, *args, **kwargs):
          self.name = name
  
  
  url = 'postgresql+psycopg2://user:pass@01.02.03.04/my_db'
  engine = sqlalchemy.create_engine(url)
  session = sqlalchemy.orm.scoped_session(sqlalchemy.orm.sessionmaker())
  session.configure(bind=engine, autoflush=False, expire_on_commit=False)
  
  Base.metadata.drop_all(engine)
  Base.metadata.create_all(engine)
  </code></pre>