标签:
#coding=utf-8 #!/usr/bin/env python from sqlalchemy import create_engine engine = create_engine(‘postgresql://ms:ms@localhost:5432/stockpy‘) from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() from sqlalchemy import Table,Column, String,Integer,Sequence class Test1(Base): __tablename__ = ‘test1‘ id = Column(Integer, Sequence(‘test1_id_seq‘), primary_key=True) name = Column(String(50)) ed_t1=Test1(name=‘fuck python‘) from sqlalchemy.orm import sessionmaker Session = sessionmaker(bind=engine) session = Session() session.add(ed_t1) session.commit()
【SQLAlchemy】PostgreSQL的自增长主键定义
标签:
原文地址:http://my.oschina.net/lbp0200/blog/499210