Skip to main content

Self-optimizing Postgres proxy — automatic materialized views and indexes

Project description

Gold Lapel

Self-optimizing Postgres proxy — automatic materialized views and indexes. Zero code changes required.

Gold Lapel sits between your app and Postgres, watches query patterns, and automatically creates materialized views and indexes to make your database faster. Port 7932 (79 = atomic number for gold, 32 from Postgres).

Install

pip install goldlapel
# or
uv pip install goldlapel

Quick Start

import goldlapel

# Start the proxy — returns a connection string pointing at Gold Lapel
url = goldlapel.start("postgresql://user:pass@localhost:5432/mydb")

# Use the URL with any Postgres driver
import asyncpg
conn = await asyncpg.connect(url)

# Or psycopg2, SQLAlchemy, Django — anything that speaks Postgres

Gold Lapel is driver-agnostic. start() returns a connection string (postgresql://...@localhost:7932/...) that works with any Postgres driver or ORM.

Gold Lapel prints the proxy and dashboard URLs on startup. Access the dashboard programmatically:

goldlapel.dashboard_url()  # http://127.0.0.1:7933

API

goldlapel.start(upstream, config=None, port=None, extra_args=None)

Starts the Gold Lapel proxy and returns the proxy connection string.

  • upstream — your Postgres connection string (e.g. postgresql://user:pass@localhost:5432/mydb)
  • config — dict of configuration options (see Configuration)
  • port — proxy port (default: 7932)
  • extra_args — additional CLI flags passed to the binary (e.g. ["--threshold-impact", "5000"])

goldlapel.stop()

Stops the proxy. Also called automatically on process exit.

goldlapel.proxy_url()

Returns the current proxy URL, or None if not running.

goldlapel.dashboard_url()

Returns the dashboard URL (e.g. http://127.0.0.1:7933), or None if the proxy is not running or the dashboard is disabled.

goldlapel.config_keys()

Returns the set of all valid config key names.

goldlapel.GoldLapel(upstream, config=None, port=None, extra_args=None)

Class interface for managing multiple instances:

proxy = goldlapel.GoldLapel("postgresql://user:pass@localhost:5432/mydb", port=7932)
url = proxy.start()
# ...
proxy.stop()

Configuration

Pass a config dict as the second argument to start() to configure the proxy:

import goldlapel

url = goldlapel.start("postgresql://user:pass@localhost/mydb", {
    "mode": "butler",
    "pool_size": 50,
    "disable_matviews": True,
    "replica": ["postgresql://user:pass@replica1/mydb"],
})

Keys use snake_case and map directly to CLI flags (pool_size--pool-size). Boolean keys like disable_matviews are flags — True enables them, False (or omitting) leaves them off. List keys like replica accept arrays and produce repeated flags.

Unknown keys raise ValueError immediately. To see all valid keys:

import goldlapel
print(goldlapel.config_keys())

For the full configuration reference, see the main documentation.

You can also set environment variables (GOLDLAPEL_PORT, GOLDLAPEL_UPSTREAM, etc.) — the binary reads them automatically.

How It Works

This package bundles the Gold Lapel Rust binary for your platform. When you call start(), it:

  1. Locates the binary (bundled in package, on PATH, or via GOLDLAPEL_BINARY env var)
  2. Spawns it as a subprocess listening on localhost
  3. Waits for the port to be ready
  4. Returns a connection string pointing at the proxy
  5. Cleans up automatically on process exit

The binary does all the work — this wrapper just manages its lifecycle.

Links

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

goldlapel-0.1.0rc7-py3-none-win_amd64.whl (8.6 MB view details)

Uploaded Python 3Windows x86-64

goldlapel-0.1.0rc7-py3-none-musllinux_1_2_x86_64.whl (10.6 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

goldlapel-0.1.0rc7-py3-none-musllinux_1_2_aarch64.whl (10.0 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

goldlapel-0.1.0rc7-py3-none-manylinux_2_31_x86_64.whl (10.6 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ x86-64

goldlapel-0.1.0rc7-py3-none-manylinux_2_31_aarch64.whl (9.9 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ ARM64

goldlapel-0.1.0rc7-py3-none-macosx_11_0_arm64.whl (9.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc7-py3-none-macosx_10_13_x86_64.whl (9.9 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file goldlapel-0.1.0rc7-py3-none-win_amd64.whl.

File metadata

  • Download URL: goldlapel-0.1.0rc7-py3-none-win_amd64.whl
  • Upload date:
  • Size: 8.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 eeb2781b1d30db9d66bde2fdee512d8dddbf2b377853dbf1e601356fc9af60a9
MD5 de3a4370a92697cb051f89b65b3ef187
BLAKE2b-256 c6e29bcd9b29717a5c479b502e661f72d712a1148b3b9f71a15408de45d8fb6a

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 37af436db33f5882416a683e4a30cbc8601f4f21afc27231c7f47f2e66a9d7ca
MD5 66e2ef2abbd1e9fdfc831f68e26ee62c
BLAKE2b-256 950f297917af4c2e94194b624fe9c0ee7481b3fe33ef856cc148374abed5e94a

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1cf63ac25d9aaddb1569307fa757a005685cebb80a40fe35a134e8e0b6d62211
MD5 ba74e91d16b8398497ee3e7b800b796e
BLAKE2b-256 a4a810c2546c78b980fc8193347e3a1b6b203d7975e89bd16e9db3ca1a8fabf2

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 46726082ca0877205be18045e85d1c6d48e8beb5ea7bc95801c1a2bab90e8a4f
MD5 7854c9165c6bb7e3ecd8abc33aa46634
BLAKE2b-256 94f01e883ac2bdeed7b60c45ef58b8bb5b9f72efc83ddbe713a4c0690b05d607

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 69388d052ba79688fd416bb32ee5efcd92ca67d7db3a3b310b501bb431f7f18f
MD5 9542874360d2891ea0d27332e8e51ab8
BLAKE2b-256 c7f1cd53889ec52cc3c413c1a1c9e7915f19c7e9a6f2379d24b57958444f3dae

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bf26a20408f0599d07fe0bd18c94e1003e743f2d7975f3ff8e8f9cdf45d421e
MD5 82ceb5de849cf973c5f20994aad1ee61
BLAKE2b-256 d51fe09b5566b4b8abdb0cfd86483def39397befcb9877ed2135591b2a8bfb13

See more details on using hashes here.

File details

Details for the file goldlapel-0.1.0rc7-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc7-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 663fa9b981591d024d43da9e10b0c325f646e99d23acfb7c758910f8dbd1920a
MD5 30e86a957330e031ec3f07b4dc29a976
BLAKE2b-256 f437bdd5a9c6a66d7568174498ea881fc9d210ec21dc78ef51a50c82670b6520

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