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, with an L1 native cache that serves repeated reads in microseconds. 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 database connection with L1 cache built in
conn = goldlapel.start("postgresql://user:pass@localhost:5432/mydb")

# Use the connection directly — no driver setup needed
result = conn.execute("SELECT * FROM users WHERE id = $1", [42])

For async applications:

import goldlapel

conn = await goldlapel.start_async("postgresql://user:pass@localhost:5432/mydb")

result = await conn.fetch("SELECT * FROM users WHERE id = $1", 42)

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 a database connection with L1 cache.

  • 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.start_async(upstream, config=None, port=None, extra_args=None)

Async version of start(). Returns an async database connection with L1 cache.

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)
conn = proxy.start()
# ...
proxy.stop()

Configuration

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

import goldlapel

conn = 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 database connection with L1 native cache built in
  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.0rc9-py3-none-win_amd64.whl (8.7 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

goldlapel-0.1.0rc9-py3-none-musllinux_1_2_aarch64.whl (10.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.31+ x86-64

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

Uploaded Python 3manylinux: glibc 2.31+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc9-py3-none-macosx_10_13_x86_64.whl (10.0 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: goldlapel-0.1.0rc9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 8.7 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.0rc9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f3c87961b73e5c5496539891fd3134cf07ca03e032ac34fbb1d0bd13850eaf63
MD5 8464d0b5d61950e93731061e44c9c856
BLAKE2b-256 3bd34e050e8b64ee9c1195eef92db1edd94a15e0f14b7a6dd4abd4096d4a3476

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 68d9f42d85b189b014aa4d7ff52e44d020a9d2ab1aef9361653585c4562dc24f
MD5 f75de64cb631dd4052e1f39bc42b9216
BLAKE2b-256 b36bbf1730c9da98eb28094c89ed38edd84c79ca02e414bf457090af222075d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 e99bc7e72ade405f5e4b08d1f738d9df0d0f55d4693990427e213abd76a58590
MD5 13b2ff7968d3de6631905ea4ba7c79fc
BLAKE2b-256 a4892d9994afbbe409a8b9111e64122b1750caa0064804387a3dc37dd41d1099

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 3f061b8e596065aa6a4aac1199cc8a5adc005ec328bdb15f91c69961ffb28e47
MD5 21236063c77e28376bdbe52337dbad01
BLAKE2b-256 3bb38d9a53f506bdfe051c4c7f92fd810a6c6ed05e5011ef0fbf8992fe4731e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 c7df93514e6e88bbcced140373759214bcd57ce3b4198f659e7da626dafdccf5
MD5 3d67796b444f4331a87729ff0789add3
BLAKE2b-256 7c3f6a12cfe03c08414457c2755c885db12d8ce80b4f57d6510c4d8581f54a0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c0aab2565b0a61b25ec6fdc9ce1c1f716ed33c6809a497aa44b4b792c60c8c6
MD5 2f44b6f9b8f9d1d4e31bf2573e0f0d32
BLAKE2b-256 f3ea5a8f14cb6608e77152e4cb2efa16403331e38df90f60fce13efad1220ff7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc9-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 17cc51a2612ec969c3d12429418cb5f88c9e24373f64c927e6b07fd9f5ad5338
MD5 935d598770dfc0df9769b51d04f5bce4
BLAKE2b-256 cb85e8bf17add4fd1d522aec8d608b39ecba4bb9e666dbb552efb00ce9fcef76

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