Skip to main content

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)


class Entity(Base):

    id = Column(BigInteger(), RowPerTableHiLoGenerator(), primary_key=True)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlalchemy-hilo, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size sqlalchemy_hilo-0.1.2-py3-none-any.whl (4.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sqlalchemy-hilo-0.1.2.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page