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.2.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file sqlalchemy-hilo-0.1.2.tar.gz
.
File metadata
- Download URL: sqlalchemy-hilo-0.1.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d37ec6e5d87da8690da4692f062c0d76bdb1dd615dc12af2d04c2778b69f05d |
|
MD5 | 7f557501079ca8222a2c7fb02a2a33c8 |
|
BLAKE2b-256 | 8efd36e8ae56a4793bf71bc9b544ba283e1693b6b2588c98c6e590ff4aaff4ed |
File details
Details for the file sqlalchemy_hilo-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: sqlalchemy_hilo-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ef7a31cf69e4760346bf4948691a2a6254334568ac1c2bcc8988c05b878f721 |
|
MD5 | 6cae27436aa39cdea72ad1ed49799fe3 |
|
BLAKE2b-256 | 745825b643b32b43675322850d2939ddf14ab7484fe7d32050c2de1228f22c4b |