Skip to content

feat: add explicit dump subcommand - #22

Merged
TheCrab13 merged 5 commits into
mainfrom
feat/explicit-dump-subcommand
Aug 17, 2026
Merged

feat: add explicit dump subcommand#22
TheCrab13 merged 5 commits into
mainfrom
feat/explicit-dump-subcommand

Conversation

@TheCrab13

Copy link
Copy Markdown
Contributor

dump was the only action without a name, implicit whenever no subcommand was given. Make it a real subcommand and keep the bare form working as a shorthand.

Options are split into common/source/selection/dump groups, declared on the root parser as hidden aliases and on each subcommand with SUPPRESS defaults so values parsed before the verb are not clobbered. migrate and validate now accept the source and filtering flags after the verb too.

dump was the only action without a name, implicit whenever no subcommand
was given. Make it a real subcommand and keep the bare form working as a
shorthand.

Options are split into common/source/selection/dump groups, declared on
the root parser as hidden aliases and on each subcommand with SUPPRESS
defaults so values parsed before the verb are not clobbered. migrate and
validate now accept the source and filtering flags after the verb too.
Readers logged the full connection URL, password included, while writers
already redacted theirs. Credentials were also interpolated raw, so a
password containing @ / or : produced a broken URL.

Centralise URL assembly in infrastructure/url.py: credentials are
percent-encoded and every log line goes through redact_url.
Expose the SQLAlchemy URL that readers and writers already build
internally. This is the only way to reach driver-specific parameters
(sslmode, charset, TrustServerCertificate), to pick another DBAPI for the
same dialect, or to describe an Oracle service_name without a config file.

A DSN replaces the connection instead of merging with it; the discrete
fields it shadows are reported. Its dialect is checked against the
selected driver, since SQLAlchemy resolves the dialect from the URL and
would otherwise connect before failing inside introspection.
The plugin example READMEs, plugins.rst and the configuration recipes
still invoked db2sql without a command. The example READMEs also used a
lowercase -c, which has never been a valid flag.

Also state that the init wizard does not generate a DSN.
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   90.66%   92.05%   +1.38%     
==========================================
  Files          77       78       +1     
  Lines        3076     3159      +83     
==========================================
+ Hits         2789     2908     +119     
+ Misses        287      251      -36     
Files with missing lines Coverage Δ
db2sql/const.py 100.00% <100.00%> (ø)
db2sql/infrastructure/config/loader.py 99.01% <100.00%> (+1.17%) ⬆️
db2sql/infrastructure/config/schema.py 98.05% <100.00%> (+0.12%) ⬆️
db2sql/infrastructure/persistence/mssql/reader.py 98.27% <100.00%> (-0.08%) ⬇️
db2sql/infrastructure/persistence/mysql/reader.py 96.93% <100.00%> (-0.10%) ⬇️
db2sql/infrastructure/persistence/oracle/reader.py 97.97% <100.00%> (-0.05%) ⬇️
...2sql/infrastructure/persistence/postgres/reader.py 97.80% <100.00%> (-0.12%) ⬇️
db2sql/infrastructure/persistence/sqlite/reader.py 96.42% <100.00%> (+0.13%) ⬆️
db2sql/infrastructure/url.py 100.00% <100.00%> (ø)
db2sql/infrastructure/writer/mssql/writer.py 37.64% <100.00%> (+12.38%) ⬆️
... and 5 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TheCrab13 TheCrab13 added the run-functional Trigger functional tests (MSSQL + Postgres) label Aug 17, 2026
Both properties are pure functions of the config, but were only reachable
through the functional suite, which does not run on every pull request.
This also puts the --target-dsn path and the target-side password
redaction under test without needing a live server.
@TheCrab13
TheCrab13 merged commit 8bb2452 into main Aug 17, 2026
7 checks passed
@TheCrab13
TheCrab13 deleted the feat/explicit-dump-subcommand branch August 17, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-functional Trigger functional tests (MSSQL + Postgres)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant