Skip to main content

Prerequisites

  • Python 3.9 (a virtual environment is recommended)
  • PostgreSQL

Usage

Easily create PostgreSQL databases! The following example creates a database called foo and a role (also called foo). We then use psql to run a simple select statement.

url=$(puddl-db url foo)
psql $url -c 'SELECT 42 as answer'

List databases and delete a database:

puddl-db ls
puddl-db rm foo

Installation

pip install --upgrade puddl

If you want to use extended packages like puddl.exif, you may install extra dependencies like pandas:

pip install --upgrade puddl[full]

Shell Completion

The following installs completion for Bash. For other shells please refer to the click documentation:

mkdir -p ~/.bash/
_PUDDL_DB_COMPLETE=bash_source puddl-db > ~/.bash/puddl-db

cat <<'EOF' >> ~/.bashrc
[[ -f ~/.bash/puddl-db ]] && source ~/.bash/puddl-db
EOF

exec $SHELL

Configuration

Prepare your environment and let puddl write a config file to ~/.puddlrc. You will need a PostgreSQL connection that provides super user privileges for puddl to work in.

set -o allexport  # makes bash export all variables that get declared
PGHOST=127.0.0.1
PGPORT=5432
PGDATABASE=puddl
PGUSER=puddl
PGPASSWORD=puddl-pw
set +o allexport  # back to default behaviour

puddl-config init

# check database connection
puddl-db health

# initialized the `puddl` database with sql functions like `puddl_upsert_role`
puddl-db init

Development Setup

install -d ~/hacks
cd ~/hacks

git clone https://gitlab.com/puddl/puddl.git
cd puddl/
pip install -e .[full,dev]

Run code style checks before committing

ln -s $(readlink -m env/dev/git-hooks/pre-commit) .git/hooks/pre-commit

Lower the log level to INFO to see what's happening.

export LOGLEVEL=info

Initialize the database. The command puddl-config init will consume the .env file if present in the current working directory.

cd ~/hacks/puddl/

# generate environment variables suitable for development
./env/dev/generate_env_file.sh > .env

# write initdb script and start postgres
./env/dev/create_database.sh

# based on the environment, write ~/.puddlrc
puddl-config init

# make sure initialization was successful
puddl-db health

# apply library sql functions as "puddl" user in "public" schema
puddl-db init

Basic development workflow:

# hack, hack
make

Got psql installed?

source <(puddl-db env)
psql -c '\df'

Try it:

cd puddl/felix/exif/
cat README.md

puddl-db shell exif

Using Puddl Databases in Python

from puddl.pg import DB
db = DB('foo')
db.engine

Rsync Service

cat ~/.ssh/id_*.pub > $PUDDL_HOME/rsync_authorized_keys
ln -s env/dev/docker-compose.override.yml
docker-compose build && docker-compose up -d

Metadata

Release files for puddl 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for puddl 0.10.0
File Size Uploaded Provenance Actions
puddl-0.10.0.tar.gz 31.4 kB Without provenance Details for puddl-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for puddl 0.10.0
File Interpreter ABI Platform Actions
puddl-0.10.0-py3-none-any.whl Python 3 none any Details for puddl-0.10.0-py3-none-any.whl

Total release size: 78.7 kB

Release files / puddl-0.10.0.tar.gz

Download URL puddl-0.10.0.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
861bab4875f6cf0178378183b852b8a187812233ea3723d08c5ae9b59b2debb0
BLAKE2b-256 checksum
How to use checksums
cf7530e797eac69a50c36d30a451cb341ed9e71d6685b2826bfe3150fafbe190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / puddl-0.10.0-py3-none-any.whl

Download URL puddl-0.10.0-py3-none-any.whl
Size 47.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a7ebd89aaae7dd5a6e38f33e8e9d63d283e550c5bf3d89668e5303f5dcb2604
BLAKE2b-256 checksum
How to use checksums
8f54b28cc0ea398bb2c6836b6931b1df596a8b1d5913c735a352baba965a8d59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for puddl 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page