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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.31+ x86-64

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

Uploaded Python 3manylinux: glibc 2.31+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f79f88c88aad8ba4dee9854bddf46250ce9fcaa7f9187bbcc0ffdf5c07df9ddd
MD5 f138ed79860ab24fa4aeb48edd11afde
BLAKE2b-256 fa01c6c1beb0bd6a069325bb9599545dc8ef7e27d4ce0b59540eef8112c14517

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e5baa0fb88246863776a559a42e653db7726e12ffc7be66604dfddb205dbadcf
MD5 3beab6209a228d15909b55bb03b94cd6
BLAKE2b-256 d450e69b53992d1b7570af71226b58d369b9358f4a9424b91341680ea89a960d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f417fcb3244ce94734db9e2907e95d3a12d6219a7f9bbc2b05156eec61b63d22
MD5 ece4770e4f4df64ef952c7fcf6313cfb
BLAKE2b-256 f53d80f8b17f6a468d681b88e05285309a726c00954d7da40c4f0e6a907c5639

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 7670bd61bcd474fc31653fe348ab321e45957a3ae24491d1720ca9aec8bbe61c
MD5 560d987c048202cfa8e2d14c16b7162f
BLAKE2b-256 98aa1e30a37cc655634a099c0c91fe26a365127e36838cc006d9ec9edc8298ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 3b350f53150ae868dbe770feec0e33ca76d72f80fda74d8521f1770258e6a4b3
MD5 b91a58c1067207db35adc2d9054e1713
BLAKE2b-256 ef021bdbd48445d4e79ab660d385eb80ac2389deb131163eb990c214a47fcda1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c9d77ed0d7225f8b6f55b57a6fdfb34bbb5d0f1c2e343a4aa32af0df85fa160
MD5 78bc4847373822c2758e48891f7be75e
BLAKE2b-256 a43dd5650979b194e6e8a4aca2e4b70771ab750eefbfc4491c3736bd307b8ce6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc21-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 cab6fc8d7bad0ce36fea54a7be0f3efa15fb727c978bc222924fdeeef18ecadd
MD5 0d45268a3c3c442b89c3b95802f79982
BLAKE2b-256 270aac6435c7055bffb1a388f53366097c01761a7bf67774a3a6d2440acc7987

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