针头的主要世代
sqlalchemy-hilo的Python项目详细描述
hilo生成器有两种类型,HiLoGenerator和 RowPerTableHiLoGenerator。HiLoGenerator将创建一个 跟踪hi值的列表:
CREATETABLEsingle_hilo(next_hiBIGINTNOTNULL)
RowPerTableHiLoGenerator将创建要保留的两列表 每行每个表的hi值的跟踪:
CREATETABLErow_per_table_hilo(table_nameVARCHAR(255)NOTNULL,next_hiBIGINTNOTNULL,PRIMARYKEY(table_name))
您可以像在任何其他模型中一样在模型中使用它们Sequence:
classEntity(Base):id=Column(BigInteger(),HiLoGenerator(),primary_key=True)...
或
classEntity(Base):id=Column(BigInteger(),RowPerTableHiLoGenerator(),primary_key=True)...