firebird-admin 2.1.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/PKG-INFO +1 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/__init__.py +1 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/__main__.py +12 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/auth.py +2 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/databases.py +48 -11
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/datacompare.py +65 -19
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/debug.py +118 -18
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/jobs.py +6 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/maintenance.py +23 -11
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/servers.py +7 -6
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/upgrade.py +9 -2
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/__init__.py +9 -2
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/backup.py +15 -1
- firebird_admin-2.1.1/fbadmin/cli/remote.py +633 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/connections.py +104 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/datacompare/engine.py +355 -33
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/driver_patches.py +97 -3
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/embedded.py +2 -2
- firebird_admin-2.1.1/fbadmin/jobs.py +214 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/ops.py +53 -2
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/scheduler.py +16 -5
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/svc.py +49 -3
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/verify.py +6 -3
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/catalog.py +36 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/native.py +52 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/access.py +2 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/core.py +13 -2
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/db.py +39 -7
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/wirecompat.py +44 -3
- firebird_admin-2.1.0/fbadmin/static/assets/DataView-iu12_E-Y.js → firebird_admin-2.1.1/fbadmin/static/assets/DataView-BrqD_cZk.js +1 -1
- firebird_admin-2.1.1/fbadmin/static/assets/Jobs-DTXwutYo.js +2 -0
- firebird_admin-2.1.0/fbadmin/static/assets/Monitor-DWbTEAIi.js → firebird_admin-2.1.1/fbadmin/static/assets/Monitor-D0Gptge7.js +1 -1
- firebird_admin-2.1.1/fbadmin/static/assets/QueryTool-CuXZB3Zr.js +30 -0
- firebird_admin-2.1.1/fbadmin/static/assets/index-4VcC6Fli.js +157 -0
- firebird_admin-2.1.1/fbadmin/static/assets/index-D4IZNDEI.css +1 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/index.html +2 -2
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/trial.py +7 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/PKG-INFO +1 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/SOURCES.txt +11 -6
- firebird_admin-2.1.1/tests/test_cli_remote.py +239 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_datacompare.py +148 -0
- firebird_admin-2.1.1/tests/test_jobs_cancel.py +395 -0
- firebird_admin-2.1.1/tests/test_large_schema.py +115 -0
- firebird_admin-2.1.1/tests/test_startup_race.py +61 -0
- firebird_admin-2.1.0/fbadmin/jobs.py +0 -78
- firebird_admin-2.1.0/fbadmin/static/assets/Jobs-CQD_Fptv.js +0 -2
- firebird_admin-2.1.0/fbadmin/static/assets/QueryTool-BLHrpcjI.js +0 -30
- firebird_admin-2.1.0/fbadmin/static/assets/index-BNf4x6R6.js +0 -156
- firebird_admin-2.1.0/fbadmin/static/assets/index-CgoPbZ7n.css +0 -1
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/README.md +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/ai/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/ai/providers.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/alerts/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/alerts/channels.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/alerts/checks.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/alerts/engine.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/alerts/store.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/access.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/admin.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/ai.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/alerts.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/deps.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/driver.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/embedded.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/events.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/fbsecurity.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/library.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/metrics.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/monitoring.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/object_dialogs.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/overview.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/query.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/querybuilder.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/replication.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/schedules.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/schema.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/schema_history.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/storage.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/trace.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/api/version.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/app.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/common.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/misc.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/registry.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/cli/schema.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/config.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/datacompare/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/datacompare/literals.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/debug/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/debug/psql.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/debug/runner.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/debug/store.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/desktop.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/drivers.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/events/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/events/monitor.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/events/scan.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/events/wire.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/fb4types.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/library.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/limits.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/logsetup.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/archive.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/cron.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/gstat.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/maintenance/trace.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/catalog_extras.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/ddlgen.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/designer.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/metadata/types.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/middleware.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/advisor.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/history.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/journal.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/metrics.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/overview.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/probes.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/profiler.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/monitoring/replication.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/plugins.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/preconfig.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/query.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/copydata.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/dataio.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/diff.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/extract.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/generator.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/model.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/report.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema/search.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schema_ctx.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/gitrepo.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/layout.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/audit.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/crypto.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/errors.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/fbservices.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/fbsql.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/ldap.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/mfa.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/middleware.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/oidc.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/proxy.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/readonly.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/runas.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/servers.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/sessions.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/settings.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/tokens.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/security/totp.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/serialize.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/sqlsplit.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/assets/codemirror-CQtTaafu.js +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/assets/react-D1VdbdIl.js +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/assets/sql-formatter-BMeiBS2F.js +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/icons/apple-touch-icon.png +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon-192.png +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon-512.png +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon.svg +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/static/manifest.webmanifest +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/azure.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/base.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/gcs.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/s3.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/storage/targets.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/store.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/updater.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/__init__.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/checks.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/keywords.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/keywords_data.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/fbadmin/upgrade/plan.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/dependency_links.txt +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/entry_points.txt +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/requires.txt +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/top_level.txt +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/pyproject.toml +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/setup.cfg +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_access.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_access_fb.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_advisor_parse.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_ai.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_alerts.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_api.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_cli.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_ddl_property.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_debug.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_debug_psql.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_driver_auto.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_driver_equivalence.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_driver_patches.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_embedded.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_encryption_plugin.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_engineering.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_events.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_fb4types.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_firebird_qa.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_ldap_real.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_library.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_maintenance.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_maintenance_units.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_monitoring.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_native_driver.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_objects_03.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_oidc_real.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_overview.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_plugins.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_preconfig.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_query_tool.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_querybuilder.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_replication.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_schema_history.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_schema_tools.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_schemas_fb6.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_security.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_security_fb.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_sqlsplit.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_sqlsplit_fuzz.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_storage.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_storage_real.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_types.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_updater.py +0 -0
- {firebird_admin-2.1.0 → firebird_admin-2.1.1}/tests/test_upgrade.py +0 -0
|
@@ -20,11 +20,22 @@ from .config import settings
|
|
|
20
20
|
from .logsetup import LEVELS, configure_logging
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
REMOTE_OPTIONS = ("--url", "--token", "--token-env", "--ca-cert")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _remote_command(argv: list[str], commands) -> bool:
|
|
27
|
+
"""``fbadmin --url URL [--token-env NAME] COMMAND ...``: remote options before the command."""
|
|
28
|
+
i = 0
|
|
29
|
+
while i < len(argv) and argv[i].split("=", 1)[0] in REMOTE_OPTIONS:
|
|
30
|
+
i += 1 if "=" in argv[i] else 2
|
|
31
|
+
return 0 < i < len(argv) and argv[i] in commands
|
|
32
|
+
|
|
33
|
+
|
|
23
34
|
def main(argv: list[str] | None = None) -> None:
|
|
24
35
|
argv = list(sys.argv[1:] if argv is None else argv)
|
|
25
36
|
from .cli import COMMANDS
|
|
26
37
|
|
|
27
|
-
if argv and argv[0] in COMMANDS:
|
|
38
|
+
if argv and (argv[0] in COMMANDS or _remote_command(argv, COMMANDS)):
|
|
28
39
|
from .cli import main as cli_main
|
|
29
40
|
|
|
30
41
|
sys.exit(cli_main(argv))
|
|
@@ -122,7 +122,8 @@ def setup(body: SetupIn, request: Request, response: Response):
|
|
|
122
122
|
sec = get_state().security
|
|
123
123
|
if not sec.needs_setup():
|
|
124
124
|
raise SecurityError(409, "Setup has already been completed", "setup_done")
|
|
125
|
-
sec.
|
|
125
|
+
if sec.create_first_admin(body.username, email=body.email, password=body.password) is None:
|
|
126
|
+
raise SecurityError(409, "Setup has already been completed", "setup_done") # by a concurrent request
|
|
126
127
|
p = sec.login_password(body.username, body.password, request.client.host if request.client else None)
|
|
127
128
|
return _login_response(request, response, p)
|
|
128
129
|
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import re
|
|
6
6
|
|
|
7
7
|
from fastapi import APIRouter, Query
|
|
8
|
-
from pydantic import BaseModel
|
|
8
|
+
from pydantic import BaseModel, Field
|
|
9
9
|
|
|
10
10
|
from .. import schemahistory as schema_history
|
|
11
11
|
from ..config import settings
|
|
@@ -88,20 +88,33 @@ def drop_object(server_id: str, db_id: str, otype: str, name: str):
|
|
|
88
88
|
return {"sql": sql}
|
|
89
89
|
|
|
90
90
|
|
|
91
|
+
COMPLETION_COLUMNS = 20_000 # above this many columns, completion sends table names only (columns on demand)
|
|
92
|
+
_REL_COND = ("WHERE COALESCE(r.RDB$SYSTEM_FLAG, 0) = 0 OR r.RDB$RELATION_NAME STARTING WITH 'MON$' "
|
|
93
|
+
"OR r.RDB$RELATION_NAME STARTING WITH 'RDB$' OR r.RDB$RELATION_NAME STARTING WITH 'SEC$'")
|
|
94
|
+
|
|
95
|
+
|
|
91
96
|
@router.get("/completion")
|
|
92
97
|
def completion(server_id: str, db_id: str):
|
|
93
|
-
"""Names for editor autocompletion: relations with columns, procedures, functions, packages.
|
|
98
|
+
"""Names for editor autocompletion: relations with columns, procedures, functions, packages.
|
|
99
|
+
|
|
100
|
+
With very large schemas (more than ``COMPLETION_COLUMNS`` columns) only the relation names are sent
|
|
101
|
+
(``lazy_columns: true``); the editor then asks ``/completion/columns`` for the tables a query uses."""
|
|
94
102
|
with get_state().manager.meta(server_id, db_id) as conn:
|
|
95
103
|
cat = Catalog(conn)
|
|
104
|
+
n = (cat.one("SELECT COUNT(*) AS n FROM RDB$RELATION_FIELDS rf JOIN RDB$RELATIONS r "
|
|
105
|
+
"ON r.RDB$RELATION_NAME = rf.RDB$RELATION_NAME " + _REL_COND) or {}).get("n") or 0
|
|
106
|
+
lazy = n > COMPLETION_COLUMNS
|
|
96
107
|
rels: dict[str, list[str]] = {}
|
|
97
|
-
|
|
98
|
-
"SELECT TRIM(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if lazy:
|
|
109
|
+
for r in cat.rows("SELECT TRIM(r.RDB$RELATION_NAME) AS rel FROM RDB$RELATIONS r " + _REL_COND):
|
|
110
|
+
rels[r["rel"]] = []
|
|
111
|
+
else:
|
|
112
|
+
for r in cat.rows(
|
|
113
|
+
"SELECT TRIM(rf.RDB$RELATION_NAME) AS rel, TRIM(rf.RDB$FIELD_NAME) AS col FROM RDB$RELATION_FIELDS rf "
|
|
114
|
+
"JOIN RDB$RELATIONS r ON r.RDB$RELATION_NAME = rf.RDB$RELATION_NAME " + _REL_COND +
|
|
115
|
+
" ORDER BY rf.RDB$RELATION_NAME, rf.RDB$FIELD_POSITION"
|
|
116
|
+
):
|
|
117
|
+
rels.setdefault(r["rel"], []).append(r["col"])
|
|
105
118
|
procs = [r["name"] for r in cat.rows(
|
|
106
119
|
"SELECT TRIM(RDB$PROCEDURE_NAME) AS name FROM RDB$PROCEDURES "
|
|
107
120
|
"WHERE RDB$PACKAGE_NAME IS NULL AND COALESCE(RDB$SYSTEM_FLAG, 0) = 0")]
|
|
@@ -115,7 +128,31 @@ def completion(server_id: str, db_id: str):
|
|
|
115
128
|
"FROM RDB$FUNCTIONS WHERE RDB$PACKAGE_NAME IS NOT NULL"
|
|
116
129
|
):
|
|
117
130
|
pkgs.setdefault(r["pkg"], []).append(r["name"])
|
|
118
|
-
return {"relations": rels, "procedures": procs, "functions": funcs, "packages": pkgs}
|
|
131
|
+
return {"relations": rels, "procedures": procs, "functions": funcs, "packages": pkgs, "lazy_columns": lazy}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class ColumnsIn(BaseModel):
|
|
135
|
+
relations: list[str] = Field(..., max_length=500)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@router.post("/completion/columns")
|
|
139
|
+
def completion_columns(server_id: str, db_id: str, body: ColumnsIn):
|
|
140
|
+
"""Columns of some relations, for autocompletion in very large schemas (see ``completion``)."""
|
|
141
|
+
names = sorted({n for n in body.relations if n})
|
|
142
|
+
out: dict[str, list[str]] = {n: [] for n in names}
|
|
143
|
+
if not names:
|
|
144
|
+
return {"relations": out}
|
|
145
|
+
with get_state().manager.meta(server_id, db_id) as conn:
|
|
146
|
+
cat = Catalog(conn)
|
|
147
|
+
for i in range(0, len(names), 100):
|
|
148
|
+
chunk = names[i:i + 100]
|
|
149
|
+
for r in cat.rows(
|
|
150
|
+
"SELECT TRIM(rf.RDB$RELATION_NAME) AS rel, TRIM(rf.RDB$FIELD_NAME) AS col FROM RDB$RELATION_FIELDS rf "
|
|
151
|
+
f"WHERE rf.RDB$RELATION_NAME IN ({', '.join('?' * len(chunk))}) "
|
|
152
|
+
"ORDER BY rf.RDB$RELATION_NAME, rf.RDB$FIELD_POSITION", chunk
|
|
153
|
+
):
|
|
154
|
+
out.setdefault(r["rel"], []).append(r["col"])
|
|
155
|
+
return {"relations": out}
|
|
119
156
|
|
|
120
157
|
|
|
121
158
|
@router.post("/execute")
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
"""Data compare API (milestone 1.2): compare table rows of two databases, sync script, apply.
|
|
1
|
+
"""Data compare API (milestone 1.2): compare table rows of two databases, sync script, apply.
|
|
2
|
+
|
|
3
|
+
Comparisons are kept on disk (``datacompare.engine.runs``) and survive restarts; a comparison and
|
|
4
|
+
applying its script can be cancelled like other jobs (``POST /api/jobs/{id}/cancel``).
|
|
5
|
+
"""
|
|
2
6
|
|
|
3
7
|
from __future__ import annotations
|
|
4
8
|
|
|
5
9
|
import re
|
|
10
|
+
import time
|
|
6
11
|
|
|
7
12
|
from fastapi import APIRouter
|
|
8
13
|
from fastapi.responses import JSONResponse, StreamingResponse
|
|
9
14
|
from pydantic import BaseModel, Field
|
|
10
15
|
|
|
11
|
-
from ..
|
|
16
|
+
from .. import jobs
|
|
17
|
+
from ..connections import PasswordRequired, connect, statements_on_cancel
|
|
12
18
|
from ..datacompare import engine
|
|
13
19
|
from ..serialize import to_json
|
|
14
20
|
from .deps import get_state
|
|
@@ -104,42 +110,79 @@ def compare(body: CompareIn):
|
|
|
104
110
|
directions=sorted(directions), max_differences=body.max_differences)
|
|
105
111
|
|
|
106
112
|
def job(log):
|
|
113
|
+
def tee(line: str) -> None: # the log is kept with the comparison
|
|
114
|
+
run.log.append(line)
|
|
115
|
+
log(line)
|
|
116
|
+
|
|
107
117
|
try:
|
|
108
118
|
src = _open(body.source)
|
|
109
119
|
try:
|
|
110
120
|
dst = _open(body.target)
|
|
111
121
|
try:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
with statements_on_cancel(src, lambda: _open(body.source)), \
|
|
123
|
+
statements_on_cancel(dst, lambda: _open(body.target)):
|
|
124
|
+
engine.compare_tables(src, dst, tee, run, tables=[t.model_dump() for t in body.tables],
|
|
125
|
+
ignore=set(body.ignore_columns), directions=directions,
|
|
126
|
+
max_samples=body.max_differences)
|
|
115
127
|
finally:
|
|
116
128
|
dst.close()
|
|
117
129
|
finally:
|
|
118
130
|
src.close()
|
|
131
|
+
run.status = "finished"
|
|
132
|
+
except Exception as exc:
|
|
133
|
+
if isinstance(exc, jobs.Cancelled) or jobs.cancelling():
|
|
134
|
+
run.status = "cancelled"
|
|
135
|
+
tee("Cancelled")
|
|
136
|
+
else:
|
|
137
|
+
run.status, run.error = "failed", str(exc) or exc.__class__.__name__
|
|
138
|
+
raise
|
|
119
139
|
finally:
|
|
120
|
-
run.finished = True
|
|
140
|
+
run.finished, run.finished_at = True, time.time()
|
|
141
|
+
if run.id:
|
|
142
|
+
run.save()
|
|
121
143
|
|
|
122
144
|
j = get_state().jobs.start("datacompare", f"Compare data {run.source_name} → {run.target_name}",
|
|
123
|
-
body.target.server_id, job)
|
|
145
|
+
body.target.server_id, job, cancellable=True)
|
|
124
146
|
run.result["job_id"] = j.id
|
|
125
147
|
engine.runs.add(j.id, run)
|
|
126
148
|
return j.summary()
|
|
127
149
|
|
|
128
150
|
|
|
129
|
-
def _run(job_id: str):
|
|
130
|
-
|
|
131
|
-
|
|
151
|
+
def _run(job_id: str) -> engine.Run:
|
|
152
|
+
return engine.runs.get(job_id) # in server mode, only the user's own comparisons
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _view(run: engine.Run) -> dict:
|
|
156
|
+
return to_json({**run.result, "job_id": run.id, "status": run.status, "error": run.error,
|
|
157
|
+
"applied": run.applied, "created": run.created, "finished_at": run.finished_at,
|
|
158
|
+
"source": {"server_id": run.source[0], "db_id": run.source[1]},
|
|
159
|
+
"target": {"server_id": run.target[0], "db_id": run.target[1]}})
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@router.get("/api/datacompare/runs")
|
|
163
|
+
def list_runs():
|
|
164
|
+
"""Recent comparisons (kept across restarts), newest first."""
|
|
165
|
+
return [to_json(r.summary()) for r in engine.runs.list()]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@router.delete("/api/datacompare/runs/{job_id}", status_code=204)
|
|
169
|
+
def delete_run(job_id: str):
|
|
170
|
+
engine.runs.delete(job_id)
|
|
132
171
|
|
|
133
172
|
|
|
134
173
|
@router.get("/api/datacompare/jobs/{job_id}")
|
|
135
174
|
def result(job_id: str):
|
|
136
|
-
|
|
137
|
-
|
|
175
|
+
return _view(_run(job_id))
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@router.get("/api/datacompare/jobs/{job_id}/log")
|
|
179
|
+
def run_log(job_id: str):
|
|
180
|
+
return {"log": _run(job_id).log}
|
|
138
181
|
|
|
139
182
|
|
|
140
183
|
@router.get("/api/datacompare/jobs/{job_id}/samples")
|
|
141
184
|
def samples(job_id: str, table: str):
|
|
142
|
-
|
|
185
|
+
run = _run(job_id)
|
|
143
186
|
stats = next((t for t in run.result.get("tables", []) if t["name"] == table), None)
|
|
144
187
|
if stats is None:
|
|
145
188
|
raise KeyError(f"Table {table!r} was not compared")
|
|
@@ -150,8 +193,8 @@ def samples(job_id: str, table: str):
|
|
|
150
193
|
|
|
151
194
|
@router.get("/api/datacompare/jobs/{job_id}/script")
|
|
152
195
|
def script(job_id: str):
|
|
153
|
-
|
|
154
|
-
if
|
|
196
|
+
run = _run(job_id)
|
|
197
|
+
if run.status != "finished":
|
|
155
198
|
raise ValueError("The comparison has not finished")
|
|
156
199
|
name = re.sub(r"[^A-Za-z0-9_.-]", "_", run.target_name.split(" / ")[-1]) or "target"
|
|
157
200
|
return StreamingResponse(run.script_chunks(), media_type="application/sql",
|
|
@@ -161,7 +204,7 @@ def script(job_id: str):
|
|
|
161
204
|
@router.post("/api/servers/{server_id}/databases/{db_id}/datacompare/{job_id}/apply", status_code=202)
|
|
162
205
|
def apply(server_id: str, db_id: str, job_id: str, body: ApplyIn):
|
|
163
206
|
"""Run the sync script on the target in one transaction (rolled back on any error)."""
|
|
164
|
-
|
|
207
|
+
run = _run(job_id)
|
|
165
208
|
st = get_state()
|
|
166
209
|
if run.target != (server_id, db_id):
|
|
167
210
|
raise ValueError("This comparison has a different target database")
|
|
@@ -170,7 +213,7 @@ def apply(server_id: str, db_id: str, job_id: str, body: ApplyIn):
|
|
|
170
213
|
"code": "read_only"})
|
|
171
214
|
if not body.confirm:
|
|
172
215
|
raise ValueError("Confirm applying the script to the target database")
|
|
173
|
-
if
|
|
216
|
+
if run.status != "finished":
|
|
174
217
|
raise ValueError("The comparison has not finished")
|
|
175
218
|
if run.applying or run.applied:
|
|
176
219
|
raise ValueError("This script was already applied: compare again")
|
|
@@ -184,12 +227,15 @@ def apply(server_id: str, db_id: str, job_id: str, body: ApplyIn):
|
|
|
184
227
|
try:
|
|
185
228
|
conn = _open(ep)
|
|
186
229
|
try:
|
|
187
|
-
|
|
230
|
+
with statements_on_cancel(conn, lambda: _open(ep)):
|
|
231
|
+
engine.apply_script(run, conn, log)
|
|
188
232
|
run.applied = True
|
|
233
|
+
run.save()
|
|
189
234
|
finally:
|
|
190
235
|
conn.close()
|
|
191
236
|
finally:
|
|
192
237
|
run.applying = False
|
|
193
238
|
|
|
194
|
-
j = st.jobs.start("datasync", f"Apply data sync script to {run.target_name}", server_id, job_fn
|
|
239
|
+
j = st.jobs.start("datasync", f"Apply data sync script to {run.target_name}", server_id, job_fn,
|
|
240
|
+
cancellable=True)
|
|
195
241
|
return j.summary()
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
"""PSQL debugging help (milestone 1.2): trace runs, profiled runs and saved tests of procedures/functions.
|
|
2
2
|
|
|
3
|
-
Every run uses a dedicated attachment and one transaction that is rolled back.
|
|
3
|
+
Every run uses a dedicated attachment and one transaction that is rolled back. A run started with a
|
|
4
|
+
``run_id`` (chosen by the browser) can be cancelled with ``POST .../debug/cancel``: its running
|
|
5
|
+
statement is cancelled from another attachment (``MON$STATEMENTS``), and the request answers 409.
|
|
4
6
|
"""
|
|
5
7
|
|
|
6
8
|
from __future__ import annotations
|
|
7
9
|
|
|
10
|
+
import threading
|
|
11
|
+
import time
|
|
8
12
|
from contextlib import contextmanager
|
|
9
13
|
from typing import Any, Literal
|
|
10
14
|
|
|
11
15
|
from fastapi import APIRouter
|
|
12
|
-
from
|
|
16
|
+
from fastapi.responses import JSONResponse
|
|
17
|
+
from pydantic import BaseModel, Field
|
|
13
18
|
|
|
14
19
|
from ..debug import runner
|
|
15
20
|
from ..debug.psql import PsqlError
|
|
@@ -22,12 +27,47 @@ router = APIRouter(prefix="/api/servers/{server_id}/databases/{db_id}/debug", ta
|
|
|
22
27
|
OType = Literal["procedures", "functions", "block"]
|
|
23
28
|
|
|
24
29
|
|
|
30
|
+
_active: dict[str, dict[str, Any]] = {} # run_id -> where the run is and whether it was cancelled
|
|
31
|
+
_active_lock = threading.Lock()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _owner() -> int | None:
|
|
35
|
+
from ..security.sessions import current_principal
|
|
36
|
+
|
|
37
|
+
p = current_principal.get()
|
|
38
|
+
return p.user_id if p is not None else None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RunCancelled(Exception):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
25
45
|
@contextmanager
|
|
26
|
-
def _dedicated(server_id: str, db_id: str):
|
|
46
|
+
def _dedicated(server_id: str, db_id: str, run_id: str | None = None):
|
|
27
47
|
fbc = get_state().manager._open(server_id, db_id)
|
|
48
|
+
entry = None
|
|
28
49
|
try:
|
|
50
|
+
if run_id:
|
|
51
|
+
cur = fbc.conn.cursor()
|
|
52
|
+
cur.execute("SELECT CURRENT_CONNECTION FROM RDB$DATABASE")
|
|
53
|
+
entry = {"server_id": server_id, "db_id": db_id, "attachment": cur.fetchone()[0],
|
|
54
|
+
"owner": _owner(), "cancelled": False}
|
|
55
|
+
fbc.conn.commit()
|
|
56
|
+
with _active_lock:
|
|
57
|
+
if run_id in _active:
|
|
58
|
+
raise ValueError("A run with this id is already active")
|
|
59
|
+
_active[run_id] = entry
|
|
29
60
|
yield fbc.conn
|
|
61
|
+
if entry is not None and entry["cancelled"]:
|
|
62
|
+
raise RunCancelled()
|
|
63
|
+
except Exception as exc:
|
|
64
|
+
if entry is not None and entry["cancelled"] and not isinstance(exc, RunCancelled):
|
|
65
|
+
raise RunCancelled() from None
|
|
66
|
+
raise
|
|
30
67
|
finally:
|
|
68
|
+
if entry is not None:
|
|
69
|
+
with _active_lock:
|
|
70
|
+
_active.pop(run_id, None)
|
|
31
71
|
try:
|
|
32
72
|
fbc.conn.rollback()
|
|
33
73
|
except Exception: # noqa: BLE001
|
|
@@ -35,6 +75,40 @@ def _dedicated(server_id: str, db_id: str):
|
|
|
35
75
|
fbc.close()
|
|
36
76
|
|
|
37
77
|
|
|
78
|
+
def _cancelled_response() -> JSONResponse:
|
|
79
|
+
return JSONResponse(status_code=409, content={"detail": "The run was cancelled", "code": "cancelled"})
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class CancelIn(BaseModel):
|
|
83
|
+
run_id: str
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@router.post("/cancel")
|
|
87
|
+
def cancel_run(server_id: str, db_id: str, body: CancelIn):
|
|
88
|
+
"""Cancel a running trace, run, profile or test run (started with this ``run_id``)."""
|
|
89
|
+
with _active_lock:
|
|
90
|
+
entry = _active.get(body.run_id)
|
|
91
|
+
if entry is None or entry["owner"] != _owner() or (entry["server_id"], entry["db_id"]) != (server_id, db_id):
|
|
92
|
+
return {"cancelled": False} # already finished (or not this user's run)
|
|
93
|
+
entry["cancelled"] = True
|
|
94
|
+
# The run may be between statements (or not have started its statement yet): retry until a
|
|
95
|
+
# running statement was cancelled or the run has ended.
|
|
96
|
+
deadline = time.time() + 15
|
|
97
|
+
while time.time() < deadline:
|
|
98
|
+
with get_state().manager.meta(server_id, db_id) as conn:
|
|
99
|
+
cur = conn.cursor()
|
|
100
|
+
cur.execute("DELETE FROM MON$STATEMENTS WHERE MON$ATTACHMENT_ID = ? AND MON$STATE <> 0",
|
|
101
|
+
[entry["attachment"]])
|
|
102
|
+
n = cur.rowcount
|
|
103
|
+
conn.commit()
|
|
104
|
+
with _active_lock:
|
|
105
|
+
active = _active.get(body.run_id) is entry
|
|
106
|
+
if n or not active:
|
|
107
|
+
break
|
|
108
|
+
time.sleep(0.2)
|
|
109
|
+
return {"cancelled": True}
|
|
110
|
+
|
|
111
|
+
|
|
38
112
|
def _info(conn, otype: str, name: str | None, sql: str | None) -> dict[str, Any]:
|
|
39
113
|
if otype == "block":
|
|
40
114
|
if not sql or not sql.strip():
|
|
@@ -87,31 +161,43 @@ class RunIn(BaseModel):
|
|
|
87
161
|
inputs: dict[str, str | None] = {}
|
|
88
162
|
watch: list[str] | None = None # variables to trace (default: all)
|
|
89
163
|
max_steps: int = runner.MAX_STEPS
|
|
164
|
+
run_id: str | None = Field(None, max_length=64) # lets the browser cancel the run (POST .../cancel)
|
|
90
165
|
|
|
91
166
|
|
|
92
167
|
@router.post("/trace")
|
|
93
168
|
def trace_run(server_id: str, db_id: str, body: RunIn):
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
169
|
+
try:
|
|
170
|
+
with _dedicated(server_id, db_id, body.run_id) as conn:
|
|
171
|
+
info = _info(conn, body.otype, body.name, body.sql)
|
|
172
|
+
r = runner.trace(conn, info, body.inputs, watch=body.watch, max_steps=body.max_steps,
|
|
173
|
+
block_sql=body.sql if body.otype == "block" else None)
|
|
174
|
+
except RunCancelled:
|
|
175
|
+
return _cancelled_response()
|
|
176
|
+
return r
|
|
98
177
|
|
|
99
178
|
|
|
100
179
|
@router.post("/run")
|
|
101
180
|
def plain_run(server_id: str, db_id: str, body: RunIn):
|
|
102
181
|
"""Call the routine itself (not instrumented), rolled back."""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
182
|
+
try:
|
|
183
|
+
with _dedicated(server_id, db_id, body.run_id) as conn:
|
|
184
|
+
info = _info(conn, body.otype, body.name, body.sql)
|
|
185
|
+
r = runner.run_call(conn, info, body.inputs, block_sql=body.sql if body.otype == "block" else None)
|
|
186
|
+
conn.rollback()
|
|
187
|
+
except RunCancelled:
|
|
188
|
+
return _cancelled_response()
|
|
189
|
+
return r
|
|
108
190
|
|
|
109
191
|
|
|
110
192
|
@router.post("/profile")
|
|
111
193
|
def profile_run(server_id: str, db_id: str, body: RunIn):
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
194
|
+
try:
|
|
195
|
+
with _dedicated(server_id, db_id, body.run_id) as conn:
|
|
196
|
+
info = _info(conn, body.otype, body.name, body.sql)
|
|
197
|
+
r = runner.profile(conn, info, body.inputs, block_sql=body.sql if body.otype == "block" else None)
|
|
198
|
+
except RunCancelled:
|
|
199
|
+
return _cancelled_response()
|
|
200
|
+
return r
|
|
115
201
|
|
|
116
202
|
|
|
117
203
|
# ------------------------------------------------------------------ tests
|
|
@@ -133,6 +219,7 @@ class RunTestsIn(BaseModel):
|
|
|
133
219
|
ids: list[str] | None = None # default: all tests of the routine / database
|
|
134
220
|
otype: Literal["procedures", "functions"] | None = None
|
|
135
221
|
routine: str | None = None
|
|
222
|
+
run_id: str | None = Field(None, max_length=64)
|
|
136
223
|
|
|
137
224
|
|
|
138
225
|
@router.get("/tests")
|
|
@@ -169,8 +256,21 @@ def run_tests(server_id: str, db_id: str, body: RunTestsIn):
|
|
|
169
256
|
tests = [t for t in tests if t.id in set(body.ids)]
|
|
170
257
|
results = []
|
|
171
258
|
infos: dict[tuple[str, str], dict[str, Any] | Exception] = {}
|
|
172
|
-
|
|
259
|
+
try:
|
|
260
|
+
_run_tests(server_id, db_id, body, tests, infos, results, store)
|
|
261
|
+
except RunCancelled:
|
|
262
|
+
return _cancelled_response()
|
|
263
|
+
summary = {s: sum(1 for r in results if r["status"] == s) for s in ("pass", "fail", "error")}
|
|
264
|
+
return {"results": results, "summary": summary, "rolled_back": True}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def _run_tests(server_id: str, db_id: str, body: RunTestsIn, tests: list, infos: dict, results: list,
|
|
268
|
+
store) -> None:
|
|
269
|
+
with _dedicated(server_id, db_id, body.run_id) as conn:
|
|
173
270
|
for t in tests:
|
|
271
|
+
with _active_lock:
|
|
272
|
+
if body.run_id and _active.get(body.run_id, {}).get("cancelled"):
|
|
273
|
+
break
|
|
174
274
|
key = (t.otype, t.routine)
|
|
175
275
|
if key not in infos:
|
|
176
276
|
try:
|
|
@@ -184,7 +284,7 @@ def run_tests(server_id: str, db_id: str, body: RunTestsIn):
|
|
|
184
284
|
else:
|
|
185
285
|
r = runner.run_test(conn, info, t.model_dump())
|
|
186
286
|
r.update(name=t.name, otype=t.otype, routine=t.routine)
|
|
287
|
+
if body.run_id and _active.get(body.run_id, {}).get("cancelled"):
|
|
288
|
+
break # this test was interrupted: its result is not recorded
|
|
187
289
|
store.record(t.id, r["status"])
|
|
188
290
|
results.append(r)
|
|
189
|
-
summary = {s: sum(1 for r in results if r["status"] == s) for s in ("pass", "fail", "error")}
|
|
190
|
-
return {"results": results, "summary": summary, "rolled_back": True}
|
|
@@ -15,3 +15,9 @@ def list_jobs():
|
|
|
15
15
|
@router.get("/{job_id}")
|
|
16
16
|
def get_job(job_id: str):
|
|
17
17
|
return get_state().jobs.get(job_id).summary(with_log=True)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@router.post("/{job_id}/cancel")
|
|
21
|
+
def cancel_job(job_id: str):
|
|
22
|
+
"""Ask a running job to stop; it ends with status "cancelled" shortly after."""
|
|
23
|
+
return get_state().jobs.cancel(job_id).summary(with_log=True)
|
|
@@ -40,8 +40,8 @@ def _major(server_id: str) -> int:
|
|
|
40
40
|
return ops.option_major(svc)
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def _job(kind: str, description: str, server_id: str, fn) -> dict:
|
|
44
|
-
return get_state().jobs.start(kind, description, server_id, fn).summary()
|
|
43
|
+
def _job(kind: str, description: str, server_id: str, fn, cancellable: bool = False) -> dict:
|
|
44
|
+
return get_state().jobs.start(kind, description, server_id, fn, cancellable=cancellable).summary()
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
def _register(server_id: str, name: str | None, path: str, log) -> None:
|
|
@@ -149,7 +149,7 @@ def backup_job(server_id: str, db_id: str, body: BackupIn):
|
|
|
149
149
|
raise ValueError("backup_file (a path on the Firebird server) is required")
|
|
150
150
|
|
|
151
151
|
def run(log):
|
|
152
|
-
with st.manager.service(server_id) as svc:
|
|
152
|
+
with st.manager.service(server_id) as svc, st.manager.detach_on_cancel(server_id, db.path):
|
|
153
153
|
major = ops.option_major(svc)
|
|
154
154
|
if body.target == "server":
|
|
155
155
|
log(f"Backing up {db.path} to {body.backup_file} (on the server)")
|
|
@@ -160,7 +160,7 @@ def backup_job(server_id: str, db_id: str, body: BackupIn):
|
|
|
160
160
|
ops.backup_to_local_file(svc, db.path, dest, body.options, major, log)
|
|
161
161
|
log("Backup completed")
|
|
162
162
|
|
|
163
|
-
return _job("backup", f"Backup {db.name}", server_id, run)
|
|
163
|
+
return _job("backup", f"Backup {db.name}", server_id, run, cancellable=True)
|
|
164
164
|
|
|
165
165
|
|
|
166
166
|
# ==================================================================== restore
|
|
@@ -188,11 +188,19 @@ def _restore_job(server_id: str, description: str, local: Path | None, server_fi
|
|
|
188
188
|
ops.restore_server_file(svc, server_file, database_path, o, major, log)
|
|
189
189
|
log("Restore completed")
|
|
190
190
|
_register(server_id, register_as, database_path, log)
|
|
191
|
+
except ops.RestoreCancelled as exc:
|
|
192
|
+
if exc.created: # gbak created this file, so the half-restored database is ours to drop
|
|
193
|
+
srv = st.store.get(server_id)
|
|
194
|
+
pw = "" if srv.embedded else (st.store.password_for(server_id) or "")
|
|
195
|
+
ops.drop_partial(lambda: connect(srv, database_path, pw), database_path, log)
|
|
196
|
+
raise
|
|
191
197
|
finally:
|
|
192
198
|
if cleanup and local is not None:
|
|
193
199
|
local.unlink(missing_ok=True)
|
|
194
200
|
|
|
195
|
-
|
|
201
|
+
# A restore from a file on the server cannot be stopped: gbak runs inside the server, and the
|
|
202
|
+
# database it restores is in shutdown mode, so its attachment cannot be detached from outside.
|
|
203
|
+
return _job("restore", description, server_id, run, cancellable=local is not None)
|
|
196
204
|
|
|
197
205
|
|
|
198
206
|
@router.post("/maintenance/restore", status_code=202)
|
|
@@ -209,7 +217,8 @@ def restore_job(server_id: str, body: RestoreIn):
|
|
|
209
217
|
async def restore_upload(server_id: str, request: Request, database_path: str, filename: str = "upload.fbk",
|
|
210
218
|
register_as: str | None = None, keep: bool = False, replace: bool = False,
|
|
211
219
|
page_size: int | None = None, buffers: int | None = None,
|
|
212
|
-
deactivate_indexes: bool = False,
|
|
220
|
+
deactivate_indexes: bool = False, no_shadow: bool = False, no_validity: bool = False,
|
|
221
|
+
one_at_a_time: bool = False,
|
|
213
222
|
use_all_space: bool = False, metadata_only: bool = False, read_only: bool = False,
|
|
214
223
|
parallel_workers: int | None = None, skip_data: str | None = None,
|
|
215
224
|
include_data: str | None = None, crypt_plugin: str | None = None,
|
|
@@ -220,7 +229,7 @@ async def restore_upload(server_id: str, request: Request, database_path: str, f
|
|
|
220
229
|
With ``keep=true`` the upload is kept in the fbadmin archive (folder ``uploads``).
|
|
221
230
|
"""
|
|
222
231
|
o = ops.RestoreOptions(replace=replace, page_size=page_size, buffers=buffers,
|
|
223
|
-
deactivate_indexes=deactivate_indexes, no_validity=no_validity,
|
|
232
|
+
deactivate_indexes=deactivate_indexes, no_shadow=no_shadow, no_validity=no_validity,
|
|
224
233
|
one_at_a_time=one_at_a_time, use_all_space=use_all_space, metadata_only=metadata_only,
|
|
225
234
|
read_only=read_only, parallel_workers=parallel_workers, skip_data=skip_data,
|
|
226
235
|
include_data=include_data, crypt_plugin=crypt_plugin, keyholder=keyholder,
|
|
@@ -383,7 +392,8 @@ def validate(server_id: str, db_id: str, body: ValidateIn):
|
|
|
383
392
|
get_state().manager.disconnect(server_id, db_id)
|
|
384
393
|
|
|
385
394
|
def run(log):
|
|
386
|
-
|
|
395
|
+
st = get_state()
|
|
396
|
+
with st.manager.service(server_id) as svc, st.manager.detach_on_cancel(server_id, db.path):
|
|
387
397
|
if body.mode == "online":
|
|
388
398
|
log(f"Online validation of {db.path}")
|
|
389
399
|
out = ops.validate_online(svc, db.path, tables_include=body.tables_include,
|
|
@@ -397,7 +407,8 @@ def validate(server_id: str, db_id: str, body: ValidateIn):
|
|
|
397
407
|
log("No errors reported")
|
|
398
408
|
log("Validation completed")
|
|
399
409
|
|
|
400
|
-
|
|
410
|
+
# interrupting a mend (which changes the database) is not offered; checks only read it
|
|
411
|
+
return _job("validate", f"Validate ({body.mode}) {db.name}", server_id, run, cancellable=body.mode != "mend")
|
|
401
412
|
|
|
402
413
|
|
|
403
414
|
class RepairIn(BaseModel):
|
|
@@ -411,11 +422,12 @@ def sweep(server_id: str, db_id: str, body: RepairIn | None = None):
|
|
|
411
422
|
|
|
412
423
|
def run(log):
|
|
413
424
|
log(f"Sweeping {db.path}")
|
|
414
|
-
|
|
425
|
+
st = get_state()
|
|
426
|
+
with st.manager.service(server_id) as svc, st.manager.detach_on_cancel(server_id, db.path):
|
|
415
427
|
ops.repair(svc, db.path, "sweep", parallel_workers=workers, major=ops.option_major(svc), log=log)
|
|
416
428
|
log("Sweep completed")
|
|
417
429
|
|
|
418
|
-
return _job("sweep", f"Sweep {db.name}", server_id, run)
|
|
430
|
+
return _job("sweep", f"Sweep {db.name}", server_id, run, cancellable=True)
|
|
419
431
|
|
|
420
432
|
|
|
421
433
|
@router.post(DB + "/icu", status_code=202)
|