Skip to main content

simple_postgres_setup

This package provides two main functions for managing a PostgreSQL database:

  1. setup_database("path_to_config.yml")
    Sets up a PostgreSQL database using:

    • Credentials from your .env file
    • Additional parameters specified in your config.yml
  2. drop_database("path_to_config.yml")
    Drops (tears down) the same PostgreSQL database, reverting changes made during the setup.


scope

  1. define the database name
  2. define the database schemas and schema comments 2.1 per schema there will be three default functional roles:
    • schema_name_all = all privileges regarding the schema are granted
    • schema_name_use = usage on existing schema assets are granted
    • schema_name_read = only select on tables is granted
  3. define the login roles (users)
  4. define the access policies for the users by connecting the login roles with the functional roles per schema (see example configuration in the template subfolder)

usage

  • install with pip (see installation) or other package manager
  • create directory
  • create config.yml and .env in the directory (use template files provided in the 'template' subfolder of this pacakge)
  • define output directory in your config.yml as a relative path from the directory you execute the functions from, e.g. THIS directory
  • provide all required input in the .env and config.yml files
  • run setup

Requirements

  • Python 3.10+
  • An existing PostgreSQL server/cluster with Postgreql > 13
  • A .env file containing the following DB connection parameters (e.g., hostname, port, user credentials):
# database connection variables

HOST=some_host 
PORT='some_port_number'
DB=postgres # this whole software only works with postgres
USER=postgres_or_other_superuser
PWD=some_password
  • A config.yml specifying how to configure the database and where to store output artifacts.

NOTE: An example configuration file is included in the templates subfolder of this package: templates/config.yml.example


Installation

  1. Make sure you have pip installed (or use Poetry / another compatible Python package manager).

  2. Install from PyPI (or from source) by running:

    pip install simple_postgres_setup
    

Metadata

Release files for simple_postgres_setup 0.2.1

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

Source distribution (sdist)

Source distribution for simple_postgres_setup 0.2.1
File Size Uploaded Provenance Actions
simple_postgres_setup-0.2.1.tar.gz 13.2 kB Without provenance Details for simple_postgres_setup-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 36.0 kB

Release files / simple_postgres_setup-0.2.1.tar.gz

Download URL simple_postgres_setup-0.2.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fda9fb7a6bd753376bf8f51e4b2eb0cc9090f3d23789255d111ae6a3a4c9f28b
BLAKE2b-256 checksum
How to use checksums
fd34bf3005d5c8db32c2f35a1ef2f738e353b092aabb6ebd752587105c1d6836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.18 Linux/6.11.0-1018-azure

Release files / simple_postgres_setup-0.2.1-py3-none-any.whl

Download URL simple_postgres_setup-0.2.1-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c357c929618a7338a767657fe2e5d1c59229f5a388e93043a61f2ffad6a380a8
BLAKE2b-256 checksum
How to use checksums
dafe941d310cf5706cef82a411e835b77dce0a028610b6e46bdbbb655076f1b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.18 Linux/6.11.0-1018-azure

Security for simple_postgres_setup 0.2.1

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