Repository navigation
feat: a command line for the read-only half - #36
Closed
AlexeyShalaev wants to merge 2 commits into
Closed
AlexeyShalaev wants to merge 2 commits into
AlexeyShalaev wants to merge 2 commits into
Conversation
pg-partsmith runs inspect, plan and validate over a configuration document and a DSN, so a Go, Ruby or Node service can see its partitions without taking a Python dependency. None of the three issues DDL, takes a lock or fires a hook. Exit codes are the product here, because a CronJob and a CI step read them and nothing else: 2 is drift under plan --check, which is what maintenance that stopped running looks like; 3 is a finding that needs a person, and outranks drift because a run fixes drift and cannot fix a finding; 6 is a lock another maintainer holds, which is ordinary operation and the first false page a deployment gets if it is reported as a failure. --output json is the models' own dump under a versioned envelope, by_alias, so what comes out of plan and what goes into a document are one vocabulary. Logs go to stderr. argparse rather than a dependency: the image this ships in is measured, and a nicer --help is a poor trade for a wheel. apply is deliberately absent. The plan/apply split is what makes an external tool trustworthy with DROP, and the applying half ships once the artifact between them has been used in anger.
Member
Author
|
Folded into #43, one PR for the whole epic; this branch stays for history. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of #32: the CLI, read-only half.
pip install "pg-partsmith[cli]"givespg-partsmith inspect / plan / validateover a document and a DSN. None of the three issues DDL, takes a lock or fires a hook.Exit codes are the product here, because a CronJob and a CI step read them and nothing else:
plan --check— what "maintenance has stopped running" looks like6is deliberately not a failure: two runs overlapping is ordinary operation, and reporting it as an error is the first false page every deployment gets.--output jsonis the models' own dump under a versioned envelope,by_alias=True, so what comes out ofplanand what goes into a document are one vocabulary. Logs go to stderr. DSN precedence is--dsn→$PG_PARTSMITH_DSN→ the document, so a mounted ConfigMap can carry the tables while the password stays in a secret.argparse rather than a dependency: the image this ships in is measured, and a nicer
--helpis a poor trade for a wheel.The integration tests caught a real bug: a refused connection arrives as a bare
OSError(asyncpg raises it before SQLAlchemy has a DBAPI error to wrap), which would have been exit1instead of5.23 unit tests + 7 against a real PostgreSQL. Stacked on the document PR.