firebird-admin 2.0.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.0.0 → firebird_admin-2.1.1}/PKG-INFO +2 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/__init__.py +1 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/__main__.py +12 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/__init__.py +2 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/auth.py +2 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/databases.py +48 -11
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/datacompare.py +65 -19
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/debug.py +118 -18
- firebird_admin-2.1.1/fbadmin/api/driver.py +60 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/events.py +3 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/jobs.py +6 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/maintenance.py +33 -18
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/servers.py +7 -6
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/upgrade.py +9 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/app.py +2 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/__init__.py +9 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/backup.py +17 -3
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/common.py +7 -3
- firebird_admin-2.1.1/fbadmin/cli/remote.py +633 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/connections.py +142 -13
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/datacompare/engine.py +355 -33
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/debug/runner.py +32 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/driver_patches.py +97 -3
- firebird_admin-2.1.1/fbadmin/drivers.py +355 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/embedded.py +28 -55
- firebird_admin-2.1.1/fbadmin/jobs.py +214 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/ops.py +68 -3
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/scheduler.py +18 -7
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/svc.py +49 -3
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/verify.py +6 -3
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/catalog.py +50 -7
- firebird_admin-2.1.1/fbadmin/native.py +747 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/access.py +2 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/core.py +13 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/db.py +39 -7
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/wirecompat.py +44 -3
- firebird_admin-2.0.0/fbadmin/static/assets/DataView-DdZPnNg-.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.0.0/fbadmin/static/assets/Monitor-B6DXJrTA.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.0.0 → firebird_admin-2.1.1}/fbadmin/static/index.html +2 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/trial.py +9 -3
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/PKG-INFO +2 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/SOURCES.txt +15 -6
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/requires.txt +3 -1
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/pyproject.toml +6 -2
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_api.py +14 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_cli.py +16 -1
- firebird_admin-2.1.1/tests/test_cli_remote.py +239 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_datacompare.py +148 -0
- firebird_admin-2.1.1/tests/test_driver_auto.py +352 -0
- firebird_admin-2.1.1/tests/test_driver_equivalence.py +193 -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.0.0 → firebird_admin-2.1.1}/tests/test_maintenance.py +8 -3
- firebird_admin-2.1.1/tests/test_native_driver.py +415 -0
- firebird_admin-2.1.1/tests/test_startup_race.py +61 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_upgrade.py +6 -1
- firebird_admin-2.0.0/fbadmin/jobs.py +0 -78
- firebird_admin-2.0.0/fbadmin/native.py +0 -278
- firebird_admin-2.0.0/fbadmin/static/assets/Jobs-BoqpF1pi.js +0 -2
- firebird_admin-2.0.0/fbadmin/static/assets/QueryTool-DYT8ki0h.js +0 -30
- firebird_admin-2.0.0/fbadmin/static/assets/index-CgoPbZ7n.css +0 -1
- firebird_admin-2.0.0/fbadmin/static/assets/index-DSF35GKe.js +0 -156
- firebird_admin-2.0.0/tests/test_native_driver.py +0 -75
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/README.md +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/ai/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/ai/providers.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/alerts/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/alerts/channels.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/alerts/checks.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/alerts/engine.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/alerts/store.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/access.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/admin.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/ai.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/alerts.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/deps.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/embedded.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/fbsecurity.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/library.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/metrics.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/monitoring.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/object_dialogs.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/overview.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/query.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/querybuilder.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/replication.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/schedules.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/schema.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/schema_history.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/storage.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/trace.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/api/version.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/misc.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/registry.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/cli/schema.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/config.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/datacompare/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/datacompare/literals.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/debug/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/debug/psql.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/debug/store.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/desktop.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/events/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/events/monitor.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/events/scan.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/events/wire.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/fb4types.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/library.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/limits.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/logsetup.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/archive.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/cron.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/gstat.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/maintenance/trace.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/catalog_extras.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/ddlgen.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/designer.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/metadata/types.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/middleware.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/advisor.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/history.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/journal.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/metrics.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/overview.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/probes.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/profiler.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/monitoring/replication.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/plugins.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/preconfig.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/query.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/copydata.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/dataio.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/diff.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/extract.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/generator.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/model.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/report.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema/search.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schema_ctx.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/gitrepo.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/schemahistory/layout.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/audit.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/crypto.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/errors.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/fbservices.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/fbsql.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/ldap.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/mfa.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/middleware.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/oidc.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/proxy.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/readonly.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/runas.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/servers.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/sessions.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/settings.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/tokens.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/security/totp.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/serialize.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/sqlsplit.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/assets/codemirror-CQtTaafu.js +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/assets/react-D1VdbdIl.js +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/assets/sql-formatter-BMeiBS2F.js +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/icons/apple-touch-icon.png +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon-192.png +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon-512.png +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/icons/icon.svg +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/static/manifest.webmanifest +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/azure.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/base.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/gcs.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/s3.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/storage/targets.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/store.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/updater.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/__init__.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/checks.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/keywords.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/keywords_data.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/fbadmin/upgrade/plan.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/dependency_links.txt +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/entry_points.txt +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/firebird_admin.egg-info/top_level.txt +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/setup.cfg +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_access.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_access_fb.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_advisor_parse.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_ai.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_alerts.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_ddl_property.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_debug.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_debug_psql.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_driver_patches.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_embedded.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_encryption_plugin.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_engineering.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_events.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_fb4types.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_firebird_qa.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_ldap_real.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_library.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_maintenance_units.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_monitoring.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_objects_03.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_oidc_real.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_overview.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_plugins.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_preconfig.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_query_tool.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_querybuilder.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_replication.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_schema_history.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_schema_tools.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_schemas_fb6.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_security.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_security_fb.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_sqlsplit.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_sqlsplit_fuzz.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_storage.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_storage_real.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_types.py +0 -0
- {firebird_admin-2.0.0 → firebird_admin-2.1.1}/tests/test_updater.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: firebird-admin
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: A pgAdmin-style web administration and development tool for Firebird SQL
|
|
5
5
|
Author: fbadmin contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -22,6 +22,7 @@ Requires-Dist: fastapi>=0.110
|
|
|
22
22
|
Requires-Dist: uvicorn[standard]>=0.27
|
|
23
23
|
Requires-Dist: pydantic>=2.5
|
|
24
24
|
Requires-Dist: firebirdsql>=1.4.5
|
|
25
|
+
Requires-Dist: firebird-driver<3,>=2.0; python_version >= "3.11"
|
|
25
26
|
Requires-Dist: openpyxl>=3.1
|
|
26
27
|
Requires-Dist: cryptography>=42
|
|
27
28
|
Requires-Dist: argon2-cffi>=23.1
|
|
@@ -39,7 +40,6 @@ Requires-Dist: ldap3>=2.9; extra == "ldap"
|
|
|
39
40
|
Provides-Extra: legacy-auth
|
|
40
41
|
Requires-Dist: passlib>=1.7; extra == "legacy-auth"
|
|
41
42
|
Provides-Extra: native
|
|
42
|
-
Requires-Dist: firebird-driver>=1.10; extra == "native"
|
|
43
43
|
Provides-Extra: desktop
|
|
44
44
|
Requires-Dist: pywebview>=5.0; extra == "desktop"
|
|
45
45
|
|
|
@@ -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))
|
|
@@ -31,6 +31,7 @@ from . import library
|
|
|
31
31
|
from . import overview
|
|
32
32
|
from . import querybuilder
|
|
33
33
|
from . import access
|
|
34
|
+
from . import driver as driver_api
|
|
34
35
|
|
|
35
36
|
ROUTERS: list[APIRouter] = [
|
|
36
37
|
servers.router,
|
|
@@ -64,4 +65,5 @@ ROUTERS: list[APIRouter] = [
|
|
|
64
65
|
overview.router,
|
|
65
66
|
querybuilder.router,
|
|
66
67
|
access.router,
|
|
68
|
+
driver_api.router,
|
|
67
69
|
]
|
|
@@ -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}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Server-wide "Database driver" setting: ``auto`` (default), native ``firebird-driver`` or
|
|
2
|
+
pure-Python ``firebirdsql``.
|
|
3
|
+
|
|
4
|
+
``GET /api/driver`` reports the selection, where it comes from (environment, saved setting or
|
|
5
|
+
default), the driver actually used and why (``effective``, ``reason``, ``fallback``) and whether
|
|
6
|
+
the native driver can be used (package, client library and its version).
|
|
7
|
+
``PUT /api/driver`` saves a new selection. Both are for administrators only in server mode (in
|
|
8
|
+
desktop mode the local user is the administrator). See fbadmin/drivers.py and docs/DRIVERS.md.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from fastapi import APIRouter
|
|
14
|
+
from pydantic import BaseModel
|
|
15
|
+
|
|
16
|
+
from .. import drivers
|
|
17
|
+
from ..security.core import require_admin
|
|
18
|
+
from .deps import get_state
|
|
19
|
+
|
|
20
|
+
router = APIRouter(prefix="/api/driver", tags=["driver"])
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class DriverIn(BaseModel):
|
|
24
|
+
driver: str | None = None # "auto", "native" or "firebirdsql"; None keeps the current one
|
|
25
|
+
fbclient: str | None = None # client library path; "" clears it; None keeps it
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@router.get("")
|
|
29
|
+
def get_driver():
|
|
30
|
+
require_admin()
|
|
31
|
+
return drivers.status()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@router.put("")
|
|
35
|
+
def put_driver(body: DriverIn):
|
|
36
|
+
"""Save the driver choice. Pooled metadata connections are closed so new ones use the selected
|
|
37
|
+
driver; open Query Tool sessions keep their connection (and driver) until they are closed."""
|
|
38
|
+
require_admin()
|
|
39
|
+
before_driver = drivers.selected()[0]
|
|
40
|
+
before_effective = drivers.effective()[0]
|
|
41
|
+
before = dict(drivers.stored())
|
|
42
|
+
if body.driver is not None:
|
|
43
|
+
new = drivers.normalize(body.driver)
|
|
44
|
+
if drivers.selected()[1] == "environment" and new != before_driver:
|
|
45
|
+
raise ValueError(f"The driver is set by the environment ({drivers.ENV_DRIVER}); "
|
|
46
|
+
"change it there and restart fbadmin.")
|
|
47
|
+
if body.fbclient is not None and drivers.fbclient_setting()[1] == "environment" \
|
|
48
|
+
and body.fbclient.strip() != (drivers.fbclient_setting()[0] or ""):
|
|
49
|
+
raise ValueError(f"The client library is set by the environment ({drivers.ENV_FBCLIENT}); "
|
|
50
|
+
"change it there and restart fbadmin.")
|
|
51
|
+
drivers.save(driver=body.driver, fbclient=body.fbclient)
|
|
52
|
+
if drivers.selected()[0] == "native":
|
|
53
|
+
nat = drivers.native_status()
|
|
54
|
+
if not nat["available"]:
|
|
55
|
+
drivers.restore(before)
|
|
56
|
+
raise ValueError(f"The native driver cannot be used: {nat['reason']}")
|
|
57
|
+
closed = 0
|
|
58
|
+
if drivers.effective()[0] != before_effective:
|
|
59
|
+
closed = get_state().manager.close_pools()
|
|
60
|
+
return {**drivers.status(), "closed_connections": closed}
|
|
@@ -29,7 +29,9 @@ def _connector(server_id: str, db_id: str):
|
|
|
29
29
|
srv = st.store.get(server_id)
|
|
30
30
|
db = st.store.get_database(server_id, db_id)
|
|
31
31
|
password = st.manager._password(server_id) # 401 before anything is opened
|
|
32
|
-
|
|
32
|
+
# the event monitor speaks the auxiliary-port protocol itself (events/wire.py), on top of
|
|
33
|
+
# firebirdsql's socket: it stays on the pure-Python driver whatever driver is selected
|
|
34
|
+
return lambda: connect(srv, db.path, password, driver="firebirdsql")
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
@router.get("/suggestions")
|
|
@@ -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)
|