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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.31+ x86-64

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

Uploaded Python 3manylinux: glibc 2.31+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

goldlapel-0.1.0rc22-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.0rc22-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 509a85d0655ebca2224c412a168578df749d3fb926c11132a7013b2e12975538
MD5 2661a55726e1e82570405b3efe461c8d
BLAKE2b-256 463026e11aefa6d8185745417252f93168f090871dc214c6b7bad2d91192adae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 00aba47bd4e7b1eddc17d14557aa7ff52c7c332524f16ea8140d0b19f3f9ad46
MD5 c7cadea3e748e8f7cd9ee3c3ee600041
BLAKE2b-256 272afde876fd06d1f3e0daeb676034b897cb0569347876e828f7c023e6ed6d74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 42007fd350398661d5bbad6630cf58f5e776928b16f2a841b5c47e9850c26022
MD5 a9184533693200357bdb4659183b06b7
BLAKE2b-256 68f374063a5fff48b5911c7701092a2e2026a022ed7c6cb6de5d8ebce8a12086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 aba7af9308bea8ba955b53e2953ed51e59626e0557f001e834a0879074686433
MD5 7d0dc4bcb6ba69b0852622db7ea6a5d4
BLAKE2b-256 be17172e70236787102018e569ca93642a38ebd98fb8eb97bedb2b8fcee2146d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 b40f6707d096b3d4c08f3fb13e6015dd1ed05f1f52d9d3a435c1e3ec77632ea4
MD5 8fb85c44954f4785baab748c8408f63b
BLAKE2b-256 f8abbc577b446559b0e2516dfb4a0310973d2b2b394ce65ae2e14bfcb0f9ad12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abac054ddd9601e89d1c817649699749b09c8ccacd3c9112953af0130419b0ad
MD5 a6a78689ac9c9aaddc95f13c68d30e86
BLAKE2b-256 d266fcef1ed4755d7c0ea0addc8b36f71d82e981df2fd393514aa8630ddf4c83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc22-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 40834d8ed2953b83bcc0a1d52d14f4404d927e919f146d71c4cd89cf9ef9e308
MD5 03a02a6f40fd8585a5c831c0d50a07d1
BLAKE2b-256 9ed055a3e8a3c65bc3718b711bf404396fa74deee735afa09a1d0817ea512385

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