Skip to main content

Generate sales data for PostgreSQL

Project description

PostgreSQL Sales Generator

License Python

PostgreSQL Sales Generator

Table of Contents

Prerequisites

  • Python 3.14 and above
  • This module runs on psycopg

Install

  • with brew
brew tap rioriost/pg-salesgen
brew install pg-salesgen

Usage

[pg-salesgen --help](usage: pg-salesgen [--help] [--dsn DSN] [-h HOST] [-p PORT] [-U USER]
                   [-d DBNAME] [--password PASSWORD] [--sslmode SSLMODE]
                   [--options OPTIONS] [--print-psql] [--logged] [--with-fk]
                   [--create-indexes] [--customers CUSTOMERS]
                   [--products PRODUCTS] [--target-gb TARGET_GB]
                   [--workers WORKERS] [--batch-orders BATCH_ORDERS]
                   [--avg-items AVG_ITEMS] [--max-items MAX_ITEMS]
                   [--order-note-len ORDER_NOTE_LEN]
                   [--item-note-len ITEM_NOTE_LEN] [--start-date START_DATE]
                   [--end-date END_DATE] [--unit-price-min UNIT_PRICE_MIN]
                   [--unit-price-max UNIT_PRICE_MAX] [--tax-rate TAX_RATE]
                   [--shipping-threshold SHIPPING_THRESHOLD]
                   [--shipping-fee SHIPPING_FEE]
                   [--progress-interval PROGRESS_INTERVAL] [--seed SEED]
                   [--order-id-stride ORDER_ID_STRIDE]
                   [--copy-orders-buf-mb COPY_ORDERS_BUF_MB]
                   [--copy-items-buf-mb COPY_ITEMS_BUF_MB]
                   [--join-timeout-sec JOIN_TIMEOUT_SEC]

Empty DB -> create schema/tables -> fill masters -> generate sales-like data FAST.

options:
  --help, -?            show this help message and exit
  --dsn DSN             libpq DSN. Overrides -h/-p/-U/-d.
  -h, --host HOST       database server host or socket directory (psql
                        compatible).
  -p, --port PORT       database server port (psql compatible).
  -U, --user USER       database user name (psql compatible).
  -d, --dbname DBNAME   database name (psql compatible).
  --password PASSWORD   database password (or use PGPASSWORD env / .pgpass).
  --sslmode SSLMODE     sslmode (require, verify-full, etc.).
  --options OPTIONS     libpq options string (e.g., "-c statement_timeout=0").
  --print-psql          Print equivalent psql command and exit.
  --logged              Create LOGGED tables (default UNLOGGED for speed).
  --with-fk             Create foreign keys (slower).
  --create-indexes      Create typical indexes + ANALYZE after load.
  --customers CUSTOMERS
                        Number of customers to generate.
  --products PRODUCTS   Number of products to generate.
  --target-gb TARGET_GB
                        Target size (orders+items) in GB.
  --workers WORKERS     Number of worker processes.
  --batch-orders BATCH_ORDERS
                        Orders per batch per worker.
  --avg-items AVG_ITEMS
                        Average number of items per order.
  --max-items MAX_ITEMS
                        Max items per order.
  --order-note-len ORDER_NOTE_LEN
                        Order note length.
  --item-note-len ITEM_NOTE_LEN
                        Item note length.
  --start-date START_DATE
                        Start date YYYY-MM-DD (UTC).
  --end-date END_DATE   End date YYYY-MM-DD (UTC).
  --unit-price-min UNIT_PRICE_MIN
                        Min unit price (cents).
  --unit-price-max UNIT_PRICE_MAX
                        Max unit price (cents).
  --tax-rate TAX_RATE   Tax rate (e.g., 0.10).
  --shipping-threshold SHIPPING_THRESHOLD
                        Free shipping threshold (cents).
  --shipping-fee SHIPPING_FEE
                        Shipping fee under threshold (cents).
  --progress-interval PROGRESS_INTERVAL
                        Seconds between progress prints.
  --seed SEED           Base RNG seed.
  --order-id-stride ORDER_ID_STRIDE
                        Per-worker order_id stride (must exceed total orders
                        per worker).
  --copy-orders-buf-mb COPY_ORDERS_BUF_MB
                        COPY buffer for orders (MB).
  --copy-items-buf-mb COPY_ITEMS_BUF_MB
                        COPY buffer for items (MB).
  --join-timeout-sec JOIN_TIMEOUT_SEC
                        If >0, timeout seconds for joining each worker. 0
                        means wait indefinitely.
)

Release Notes

0.1.0 Release

  • Initial release

License

MIT License

Project details


Download files

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

Source Distribution

pgsalesgen-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgsalesgen-0.1.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file pgsalesgen-0.1.1.tar.gz.

File metadata

  • Download URL: pgsalesgen-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgsalesgen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c70f2460fcc36587e951f7ee4b38170018827b1482f7e39ad2c88ab5d42f9abe
MD5 49b34d91b51cd8b66889780f3235313d
BLAKE2b-256 e2a3a9d4fc196aa69402fba9134f90ac0a245eb447bbce1d5ee560829e3ddc9c

See more details on using hashes here.

File details

Details for the file pgsalesgen-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pgsalesgen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgsalesgen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d45048a184e4fcf11773788ac9060b2f9c80a360e2b68e6c5ab737bd40222553
MD5 da8eb85022f87e2454255de41b277b39
BLAKE2b-256 540c857db37ca14e148981ec69404242207c179a66be07d48daf72b41f8138d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page