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": "waiter",
    "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_PROXY_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.0rc24-py3-none-win_amd64.whl (10.3 MB view details)

Uploaded Python 3Windows x86-64

goldlapel-0.1.0rc24-py3-none-musllinux_1_2_x86_64.whl (11.9 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

goldlapel-0.1.0rc24-py3-none-musllinux_1_2_aarch64.whl (10.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

goldlapel-0.1.0rc24-py3-none-manylinux_2_31_x86_64.whl (11.8 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ x86-64

goldlapel-0.1.0rc24-py3-none-manylinux_2_31_aarch64.whl (10.7 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ ARM64

goldlapel-0.1.0rc24-py3-none-macosx_11_0_arm64.whl (9.5 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc24-py3-none-macosx_10_13_x86_64.whl (10.7 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c76b77506f4832a97b35297bda05a28e83cdbc5cb5cba94e3fb32b2c034d3252
MD5 748707f26e90b8031c3c0a28d3a60242
BLAKE2b-256 f7e0bcfbf16b5f50417f568c049abb80a1cb548b8dccee045cccccfb5a8c4c41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ba6152354e11fe122cff984b500b0f9d4a554a4c3dfdc8a039697538ac6311b2
MD5 4c76c55a6fff66ee4c06725a3984a9b2
BLAKE2b-256 0d466e34611ddfc73d3485b21f2966a7fee92259f70ba8e16a56b3198970faa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 eb7216d32a18dde0b70cb0d81c2237d242a8a263d2fabe87510d4c860683a3dd
MD5 cdd6b93462df32c2cf83223695674b14
BLAKE2b-256 97babb194adcbab4f805e34c8ca1f7914ebeb285336c42b2072907eecc8feb26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 bec52f2df138514f7dfd64c26f5a255b7920f0615cee24f4b53f1e34fba84b7d
MD5 4189ee9a51c83d3ca525f3b6dea216f4
BLAKE2b-256 d5860ac925f4c9e062a00661ad53f97b773ccfefd86b134653a4fe6b997c7842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 8288de7da89c15a6c2a9d6edd055ca8885b30ecc157199693aa03e37fd6b7622
MD5 768e2fc4fa3742ce8191fdaa3e11454e
BLAKE2b-256 05abb3fb15a6918b9946e2c5a60e54cf3be9080e3f23e18974dd3d12efcecf2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7fb0c67fc557468a02514e6c0a0738850716e8fe38fb7f0ba52a158231c1feb
MD5 d92ec812cd229368a38c2c6994530b8d
BLAKE2b-256 c938fdecc7d782f12457e6f84f42b8e705eb191e446b76c313da11c226fc1ad9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc24-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b1cd4a2d128bd059616365cc0b484cc0d3cd82153c8345d4f3ebd45b2d2b0171
MD5 2330298874381f48fe1d487025f03052
BLAKE2b-256 a64c3e3632db57a4b296cbe5c79bf4fb115c6ec3a89dbd2736e5effe53c80cf7

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