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.0rc6-py3-none-win_amd64.whl (8.2 MB view details)

Uploaded Python 3Windows x86-64

goldlapel-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl (10.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

goldlapel-0.1.0rc6-py3-none-musllinux_1_2_aarch64.whl (9.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

goldlapel-0.1.0rc6-py3-none-manylinux_2_31_x86_64.whl (10.1 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ x86-64

goldlapel-0.1.0rc6-py3-none-manylinux_2_31_aarch64.whl (9.4 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ ARM64

goldlapel-0.1.0rc6-py3-none-macosx_11_0_arm64.whl (9.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc6-py3-none-macosx_10_13_x86_64.whl (9.5 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: goldlapel-0.1.0rc6-py3-none-win_amd64.whl
  • Upload date:
  • Size: 8.2 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.0rc6-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 dff90171b4b8bfbcbe84d71933ef52b2be5657b9390b283dc0eb270f3bb716fc
MD5 efddf03b437fd2aa84e06e913abcc095
BLAKE2b-256 7e18710e93b08b05c95719273a2ffc0e03fde95f16f86bd67ef056a8cdff64c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 00aa4485740898bf01420ed9fccd4133795ed0e2d344b3975892d696c5359258
MD5 bbf44cbf826f4f324ff599b96363a139
BLAKE2b-256 56f2e98eef955ad8ba1e42e5698dd2f929d766957a7a26a47231f2fe3f9529eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 bef6ab36726d8f77ec1e5687f3a9e9560afb6a0c705291fc89303ec2190a5465
MD5 733a12a0bd097205f52582ebb44615ef
BLAKE2b-256 ae8219d7737d25f56c4ef4f980c06cdd1447a168997b7175ce443fb6acb90687

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 611a6aab81f5e14de617900113e1cfa1c294fccb6988f591a9990e94b075b454
MD5 14c32af4c8dfceb6692a9960967edca8
BLAKE2b-256 d02079b50063e474ad9c85473580f6764a3c19965b3bc91de681106f30c6e125

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 eaa8ff7dfc3737a20f1a5986bf60f41fa18e48dfda1012ecf9e62414e946fd58
MD5 11eb9fa43cd68f61c06c98cff2e7267c
BLAKE2b-256 a745a087f73a9e5a59f6566042ae4b790e13ecc8c41e27b71e38a2ebda5f5e49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 66b3c22dcb633c96ef30a7955698a89d070ce42dfb83c0114555befa9ca42a44
MD5 a2de420c709aad6dc691603b97c62bc9
BLAKE2b-256 6fe88140a2e714545bc7e198e1083e262301d70f93d9b1b1fe014e2cc36908ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc6-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6ee175870c5058dcf2c7fc6d548fbdb6e873e60988f9ff1b73572f35a91493da
MD5 066b1346f8cfa6ce5e3f008a34ac2160
BLAKE2b-256 113319bad7d30fd97d5c37894e2379ecdcfb35c98ea34a3c1ff2cb6fd409f00a

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