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

# Create a proxy instance and start it
gl = goldlapel.GoldLapel("postgresql://user:pass@localhost:5432/mydb")
gl.start()

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

For async applications:

import goldlapel

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

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

Gold Lapel prints the proxy and dashboard URLs on startup. Access the dashboard programmatically:

gl.dashboard_url()  # http://127.0.0.1:7933

API

goldlapel.GoldLapel(upstream, config=None, port=None, extra_args=None)

Creates a Gold Lapel proxy instance.

  • 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"])

gl.start()

Starts the proxy. Returns the instance for chaining.

gl.start_async()

Async version of start().

gl.stop()

Stops the proxy. Also called automatically on process exit.

gl.proxy_url()

Returns the current proxy URL, or None if not running.

gl.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.

Configuration

Pass a config dict to the constructor to configure the proxy:

import goldlapel

gl = goldlapel.GoldLapel("postgresql://user:pass@localhost/mydb", config={
    "mode": "waiter",
    "pool_size": 50,
    "disable_matviews": True,
    "replica": ["postgresql://user:pass@replica1/mydb"],
})
gl.start()

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.31+ x86-64

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

Uploaded Python 3manylinux: glibc 2.31+ ARM64

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

Uploaded Python 3macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0167da4c9f4bd363b979d8546a0d9e639c3846768dd0fc261a72eedb2dd36a8f
MD5 1f7dede6bad94d8d809de0bf1a866e01
BLAKE2b-256 64c142f82b070724d0d51a8701618979689cf66070ef3821577d484f5a460e49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cb07d9c199ea7c738860bfa43a20d8fae9ae021aa40d431a1394e7775a258d94
MD5 40c0525af7dda84edb47f5795a5a6d01
BLAKE2b-256 7a68e14594fdfc03f68916d575a48e871689b1b416d967c01b96f9d5dc22edec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6424e58ad3e0e51da8d2216251a5e721afc6ecb03c954307ea1212539a3c7c65
MD5 757456c59547badefc64026bb06a4066
BLAKE2b-256 5989e3967aee54cf68c9b3063cc8b649eb97f0683b506630c6938be1658ce8d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 ad05ad73e4e9f1f65cb08059e8ce6af9753d844ccf920e86e8aff199864d40c1
MD5 6e1c0a9bf471703af6cd1f0d1ad18b98
BLAKE2b-256 3d9016719e64c193e1d1c8f8e878e48799ae2bc8e1d6afff68130e0bfeca93ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 02f9aaf2dd2d4097c81d8fd3963633ed644bb1f42be81ca3eccef7d350a9a80a
MD5 b42f9df10d67f56eb019c8065d04016d
BLAKE2b-256 98c7a82b5619280d00938a67ac30a280a369c8bc2d8a945a938c0219e2748821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cef824ac8668becda93eb39355b1aa1b95b25e93074bb6edd0d5c8f5e3459994
MD5 484b5e7895e11a56892dabb3cb9ca0e7
BLAKE2b-256 6ab1c0a763142bf4040dcba1ac5c80c4c39fdc36c8f7477c40a29ac33e0f8b24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for goldlapel-0.1.0rc25-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0b0f6fad15de714f305c55d4bc9a73979d18b17dc840afa7898022f40043813a
MD5 30a55bef26162106ffdc7ab6c2ca650f
BLAKE2b-256 4e1954d99f46b918a5df7ffe802953da875908656307f01874579aa318f7efb0

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