Skip to main content

Python API for pg0 - embedded PostgreSQL

Project description

pg0 - Embedded PostgreSQL for Python

PyPI

Embedded PostgreSQL with pgvector. No installation, no Docker, no configuration.

Install

pip install pg0-embedded

Usage

from pg0 import Pg0

# Basic usage
with Pg0() as pg:
    print(pg.uri)  # postgresql://postgres:postgres@localhost:5432/postgres
    pg.execute("CREATE EXTENSION IF NOT EXISTS vector")
    pg.execute("SELECT version()")

# Custom configuration
pg = Pg0(
    name="myapp",
    port=5433,
    username="myuser",
    password="mypass",
    database="mydb",
    config={"shared_buffers": "512MB"}
)
pg.start()
pg.stop()

API

Pg0 Class

Method Description
start() Start PostgreSQL, returns InstanceInfo
stop() Stop PostgreSQL
drop() Stop and delete all data
info() Get instance info
execute(sql) Run SQL query
uri Connection URI (property)
running Check if running (property)

Module Functions

import pg0

pg0.start(name="default", port=5432, ...)  # Start instance
pg0.stop(name="default")                    # Stop instance
pg0.drop(name="default")                    # Delete instance
pg0.info(name="default")                    # Get instance info
pg0.list_instances()                        # List all instances

Getting Connection URI

from pg0 import Pg0

pg = Pg0()
pg.start()

# Using the uri property
print(pg.uri)  # postgresql://postgres:postgres@localhost:5432/postgres

# Or using info()
info = pg.info()
print(info.uri)  # postgresql://postgres:postgres@localhost:5432/postgres
print(info.port)  # 5432
print(info.username)  # postgres
print(info.database)  # postgres

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 Distribution

pg0_embedded-0.3.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pg0_embedded-0.3.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pg0_embedded-0.3.0.tar.gz.

File metadata

  • Download URL: pg0_embedded-0.3.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pg0_embedded-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a2993dfc1a4bd47f6dd434bb7876d818b40819a17fb86c0338c5acd975e68f16
MD5 bf23f475a2ac66e2d0ee445f293905d9
BLAKE2b-256 eea724517ce80dcd986f8b5c23b495877df7e53fc5e28a1f93e0e8df497c62dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pg0_embedded-0.3.0.tar.gz:

Publisher: release-python.yml on vectorize-io/pg0

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pg0_embedded-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pg0_embedded-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pg0_embedded-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca21859df36b37ccbed89591554c36570d74f796810923ea7aca2246e35a025c
MD5 483b9049ac9c0c050b7c59390ead710e
BLAKE2b-256 85c1a0f152256bc44dfaee7fa03326ca29802ab682f82f21c487e967da848bb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pg0_embedded-0.3.0-py3-none-any.whl:

Publisher: release-python.yml on vectorize-io/pg0

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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