HiLo primary key generators for sqlalchemy
Project description
There are two flavors of the HiLo generator, HiLoGenerator and RowPerTableHiLoGenerator. HiLoGenerator will create a single column table to keep track of the hi value:
CREATE TABLE single_hilo (
next_hi BIGINT NOT NULL
)
RowPerTableHiLoGenerator will create a two column table to keep track of the hi value per table per row:
CREATE TABLE row_per_table_hilo (
table_name VARCHAR(255) NOT NULL,
next_hi BIGINT NOT NULL,
PRIMARY KEY (table_name)
)
You can use them in your models like any other Sequence:
class Entity(Base):
id = Column(BigInteger(), HiLoGenerator(), primary_key=True)
...
or
class Entity(Base):
id = Column(BigInteger(), RowPerTableHiLoGenerator(), primary_key=True)
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqlalchemy-hilo-0.1.1.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for sqlalchemy_hilo-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc19ebb0b9c9868dbd23854ef58929a852e2566935349244a57c1b2dc923e4b9 |
|
MD5 | fd43a0a6606233678da4ad69a6fa1b73 |
|
BLAKE2b-256 | eef509efbe48dcab8d7ee857dfef13db1a8251c8d0139277499a9f2dde9cac61 |