Catalog PyPI
Back to packageRELEASE DETAILS

0.0.2.199

PyPI

abstract-database

Lazy, environment-driven PostgreSQL connection management with multi-database support and table/query helpers.

Published16 Oct 2026
Direct dependencies14
Transitive dependenciesNot calculated

README

Version 0.0.2.199 documentation

abstract_database

Lazy, environment-driven PostgreSQL connection management with multi-database support and table/query helpers.

abstract_database is the connection layer of the Abstract Secure Backend stack. It resolves connection settings from your environment, manages connections to one or many databases, and provides thin helpers for tables and queries — without ever forcing a database connection before you actually need one.


Where this fits

abstract-securefiles   React/TypeScript UI components
abstract_logins        Flask blueprints: auth + secure files
abstract_queries       Domain query managers (users, uploads, ...)
abstract_database  <-- you are here: lazy PostgreSQL connection + helpers
abstract_security      Env loading, hashing, tokens, utilities

Dependencies flow downward; nothing reaches back up.


Install

pip install abstract_database

Requires Python ≥ 3.11 and PostgreSQL (uses psycopg[binary]).


Configuration

Connection settings are read from the environment, so the package is portable across machines. Per-database keys follow <DBNAME>_<DBTYPE>_<FIELD> (upper-cased), or you can supply a single URL:

ABSTRACT_DATABASE_USER=app_user
ABSTRACT_DATABASE_PASSWORD=...
ABSTRACT_DATABASE_HOST=127.0.0.1
ABSTRACT_DATABASE_PORT=5432
ABSTRACT_DATABASE_DBNAME=app
# or:
ABSTRACT_DATABASE_URL=postgresql://app_user:...@127.0.0.1:5432/app

Optional locations:

VariablePurpose
ABSTRACT_DB_ENV_PATHPath to the .env file to read.
ABSTRACT_DB_TABLES_DIRDirectory holding table-config JSON.
ABSTRACT_DB_TYPEDefault db-type label (default database).

Quickstart

from abstract_database import connectionManager, get_cur_conn

# Constructing a manager does NOT open a connection.
db = connectionManager(dbName="app", dbType="database")

# The connection opens on first use; failures raise a clear ConnectionError.
cur, conn = get_cur_conn()           # RealDict cursor + connection
cur.execute("SELECT 1;")
print(cur.fetchone())
conn.close()

Hugpy model database viewer (development utility)

The repository has a standalone, read-only browser for inspecting Hugpy's PostgreSQL model database. It opens on discovery_models, supports searching all columns, sorting by clicking column headers, and paging through results. Selecting a row shows an expandable, syntax-colored JSON tree with controls to expand or collapse nested values. The app-specific script is outside the abstract_database package and uses the package's generic DatabaseBrowser API.

The viewer runs as a persistent solcatcher user service on the Hugpy server and is proxied by nginx. On the LAN or WireGuard, open https://dev.hugpy.ai/modeldb/. Nginx restricts this route to LAN and WireGuard addresses.

The utility reads Hugpy's connection settings from /srv/hugpy/etc/hugpy-db.env and opens http://127.0.0.1:8765/.

Multiple databases

users = connectionManager(dbName="app",      dbType="database")
audit = connectionManager(dbName="auditlog", dbType="database")
# Distinct, independently-configured managers — no global clobbering.

Design notes

  • Lazy by default. Constructing a connectionManager never touches the database. The connection opens on first real use, so importing the package or booting an app never blocks (or fails) on an unreachable database. Table setup is deferred behind ensure_inserts().
  • Multi-DB safe. Managers are cached by connection identity (name / type / env-path / url) rather than a single global singleton, so several databases coexist cleanly. A no-argument connectionManager() still maps to one shared default.
  • Failures are visible. connect_db() raises a ConnectionError with the underlying cause instead of silently returning None and breaking three calls later.

License

MIT.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 14

Native requirements
14 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
psycopg
Environment
{
  "extras": "binary",
  "marker": null,
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
psycopg[binary]runtime
pillow
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pillow; extra == "full"runtime
abstract_apis
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
abstract_apis; extra == "full"runtime
abstract_gui
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
abstract_gui; extra == "full"runtime
abstract_math
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
abstract_math; extra == "full"runtime
abstract_security
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
abstract_security; extra == "full"runtime
asyncpg
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
asyncpg; extra == "full"runtime
abstract_utilities
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
abstract_utilities; extra == "full"runtime
numpy
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
numpy; extra == "full"runtime
pandas
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pandas; extra == "full"runtime
sqlalchemy
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
sqlalchemy; extra == "full"runtime
pyyaml
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
pyyaml; extra == "full"runtime
requests
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
requests; extra == "full"runtime
flask
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.6",
  "evaluation": "NOT_EVALUATED"
}
flask; extra == "full"runtime

Distribution files

2 collected
abstract_database-0.0.2.199-py3-none-any.whl

bdist_wheel · 89.95 KB · Python py3

Source file
abstract_database-0.0.2.199.tar.gz

sdist · 72.77 KB · Python source

Source file

Repository

PENDING
abstractendeavors/abstract_database

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:40 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:331fa4ebe45e2cad544ec1f46c04de8a55b99e47dae4dcb1ef546c4f23f9487b

Other collected versions

View all collected versions →