Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy import Column, Integer, Enum
- from sqlalchemy import create_engine
- from sqlalchemy.orm import sessionmaker
- Base = declarative_base()
- class Foo(Base):
- __tablename__ = 'foo'
- id = Column(Integer, primary_key=True)
- foo = Column(Enum("President", "Men's Captain", name="committee_position"))
- if __name__ == '__main__':
- engine = create_engine('postgresql://test@localhost/test')
- Base.metadata.create_all(engine)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement