Skip to main content

Database for STAC Workflow Open Orchestration Framework

Project description

swoop-db

The swoop database schema is managed via dbami, and uses dbami to implement a custom cli and python library for managing databases for swoop.

Installing swoop-db

swoop-db can be pip installed:

pip install swoop.db

If wanting to install locally for development purposes, see CONTRIBUTING.md for further instructions.

Postgres Extensions

swoop-db makes use of two postgres extensions:

  • pg_partman: an automated table partition manager
  • pgTap: a postgres-native testing framework

pgTap is only used for testing, and is not installed into the schema except when testing.

Database testing with docker

./Dockerfile defines the build steps for a database test container. The container includes the requsite postgres extensions. As the Dockerfile builds an image with all the database dependencies with fixed versions, using docker with that image is strongly recommended for all testing to help guarantee consistency between developers (running postgres in another way is fine if desired, but does require that the necessary extensions and utilities are installed, and that the connection information is correctly configured for tooling).

To make using the docker container more convenient, a docker-compose.yml file is provided in the project root. The repo contents are mounted as /swoop/db/ inside the container to help facilitate database operations and testing using the included utilities. For example, to bring up the database and run the tests:

# load the .env vars
source .env

# bring up the database container in the background
#   --build  forces rebuild of the container in case changes have been made
#   -V       recreates any volumes instead of reusing data
#   -d       run the composed images in daemon mode rather than in the foreground
docker compose up --build -V -d

# create the database and apply all migrations
swoop-db up

# connect to the database with psql
docker compose exec postgres psql -U postgres swoop

# create the database and load the schema.sql with a custom database name
swoop-db create --database swoop-custom
swoop-db load-schema --database swoop-custom

To verify the schema and migrations match:

# run the verification; any diff indicates schema/migrations out-of-sync
swoop-db verify

To drop a database:

# we'll drop the custom one we made earlier
swoop-db drop --database swoop-custom

To stop the postgres container:

docker compose down

The swoop-db cli is intended to be discoverable. When in doubt, try checking the help.

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

swoop.db-2.0.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

swoop.db-2.0.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file swoop.db-2.0.0.tar.gz.

File metadata

  • Download URL: swoop.db-2.0.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for swoop.db-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dd4d334173eaacef130c3d3f9972c79f8f6692953fcc5a53c4f1b80ebd59b5a4
MD5 1b6166f9519ce9ac00fd10c97e52eba2
BLAKE2b-256 9c2f487ec3113b888c5e88e84fa21b00fac13355c4f72297211c4234a7006d61

See more details on using hashes here.

File details

Details for the file swoop.db-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: swoop.db-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for swoop.db-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0f19dccae71633e007e1e50bb73cc6bf36dc0ed658144a372af2ee3be25afcc
MD5 cb0186ecd719640b8bd9fa0495b59f82
BLAKE2b-256 337b1d125e6ca1fcb4bd77cef4e2c4f29f4fdbd950cf3bd15b05c61d1638617c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page