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_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.0rc18-py3-none-win_amd64.whl (10.1 MB view details)

Uploaded Python 3Windows x86-64

goldlapel-0.1.0rc18-py3-none-musllinux_1_2_x86_64.whl (11.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

goldlapel-0.1.0rc18-py3-none-musllinux_1_2_aarch64.whl (10.6 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

goldlapel-0.1.0rc18-py3-none-manylinux_2_31_x86_64.whl (11.7 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ x86-64

goldlapel-0.1.0rc18-py3-none-manylinux_2_31_aarch64.whl (10.6 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc18-py3-none-macosx_10_13_x86_64.whl (10.6 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a31151b414c4eefd14a9098185d00cdb8b2339e342410d0ba220f807fbd465e3
MD5 a389be309b999f0c1813fcff8209437b
BLAKE2b-256 6ee4073deb84d96eefad8d12b5ff7e55a9516e75de870f51b655845fe6be87db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7f802b7318e0bef31648995014c20018143a8ed9d1a64def218a233edfbb05a2
MD5 9eb215b3a7f9510fd7a9fef310f35384
BLAKE2b-256 3c430956499c1f8cebb741987921ae3e6cfc98a93d076c53bc52cf02e9687bd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8869b0ecfafbff65a1c99d6e271cea875f76d1d1aebe7d783e5bbf7f84cbb9eb
MD5 1817c6e60fca0413f1500c7dd2e6aa93
BLAKE2b-256 4456890f0493a53dd2b30f8591069ac986b7e5482f781df63217e1c9793f8c3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 eca8d3f48bf4ee1b6c697616b78f40ccc7bf1003da765f27c2fc8a143ed7ef7c
MD5 321644158aa22dd409d70ca400fe9d3c
BLAKE2b-256 25a3470927b4f7fbd17912761ffe8da5483bac59990dfcd5a0ccd367d92b7f28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 f5f3971cfe0a0a208cd54f0e5ede5d12634cb48b684ebe3cb28a3fb4775c20b9
MD5 9968f71e9fb2a75ecf76d951aa73a31a
BLAKE2b-256 cb7be5a2b23c6bde95e6e1709f17673ba3bb7cff8ff260e6d317cd11eff40383

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b2d81d71526f473b02bfadf2451fc7878966b0cf45a373da23670449e63564f
MD5 f025c92357b32adbc6bebad4a70302a5
BLAKE2b-256 fed099e795fc723db41d6ca6dc50b290dc2911cb81d866aceeb0947afe9001eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc18-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bde48d6eea249599e57157f1e52b7498e2f91cf5ff466f470a8a56eab6e948f7
MD5 03878b06f3db3a27e663836c11cd6c61
BLAKE2b-256 5f3eab92fa666271df61d63e4a242ce3df944ae315b2be46b680c86fad0c19c6

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