queryapigate 0.52.0__tar.gz → 0.53.0__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.
- {queryapigate-0.52.0/queryapigate.egg-info → queryapigate-0.53.0}/PKG-INFO +5 -5
- {queryapigate-0.52.0 → queryapigate-0.53.0}/README.md +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/pyproject.toml +6 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/__init__.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/adminroles.py +6 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/admins.py +8 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/agentwrites.py +26 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/alerts.py +4 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/apikeys.py +9 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/app.py +86 -25
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/bundle.py +34 -17
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/cdcsources.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/cli.py +121 -46
- queryapigate-0.53.0/queryapigate/clidoc.py +92 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/config.py +144 -67
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/configcode.py +34 -12
- queryapigate-0.53.0/queryapigate/console_dist/assets/AccessMapPage-B2fgXnjB.js +2 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/AdministratorsPage-gTTL99VZ.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/AgentsPage-DD5g0r--.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/AlertsPage-CPoX-LrI.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/ApiKeyDetailPage-C4MaGe1f.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/ApiKeysPage-DCRji-0w.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/ApprovalsPage-CHk7uHED.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/AuditLogPage-4qLBj9zn.js +2 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/CachingPage-C6__FvEq.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/CatalogPage-BCIs8MUF.js +3 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/CdcSourcesPage-CYxShRau.js +2 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/CodeBox-BNjg3Ntu.js +5 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/ConnectionsPage-BM8L_7zE.js +4 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/DesignerPage-C13DG7vW.js +4 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/DestinationsPage-DCxE3xZX.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/Experimental-CzCYlw3L.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/ExportsPage-xzu1RflJ.js +1 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/HelpPage-BKnEzwAb.js → queryapigate-0.53.0/queryapigate/console_dist/assets/HelpPage-DY0w7k3J.js +2 -2
- queryapigate-0.53.0/queryapigate/console_dist/assets/HomePage-DR63y7U4.js +4 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/KeyActivity-a3QDao6f.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/Managed-D2DQQSxx.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/McpPage-xAz6EJPw.js +8 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/MetricsPage-Bo5ng5Wk.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/PageTitle-D3gn6RQm.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/Popover-1u5AL0Xi.js +1 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/QueryInfo--z9ZqXkQ.js → queryapigate-0.53.0/queryapigate/console_dist/assets/QueryInfo-rJFJMxQh.js +2 -2
- queryapigate-0.53.0/queryapigate/console_dist/assets/RepositoryPage-9BuJ7kpg.js +4 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/Results-CxkMrmv4.js → queryapigate-0.53.0/queryapigate/console_dist/assets/Results-CCSSPc8I.js +2 -2
- queryapigate-0.53.0/queryapigate/console_dist/assets/RolesPage-BDA4aTcK.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/SchemaBrowser-CKo8Uqlb.js +13 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/SettingsPage-D7-XFD6b.js +3 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/StatTile-Cft4kJPH.js → queryapigate-0.53.0/queryapigate/console_dist/assets/StatTile-5belOp8P.js +2 -2
- queryapigate-0.53.0/queryapigate/console_dist/assets/Time-B4F0EKt4.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/WorkspacesPage-BSDQ-34V.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/api-BGxrpPPD.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/data-BaZ7Pk4n.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/forms-C7YTnxLE.js +1 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/forms-Daj5x4ru.js → queryapigate-0.53.0/queryapigate/console_dist/assets/forms-DW_bgAgp.js +2 -2
- queryapigate-0.53.0/queryapigate/console_dist/assets/grantSort-D_V8ssgl.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/index-Cmfet26n.js +12 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/index-DdBLsNzW.css +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/maskRules-L7dUzZ5J.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/reach-CZ8SDAUE.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/shared-C1FQskYm.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/useMutation-DnH3aLVa.js +1 -0
- queryapigate-0.53.0/queryapigate/console_dist/assets/useTableControls-DNgJhbY_.js +1 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/console_dist/index.html +3 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/definitions.py +2 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/deprecations.py +6 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/destinations.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/events.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/examples.py +295 -85
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/experimental.py +2 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/exports.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/formats.py +94 -20
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/history.py +13 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/mcp_server.py +44 -12
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/metrics.py +11 -8
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/openapi.py +69 -10
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/rekey.py +6 -6
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/secretrefs.py +22 -8
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/access.py +22 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/administrators.py +2 -1
- queryapigate-0.53.0/queryapigate/services/audit.py +80 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/collections.py +22 -10
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/connections.py +8 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/queries.py +29 -4
- queryapigate-0.53.0/queryapigate/settingnames.py +63 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/sqlflow.py +34 -6
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/store.py +17 -14
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/tableguard.py +7 -0
- queryapigate-0.53.0/queryapigate/toolnames.py +64 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/usage.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/v1.py +58 -13
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/v1_spec.py +92 -26
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/workspaces.py +17 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0/queryapigate.egg-info}/PKG-INFO +5 -5
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate.egg-info/SOURCES.txt +50 -43
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate.egg-info/requires.txt +3 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_adminroles.py +5 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_admins.py +11 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_agent_writes.py +51 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_api_keys.py +42 -15
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_api_v1.py +172 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_audit_log.py +3 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_aws.py +5 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_backup_restore.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_cdc_sources.py +3 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_cli.py +76 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_collection_bundle.py +61 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_collections.py +45 -15
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_configcode.py +94 -6
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_connection_encryption.py +54 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_cors_and_rate_limit.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_data_protection.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_dependency_floors.py +4 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_deprecations.py +25 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_descriptions.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_destinations.py +2 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_duckdb_files.py +2 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_errors.py +3 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_examples.py +204 -9
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_export_security.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_helm.py +1 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_integration.py +65 -5
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_jwt.py +2 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_key_rotation.py +11 -6
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_limits.py +4 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_live.py +2 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_mcp.py +65 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_mcp_oauth.py +3 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_observability.py +12 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_query_window.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_queryapigate.py +86 -4
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_quotas.py +9 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_rekey.py +6 -5
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_roles.py +9 -5
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_secretrefs.py +20 -6
- queryapigate-0.53.0/tests/test_settings_index.py +55 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_sqlflow.py +22 -3
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_vault.py +1 -1
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_local_files.py +4 -2
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_secret_refs.py +3 -0
- queryapigate-0.52.0/queryapigate/console_dist/assets/AccessMapPage-BLTtrvV7.js +0 -2
- queryapigate-0.52.0/queryapigate/console_dist/assets/AdministratorsPage-gWX1epBr.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/AgentsPage-CQCw6zsv.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/AlertsPage-Dcs615rM.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/ApiKeyDetailPage-CTdAD9mo.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/ApiKeysPage-DrydnYjp.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/ApprovalsPage-0cJWRfX2.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/AuditLogPage-BKUfkk9p.js +0 -2
- queryapigate-0.52.0/queryapigate/console_dist/assets/CachingPage-D9z2sT0j.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/CdcSourcesPage-ColAZA6a.js +0 -2
- queryapigate-0.52.0/queryapigate/console_dist/assets/CodeBox-Cwh5KHLp.js +0 -5
- queryapigate-0.52.0/queryapigate/console_dist/assets/ConnectionsPage-DDzYECYe.js +0 -4
- queryapigate-0.52.0/queryapigate/console_dist/assets/DesignerPage-CUtj9F6J.js +0 -4
- queryapigate-0.52.0/queryapigate/console_dist/assets/DestinationsPage-jEO9uCHi.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/Experimental-B3dnaeV7.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/ExportsPage-B1BcJ83k.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/HomePage-CU0QeQNe.js +0 -4
- queryapigate-0.52.0/queryapigate/console_dist/assets/KeyActivity-BhV8qZ-p.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/Managed-C6wP4b1l.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/McpPage-CvjuiKZV.js +0 -8
- queryapigate-0.52.0/queryapigate/console_dist/assets/MetricsPage-Cv2y-OBV.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/RepositoryPage-Dx-NdAHu.js +0 -4
- queryapigate-0.52.0/queryapigate/console_dist/assets/RolesPage-BwJqzmix.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/SchemaBrowser-C-910PNM.js +0 -13
- queryapigate-0.52.0/queryapigate/console_dist/assets/SettingsPage-CahRTpCG.js +0 -3
- queryapigate-0.52.0/queryapigate/console_dist/assets/Time-1LzS0WOr.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/WorkspacesPage-QhgHD8D7.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/api-Culg17uJ.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/client-ZHNiMG8H.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/forms-CietEOlU.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/icons-CFXE8hAz.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/index-Cv64XKNs.css +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/index-zWukbTre.js +0 -12
- queryapigate-0.52.0/queryapigate/console_dist/assets/maskRules-CvKQIPgN.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/reach-BAOLd75Y.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/shared-DZEj-9yA.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/state-O13cl7cO.js +0 -1
- queryapigate-0.52.0/queryapigate/console_dist/assets/useMutation-kSEF_Amb.js +0 -1
- queryapigate-0.52.0/queryapigate/services/audit.py +0 -38
- {queryapigate-0.52.0 → queryapigate-0.53.0}/LICENSE +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/NOTICE +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/__main__.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/accesslog.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/auditchain.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/auditstream.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/aws.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/broadcast.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/cache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/collection_admin.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/console.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/console_dist/favicon.svg +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/cors.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/databases.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/dataplane.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/db.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/descriptions.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/duckfiles.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/embeddings.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/engine.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/errors.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/exporting.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/governance.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/gunicorn_conf.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/instances.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/jwtauth.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/lib/h2-2.2.224.jar +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/limits.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/live.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/logging_setup.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/masking.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/metacache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/mongodocs.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/mongotools.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/oidc.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/params.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/parquet.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/pool.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/postman.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/quotas.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/ratelimit.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/rediscache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/runners.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/runstore.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/schema.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/scope.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/secheaders.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/__init__.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/cdc_sources.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/descriptions.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/destinations.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/exports.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/mcp.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/services/workspaces.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/sqltools.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/sso.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/tracing.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate/vault.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate.egg-info/dependency_links.txt +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate.egg-info/entry_points.txt +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/queryapigate.egg-info/top_level.txt +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/setup.cfg +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_adhoc_history.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_alerts.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_api_administrators.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_audit_chain.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_audit_siem.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_audit_stream.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_broadcast.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_collection_postman.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_console.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_databases.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_dataplane.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_db.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_docs_site.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_duckdb.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_embeddings.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_events.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_events_server.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_experimental.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_exporting.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_exports.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_fips.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_history.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_howto.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_instances.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_jdbc.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_live_cache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_live_debezium.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_masking.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_masking_requests.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_mcp_keycloak.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_metacache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_mongo_streaming.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_mongotools.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_multinode.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_oidc.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_params.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_parquet.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_pool.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_publishing.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_release_check.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_response_cache.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_rolling_upgrade.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_runstore.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_runstore_differential.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_security_headers.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_settings.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_shared_rate_limit.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_shutdown.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_sql_guard_fuzz.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_sql_guard_writes.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_sso.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_sso_keycloak.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_supply_chain.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_tableguard.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_tracing.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_upgrades.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_usage.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_config_cli.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_isolation.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_observability.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspace_store.py +0 -0
- {queryapigate-0.52.0 → queryapigate-0.53.0}/tests/test_workspaces_api.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: queryapigate
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.53.0
|
|
4
4
|
Summary: Turn SQL into governed REST APIs over MySQL, PostgreSQL, ClickHouse, SQLite, DuckDB, H2, MongoDB, and Parquet/CSV/JSON files - JSON, CSV, Parquet or Excel out, with scoped keys, an admin Console and MCP for AI agents.
|
|
5
5
|
Author-email: Anantha Raju C <arcswdev@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -31,11 +31,11 @@ Requires-Dist: Werkzeug>=3.0
|
|
|
31
31
|
Requires-Dist: PyYAML>=6.0.1
|
|
32
32
|
Requires-Dist: openpyxl>=3.1
|
|
33
33
|
Provides-Extra: mysql
|
|
34
|
-
Requires-Dist: mysql-connector-python>=
|
|
34
|
+
Requires-Dist: mysql-connector-python>=9.1.0; extra == "mysql"
|
|
35
35
|
Provides-Extra: postgres
|
|
36
36
|
Requires-Dist: psycopg2-binary>=2.9.5; extra == "postgres"
|
|
37
37
|
Provides-Extra: clickhouse
|
|
38
|
-
Requires-Dist: clickhouse-driver>=0.2; extra == "clickhouse"
|
|
38
|
+
Requires-Dist: clickhouse-driver>=0.2.4; extra == "clickhouse"
|
|
39
39
|
Provides-Extra: h2
|
|
40
40
|
Requires-Dist: JayDeBeApi>=1.2; extra == "h2"
|
|
41
41
|
Requires-Dist: JPype1>=1.4; extra == "h2"
|
|
@@ -61,7 +61,7 @@ Provides-Extra: otel
|
|
|
61
61
|
Requires-Dist: opentelemetry-sdk>=1.27; extra == "otel"
|
|
62
62
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.27; extra == "otel"
|
|
63
63
|
Provides-Extra: server
|
|
64
|
-
Requires-Dist: gunicorn>=
|
|
64
|
+
Requires-Dist: gunicorn>=23; extra == "server"
|
|
65
65
|
Provides-Extra: aws
|
|
66
66
|
Requires-Dist: boto3>=1.28; extra == "aws"
|
|
67
67
|
Provides-Extra: docs
|
|
@@ -250,7 +250,7 @@ SQLite needs no extra driver. H2 and generic JDBC connections (`queryapigate[h2]
|
|
|
250
250
|
driver jar is bundled, a JDBC connection to another vendor brings its own. DuckDB (`queryapigate[duckdb]`) needs no
|
|
251
251
|
external runtime either - it's a native Python extension, same as SQLite. `queryapigate[encryption]` adds
|
|
252
252
|
[encryption at rest](documentation/API.md#encryption-at-rest-for-connection-passwords) for connection passwords -
|
|
253
|
-
only needed if you set `
|
|
253
|
+
only needed if you set `QUERYAPIGATE_ENCRYPTION_KEY`.
|
|
254
254
|
From a clone: `pip install -e ".[dev]"`. Or use Docker - see [below](#try-it-with-docker).
|
|
255
255
|
|
|
256
256
|
## Quick start
|
|
@@ -169,7 +169,7 @@ SQLite needs no extra driver. H2 and generic JDBC connections (`queryapigate[h2]
|
|
|
169
169
|
driver jar is bundled, a JDBC connection to another vendor brings its own. DuckDB (`queryapigate[duckdb]`) needs no
|
|
170
170
|
external runtime either - it's a native Python extension, same as SQLite. `queryapigate[encryption]` adds
|
|
171
171
|
[encryption at rest](documentation/API.md#encryption-at-rest-for-connection-passwords) for connection passwords -
|
|
172
|
-
only needed if you set `
|
|
172
|
+
only needed if you set `QUERYAPIGATE_ENCRYPTION_KEY`.
|
|
173
173
|
From a clone: `pip install -e ".[dev]"`. Or use Docker - see [below](#try-it-with-docker).
|
|
174
174
|
|
|
175
175
|
## Quick start
|
|
@@ -31,15 +31,17 @@ classifiers = [
|
|
|
31
31
|
dependencies = ["Flask>=3.0", "Werkzeug>=3.0", "PyYAML>=6.0.1", "openpyxl>=3.1"]
|
|
32
32
|
|
|
33
33
|
[project.optional-dependencies]
|
|
34
|
-
mysql = ["mysql-connector-python>=
|
|
34
|
+
mysql = ["mysql-connector-python>=9.1.0"] # 9.0.0 and earlier: CVE-2024-21272 (CVSS 7.5)
|
|
35
35
|
postgres = ["psycopg2-binary>=2.9.5"] # 2.9.5 is the first with wheels for Python 3.11, the oldest supported
|
|
36
|
-
clickhouse = ["clickhouse-driver>=0.2"]
|
|
36
|
+
clickhouse = ["clickhouse-driver>=0.2.4"] # 0.2.4 is the first with wheels for Python 3.11
|
|
37
37
|
h2 = ["JayDeBeApi>=1.2", "JPype1>=1.4"] # also needs a Java runtime
|
|
38
38
|
duckdb = ["duckdb>=1.2"] # allowed_directories/allowed_paths, which lock every connection (duckfiles.py), arrived in 1.2
|
|
39
39
|
mongo = ["pymongo>=4.0"]
|
|
40
40
|
trino = ["trino>=0.330"] # the trino DB-API client (runners._Trino); experimental, ADR 0026
|
|
41
41
|
flow = ["sqlglot>=25.2,<31"] # the Access tab's tables and joins (sqlflow.py) and column masking's tracing (masking.py)
|
|
42
|
-
encryption = ["cryptography>=41"] # only needed when
|
|
42
|
+
encryption = ["cryptography>=41"] # only needed when QUERYAPIGATE_ENCRYPTION_KEY is set - see store.py's _get_fernet().
|
|
43
|
+
# 41, what the FIPS image's distribution ships: its later advisories (PKCS#7, PKCS#12, RSA decryption) are in code
|
|
44
|
+
# Fernet and PyJWT's signature checks don't reach
|
|
43
45
|
redis = ["redis>=5"] # only needed when QUERYAPIGATE_REDIS_URL is set - see rediscache.py
|
|
44
46
|
mcp = ["mcp>=1.21.1,<2"] # only needed for `queryapigate mcp` - see mcp_server.py. Structured tool output arrived
|
|
45
47
|
# in 1.10, but nothing before 1.21.1 can be imported beside the pydantic pip installs
|
|
@@ -50,7 +52,7 @@ jwt = ["PyJWT[crypto]>=2.14"] # only needed when QUERYAPIGATE_JWT_SECRET or QUE
|
|
|
50
52
|
all = ["queryapigate[mysql,postgres,clickhouse,h2,duckdb,mongo,trino,flow,encryption,jwt]"]
|
|
51
53
|
# only needed when an OTLP endpoint is set (OTEL_EXPORTER_OTLP_ENDPOINT) - see tracing.py
|
|
52
54
|
otel = ["opentelemetry-sdk>=1.27", "opentelemetry-exporter-otlp-proto-http>=1.27"]
|
|
53
|
-
server = ["gunicorn>=
|
|
55
|
+
server = ["gunicorn>=23"] # 22 and 23 fixed request smuggling (CVE-2024-1135, CVE-2024-6827); the image runs 26+
|
|
54
56
|
# only needed for ${aws-sm:...} and aws-rds-iam credentials (ADR 0015) - see aws.py. 1.28 is the floor because that is
|
|
55
57
|
# where boto3 reads AWS_ENDPOINT_URL_<SERVICE> (a VPC endpoint, or a local stand-in).
|
|
56
58
|
aws = ["boto3>=1.28"]
|
|
@@ -21,7 +21,7 @@ CAPABILITIES = {
|
|
|
21
21
|
'access.write': 'create, change and delete API keys and roles',
|
|
22
22
|
'cache.read': 'read cached responses',
|
|
23
23
|
'cache.write': 'clear cached responses',
|
|
24
|
-
'examples.write': 'load and remove the bundled example APIs',
|
|
24
|
+
'examples.write': 'load and remove the bundled example APIs, with their workspace and its administrators',
|
|
25
25
|
'observe': 'read the audit log, run history, alerts, instances and MCP status',
|
|
26
26
|
'settings.read': "read the server's settings",
|
|
27
27
|
'secrets.rotate': 're-encrypt stored passwords under a new encryption key (ADR 0009)',
|
|
@@ -41,8 +41,10 @@ CAPABILITIES = {
|
|
|
41
41
|
|
|
42
42
|
# What only a server-wide role gives (ADR 0023 §3): the server itself, and the people who run it. A role from a
|
|
43
43
|
# workspace membership is that role without these - whatever it is called, it administers one workspace.
|
|
44
|
+
# (config.apply isn't one: a workspace's owner applies its file.) examples.write is: the examples make a workspace and
|
|
45
|
+
# administrators.
|
|
44
46
|
SERVER_ONLY = frozenset({'admins.read', 'admins.write', 'settings.read', 'secrets.rotate', 'history.forget',
|
|
45
|
-
'workspaces.read', 'workspaces.write'
|
|
47
|
+
'workspaces.read', 'workspaces.write', 'examples.write'})
|
|
46
48
|
|
|
47
49
|
_EVERYONE = {'queries.read', 'connections.read', 'observe', 'self'}
|
|
48
50
|
ROLES = {
|
|
@@ -52,6 +54,8 @@ ROLES = {
|
|
|
52
54
|
'auditor': _EVERYONE | {'access.read', 'settings.read', 'exports.read', 'workspaces.read'},
|
|
53
55
|
}
|
|
54
56
|
ROLES['admin'] -= {'workspaces.write'} # like administrators: who belongs where is an owner's to decide
|
|
57
|
+
# The examples make a workspace and administrators with admin tokens (examples.py): an owner's, as those are.
|
|
58
|
+
ROLES['admin'] -= {'examples.write'}
|
|
55
59
|
|
|
56
60
|
# Which roles may run SQL - ad-hoc or saved - on every connection, as the shared key can. An auditor reads what
|
|
57
61
|
# happened and needs no rows.
|
|
@@ -24,7 +24,9 @@ from .db import DEFAULT_WORKSPACE
|
|
|
24
24
|
from .errors import ApiError
|
|
25
25
|
|
|
26
26
|
TOKEN_PREFIX = 'qagadm_'
|
|
27
|
-
|
|
27
|
+
# The shared key's, the CLI's and start-up's names in the audit log, and the examples' author: an administrator the
|
|
28
|
+
# examples make is marked by `created_by` being that name (examples.py), so no administrator may act under it.
|
|
29
|
+
RESERVED_NAMES = {'admin', 'cli', 'startup', '-', 'queryapigate-examples'}
|
|
28
30
|
_EMAIL_RE = re.compile(r'^[^@\s]+@[^@\s]+$')
|
|
29
31
|
_UNSET = object()
|
|
30
32
|
_USE_RECORD_INTERVAL = 60.0 # seconds between last_used_at/last_seen_at writes per token, as for API keys
|
|
@@ -161,9 +163,10 @@ def update_admin(name, role=_UNSET, email=_UNSET, active=None):
|
|
|
161
163
|
return admin
|
|
162
164
|
|
|
163
165
|
|
|
164
|
-
def delete_admin(name):
|
|
166
|
+
def delete_admin(name, check_owner=True):
|
|
165
167
|
"""Remove an administrator, every token it holds and its workspace memberships. Its name stays in the audit log
|
|
166
|
-
as written.
|
|
168
|
+
as written. `check_owner=False` is for the examples' own administrators (examples.unload()): never owners
|
|
169
|
+
server-wide, so removing one can't be what leaves the server without one."""
|
|
167
170
|
with db.transaction() as conn:
|
|
168
171
|
if _get(conn, name) is None:
|
|
169
172
|
raise ApiError(f"No administrator named '{name}'", 404, code='admin_not_found')
|
|
@@ -171,7 +174,8 @@ def delete_admin(name):
|
|
|
171
174
|
conn.execute('DELETE FROM workspace_members WHERE admin_name = ?', (name,)) # their roles in workspaces too
|
|
172
175
|
_end_sessions(conn, name)
|
|
173
176
|
conn.execute('DELETE FROM administrators WHERE name = ?', (name,))
|
|
174
|
-
|
|
177
|
+
if check_owner:
|
|
178
|
+
_refuse_ownerless(conn)
|
|
175
179
|
|
|
176
180
|
|
|
177
181
|
# --------------------------------------------------------------------------------------
|
|
@@ -68,14 +68,36 @@ def get(request_id):
|
|
|
68
68
|
return _row(row)
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def list_requests(status=None, limit=200):
|
|
71
|
+
def list_requests(status=None, limit=200, cursor=None):
|
|
72
|
+
"""A page of requests, newest first, and the cursor of the next page or None (rc1, B13: before, the newest 200
|
|
73
|
+
and no way to the rest)."""
|
|
74
|
+
from .services import audit
|
|
72
75
|
if status not in (None, '') and status not in STATUSES:
|
|
73
76
|
raise ApiError(f"status must be one of: {', '.join(STATUSES)}", code='invalid_filter')
|
|
74
|
-
|
|
77
|
+
# Filtered before the limit, not after: the newest `limit` of every status, filtered afterwards, could leave out
|
|
78
|
+
# an older request still pending approval. `expired` isn't stored - it is a pending or approved one past its time
|
|
79
|
+
# (_row) - so the filter says the same here.
|
|
80
|
+
where, args, now = '', [], time.time()
|
|
81
|
+
if status in ('pending', 'approved'):
|
|
82
|
+
where, args = ' AND status = ? AND expires_at >= ?', [status, now]
|
|
83
|
+
elif status == 'expired':
|
|
84
|
+
where, args = " AND (status = 'expired' OR (status IN ('pending', 'approved') AND expires_at < ?))", [now]
|
|
85
|
+
elif status:
|
|
86
|
+
where, args = ' AND status = ?', [status]
|
|
87
|
+
if cursor:
|
|
88
|
+
created, request_id = audit.decode_cursor(
|
|
89
|
+
cursor, lambda v: isinstance(v, list) and len(v) == 2 and all(isinstance(x, str) for x in v))
|
|
90
|
+
where += ' AND (created_at < ? OR (created_at = ? AND id < ?))'
|
|
91
|
+
args += [created, created, request_id]
|
|
92
|
+
limit = audit.page_limit(limit, 200)
|
|
93
|
+
rows = db.connection().execute(f'SELECT {_COLUMNS} FROM write_requests WHERE workspace = ?{where} '
|
|
75
94
|
'ORDER BY created_at DESC, id DESC LIMIT ?',
|
|
76
|
-
(scope.current(),
|
|
95
|
+
(scope.current(), *args, limit + 1)).fetchall()
|
|
77
96
|
found = [_row(r) for r in rows]
|
|
78
|
-
|
|
97
|
+
more = len(found) > limit
|
|
98
|
+
found = found[:limit]
|
|
99
|
+
next_cursor = audit.encode_cursor([rows[limit - 1]['created_at'], rows[limit - 1]['id']]) if more else None
|
|
100
|
+
return [r for r in found if not status or r['status'] == status], next_cursor
|
|
79
101
|
|
|
80
102
|
|
|
81
103
|
def approval_url(request_id):
|
|
@@ -105,7 +105,7 @@ def _sso():
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
def _encryption():
|
|
108
|
-
"""
|
|
108
|
+
"""QUERYAPIGATE_ENCRYPTION_KEY lists more than one key: a rotation was started (ADR 0009) and isn't finished -
|
|
109
109
|
passwords are still under an old key (run rekey), or none are (remove the old keys)."""
|
|
110
110
|
if len(config.secret_keys()) < 2:
|
|
111
111
|
return []
|
|
@@ -116,12 +116,12 @@ def _encryption():
|
|
|
116
116
|
if old:
|
|
117
117
|
return [_alert('warning', 'encryption_key_rotation_incomplete', 'secret_key',
|
|
118
118
|
f"{_plural(old, 'password')} {'is' if old == 1 else 'are'} still encrypted with an old key",
|
|
119
|
-
'
|
|
119
|
+
'QUERYAPIGATE_ENCRYPTION_KEY lists several keys, so a rotation has started. Run `queryapigate '
|
|
120
120
|
'rekey` to re-encrypt them with the first key, then remove the others.', target)]
|
|
121
121
|
return [_alert('info', 'encryption_key_rotation_incomplete', 'secret_key',
|
|
122
122
|
'Every password is under the new encryption key - remove the old ones',
|
|
123
|
-
f"
|
|
124
|
-
'the first. Remove the others from every instance to finish the rotation.', target)]
|
|
123
|
+
f"QUERYAPIGATE_ENCRYPTION_KEY still lists {found['keys']} keys, but nothing is encrypted with any "
|
|
124
|
+
'but the first. Remove the others from every instance to finish the rotation.', target)]
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
def _secret_providers():
|
|
@@ -232,6 +232,15 @@ def _upsert(conn, name, entry, workspace=None):
|
|
|
232
232
|
entry.get('expires_at'), entry.get('created_at') or store.now(), json.dumps(details)))
|
|
233
233
|
|
|
234
234
|
|
|
235
|
+
def require_connections(connections):
|
|
236
|
+
"""A new key or role names its connections (rc1, B1): left out, it used to mean every connection - the widest
|
|
237
|
+
grant there is, given by silence, while every other grant left out gives nothing. Stored keys and roles keep
|
|
238
|
+
what they hold; only a create (the API, the CLI, a configuration file) is refused."""
|
|
239
|
+
if connections is None:
|
|
240
|
+
raise ApiError('connections is required: a list of connection names, [] for none (saved queries only), or '
|
|
241
|
+
f'"{ALL_CONNECTIONS}" for every connection', code='invalid_body')
|
|
242
|
+
|
|
243
|
+
|
|
235
244
|
def _normalize_connections(connections):
|
|
236
245
|
if connections in (None, ALL_CONNECTIONS):
|
|
237
246
|
return ALL_CONNECTIONS
|
|
@@ -52,6 +52,7 @@ from . import (
|
|
|
52
52
|
schema,
|
|
53
53
|
scope,
|
|
54
54
|
secheaders,
|
|
55
|
+
settingnames,
|
|
55
56
|
sqltools,
|
|
56
57
|
sso,
|
|
57
58
|
store,
|
|
@@ -144,10 +145,12 @@ def load_examples_at_startup():
|
|
|
144
145
|
log.warning('QUERYAPIGATE_LOAD_EXAMPLES is set but the examples could not be loaded (unexpected error: %s)',
|
|
145
146
|
error, exc_info=True)
|
|
146
147
|
return
|
|
147
|
-
if added
|
|
148
|
+
if examples.added_anything(added):
|
|
148
149
|
store.record_audit('startup', 'load_examples', 'examples', examples.redact_for_audit(added))
|
|
149
|
-
log.info('Loaded the example APIs: %d queries, %d roles, %d API keys
|
|
150
|
-
|
|
150
|
+
log.info('Loaded the example APIs: %d queries, %d roles, %d API keys, and the %s workspace with %d members',
|
|
151
|
+
len(added['queries']) + len(added['workspace']['queries']),
|
|
152
|
+
len(added['roles']) + len(added['workspace']['roles']), len(added['key_secrets']),
|
|
153
|
+
examples.WORKSPACE, len(added['workspace']['members']))
|
|
151
154
|
if added['key_secrets']:
|
|
152
155
|
# There is no interactive terminal at startup to hand these to (unlike `queryapigate examples
|
|
153
156
|
# load`'s own stdout) and a secret is never recoverable once created - the log is the only
|
|
@@ -157,20 +160,25 @@ def load_examples_at_startup():
|
|
|
157
160
|
# rotates away.
|
|
158
161
|
log.warning('Example API keys were just created - store these now, they cannot be shown again: %s',
|
|
159
162
|
', '.join(f'{name}={secret}' for name, secret in sorted(added['key_secrets'].items())))
|
|
163
|
+
if added['admin_tokens']:
|
|
164
|
+
# The same reasoning: the example workspace's members sign in to the Console with these, and only these.
|
|
165
|
+
log.warning('Admin tokens for the %s workspace\'s example members were just created - store these now, '
|
|
166
|
+
'they cannot be shown again: %s', examples.WORKSPACE,
|
|
167
|
+
', '.join(f'{name}={secret}' for name, secret in sorted(added['admin_tokens'].items())))
|
|
160
168
|
|
|
161
169
|
|
|
162
170
|
def warn_env_references():
|
|
163
|
-
"""Once at startup: ${VAR} references in use with no QUERYAPIGATE_SECRET_ENV_VARS
|
|
164
|
-
|
|
171
|
+
"""Once at startup: ${VAR} references in use with no QUERYAPIGATE_SECRET_ENV_VARS. Unset, none is read (rc1, B2:
|
|
172
|
+
before, any could be, but the few secretrefs.py always refuses - ADR 0017), so the connections and destinations that
|
|
173
|
+
use them fail until it's set: the log names the setting that brings them back."""
|
|
165
174
|
from . import destinations, secretrefs
|
|
166
175
|
if config.secret_env_vars():
|
|
167
176
|
return
|
|
168
177
|
used = secretrefs.env_variables([*store.read_connections().values(), *destinations.list_all()])
|
|
169
178
|
if used:
|
|
170
|
-
log.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
', '.join(used))
|
|
179
|
+
log.error('Connections and destinations reference environment variables (%s), and QUERYAPIGATE_SECRET_ENV_VARS '
|
|
180
|
+
'is unset: no ${VAR} is read without it, so they fail until it is set. To keep them working, set '
|
|
181
|
+
'QUERYAPIGATE_SECRET_ENV_VARS=%s', ', '.join(used), ','.join(used))
|
|
174
182
|
|
|
175
183
|
|
|
176
184
|
class _CapturePeer:
|
|
@@ -219,6 +227,11 @@ def create_app():
|
|
|
219
227
|
from . import __version__
|
|
220
228
|
config.check_settings()
|
|
221
229
|
logging_setup.configure(log) # before anything below logs - the legacy import's deprecation warning, for one
|
|
230
|
+
unknown = settingnames.unknown(os.environ, config.SECRET_SETTINGS)
|
|
231
|
+
if unknown: # a typo is ignored otherwise, and what was meant runs with its default (rc1, D1)
|
|
232
|
+
log.warning('%s %s no setting of this server, and %s ignored - see documentation/CONFIGURATION.md for every '
|
|
233
|
+
'one', ', '.join(unknown), 'is' if len(unknown) == 1 else 'are',
|
|
234
|
+
'it is' if len(unknown) == 1 else 'they are')
|
|
222
235
|
db.init_schema()
|
|
223
236
|
runstore.check_marker()
|
|
224
237
|
store.refuse_legacy_home()
|
|
@@ -265,29 +278,29 @@ def create_app():
|
|
|
265
278
|
'create an owner with `queryapigate admins create NAME --role owner`.')
|
|
266
279
|
if config.secret_key():
|
|
267
280
|
# Encrypt any literal password already on disk immediately, rather than waiting for its next
|
|
268
|
-
# PATCH /api/v1/connections - a connection saved before
|
|
281
|
+
# PATCH /api/v1/connections - a connection saved before QUERYAPIGATE_ENCRYPTION_KEY existed benefits right away.
|
|
269
282
|
store.encrypt_plaintext_passwords_in_place()
|
|
270
283
|
from . import rekey
|
|
271
284
|
found = rekey.report()
|
|
272
285
|
if found['undecryptable']:
|
|
273
|
-
log.warning('No key in
|
|
286
|
+
log.warning('No key in QUERYAPIGATE_ENCRYPTION_KEY decrypts the secret of %s - add the key it was '
|
|
274
287
|
'encrypted with (after the first), or enter it again.',
|
|
275
288
|
', '.join(rekey.describe(v) for v in found['undecryptable']))
|
|
276
289
|
if found['under_old_keys']:
|
|
277
|
-
log.warning('%d password(s) are still encrypted with an old key in
|
|
290
|
+
log.warning('%d password(s) are still encrypted with an old key in QUERYAPIGATE_ENCRYPTION_KEY - run '
|
|
278
291
|
'`queryapigate rekey` to move them to the first key, then remove the others.',
|
|
279
292
|
found['under_old_keys'])
|
|
280
293
|
else:
|
|
281
294
|
encrypted = store.encrypted_password_connections()
|
|
282
295
|
if encrypted:
|
|
283
|
-
log.warning('Connection(s) %s have an encrypted password but
|
|
296
|
+
log.warning('Connection(s) %s have an encrypted password but QUERYAPIGATE_ENCRYPTION_KEY is not set - '
|
|
284
297
|
'they cannot be used until the key that encrypted them is restored.',
|
|
285
298
|
', '.join(encrypted))
|
|
286
299
|
plaintext = store.plaintext_password_connections()
|
|
287
300
|
if plaintext:
|
|
288
301
|
log.warning("Connection(s) %s store a literal password in %s. Consider a \"${VAR}\" reference to an "
|
|
289
302
|
"environment variable instead - it reads the same way but keeps the secret out of the file, "
|
|
290
|
-
"or set
|
|
303
|
+
"or set QUERYAPIGATE_ENCRYPTION_KEY to encrypt it at rest automatically.",
|
|
291
304
|
', '.join(plaintext), config.db_file())
|
|
292
305
|
_note_audit_key_rotation()
|
|
293
306
|
from . import auditstream
|
|
@@ -595,19 +608,21 @@ def get_json_body(required=True):
|
|
|
595
608
|
get_object = definitions.as_object # one definition, shared with saved-query validation
|
|
596
609
|
|
|
597
610
|
|
|
598
|
-
def get_int(value, label):
|
|
611
|
+
def get_int(value, label, code):
|
|
612
|
+
"""`value` as an int, None when not given - else a 400 with `code`, what the argument is to the endpoint (rc1, D6:
|
|
613
|
+
page=abc was invalid_request while page=0 was invalid_paging)."""
|
|
599
614
|
if value is None or value == '':
|
|
600
615
|
return None
|
|
601
616
|
try:
|
|
602
617
|
return int(value)
|
|
603
618
|
except (TypeError, ValueError):
|
|
604
|
-
raise ApiError(f'{label} must be an integer') from None
|
|
619
|
+
raise ApiError(f'{label} must be an integer', code=code) from None
|
|
605
620
|
|
|
606
621
|
|
|
607
622
|
def get_pagination():
|
|
608
623
|
"""Return (limit, offset, page) from the ?page and ?page_size query parameters."""
|
|
609
|
-
page = get_int(request.args.get('page'), 'page')
|
|
610
|
-
page_size = get_int(request.args.get('page_size'), 'page_size')
|
|
624
|
+
page = get_int(request.args.get('page'), 'page', 'invalid_paging')
|
|
625
|
+
page_size = get_int(request.args.get('page_size'), 'page_size', 'invalid_paging')
|
|
611
626
|
page = 1 if page is None else page
|
|
612
627
|
page_size = 10 if page_size is None else page_size
|
|
613
628
|
if page < 1 or page_size < 1:
|
|
@@ -647,7 +662,9 @@ def render(result, output_format, page, page_size):
|
|
|
647
662
|
single serialization span to measure for those (see that function's docstring)."""
|
|
648
663
|
started = time.monotonic()
|
|
649
664
|
with tracing.span(f'serialize {output_format}', attributes={'queryapigate.format': output_format}) as span:
|
|
650
|
-
|
|
665
|
+
# No rows is the format's own empty document (rc1, B5): [], a header-only CSV, an empty NDJSON body - before, a
|
|
666
|
+
# {"message": "No results returned"} object in every format, contradicting the documented array.
|
|
667
|
+
response = FORMATTERS[output_format](result)
|
|
651
668
|
tracing.set_attributes(span, queryapigate__bytes=response.content_length)
|
|
652
669
|
elapsed = time.monotonic() - started
|
|
653
670
|
metrics.observe_serialization(output_format, elapsed)
|
|
@@ -817,6 +834,7 @@ def _stream_history(rows, entry, record, permission=None):
|
|
|
817
834
|
@bp.route('/execute_sql', methods=['POST'])
|
|
818
835
|
def execute_sql_endpoint():
|
|
819
836
|
data = get_json_body()
|
|
837
|
+
refuse_unknown_body(data, ('sql', 'connection_name', 'database', 'params', 'format', 'timeout', 'mask'))
|
|
820
838
|
if not data.get('sql'):
|
|
821
839
|
raise ApiError('SQL query is missing', code='sql_required')
|
|
822
840
|
if not data.get('connection_name'):
|
|
@@ -866,6 +884,8 @@ def execute_mongo_endpoint():
|
|
|
866
884
|
full stop (BACKLOG #36: MongoDB support is find-only in this version) - unlike /execute_sql there is no
|
|
867
885
|
write permission to check."""
|
|
868
886
|
data = get_json_body()
|
|
887
|
+
refuse_unknown_body(data, ('collection', 'connection_name', 'filter', 'params', 'format', 'timeout', 'projection',
|
|
888
|
+
'sort'))
|
|
869
889
|
if not data.get('collection'):
|
|
870
890
|
raise ApiError('Collection is missing', code='collection_required')
|
|
871
891
|
if not data.get('connection_name'):
|
|
@@ -997,6 +1017,44 @@ def bind_embeddings(saved, values, connection_name):
|
|
|
997
1017
|
return values
|
|
998
1018
|
|
|
999
1019
|
|
|
1020
|
+
def _refuse_unreachable(path, content):
|
|
1021
|
+
"""A saved query this caller can't run at all is one that doesn't exist (rc1, B12): the same 404, with the same
|
|
1022
|
+
message, as a name never used - before, a 403 naming its connection told a key which names exist. Reachable is
|
|
1023
|
+
what can_run_saved() says of its published version - by a `queries` or collection grant, or its connection's -
|
|
1024
|
+
and, for a query with no connection of its own, any connection grant (?connection_name= still needs one). A
|
|
1025
|
+
caller that can reach it still gets a 403 for another connection, or a claim it lacks. An administrator - even an
|
|
1026
|
+
auditor, who runs nothing - lists the names anyway (queries.read), so is told why."""
|
|
1027
|
+
permission = g.permission
|
|
1028
|
+
if permission.admin or permission.role is not None:
|
|
1029
|
+
return
|
|
1030
|
+
name = store.query_name(path)
|
|
1031
|
+
try:
|
|
1032
|
+
_, live = store.select_version(content, None)
|
|
1033
|
+
except ApiError:
|
|
1034
|
+
live = None # nothing published: a draft, which no caller but an administrator runs - 404 below, as before
|
|
1035
|
+
if live is not None:
|
|
1036
|
+
connection_name = live.get('connection_name')
|
|
1037
|
+
reached_by_connection = (apikeys.can_use(permission, connection_name) if connection_name
|
|
1038
|
+
else bool(permission.connections))
|
|
1039
|
+
if (reached_by_connection or apikeys.can_use_query(permission, name)
|
|
1040
|
+
or apikeys.can_use_collection(permission, store.read_collection(content))):
|
|
1041
|
+
return
|
|
1042
|
+
raise ApiError(f"Saved query '{name}' not found", 404, code='query_not_found')
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
_QUERY_STRING_ONLY = ('page', 'page_size', 'stream')
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
def refuse_unknown_body(data, allowed):
|
|
1049
|
+
"""A body field the endpoint doesn't read is refused (unknown_field, rc1 B8): before, `page`, `page_size` and
|
|
1050
|
+
`stream` in a body were dropped without a word - they're read from the query string only."""
|
|
1051
|
+
unknown = sorted(set(data) - set(allowed))
|
|
1052
|
+
if unknown:
|
|
1053
|
+
hint = (f" - {', '.join(k for k in unknown if k in _QUERY_STRING_ONLY)} go in the query string"
|
|
1054
|
+
if any(k in _QUERY_STRING_ONLY for k in unknown) else '')
|
|
1055
|
+
raise ApiError(f"Unknown field(s): {', '.join(unknown)}{hint}", code='unknown_field')
|
|
1056
|
+
|
|
1057
|
+
|
|
1000
1058
|
def run_saved(ref, body, url_params):
|
|
1001
1059
|
"""_run_saved(), in its own span (tracing.py): named once the query is found, never by what the caller sent."""
|
|
1002
1060
|
with tracing.span('query') as span:
|
|
@@ -1013,7 +1071,8 @@ def _run_saved(ref, body, url_params):
|
|
|
1013
1071
|
doesn't exist: the same 404 as a version number that was never used, so drafts can't be discovered."""
|
|
1014
1072
|
path = store.resolve_saved_file(ref, check_exists=False) # load_versions() 404s the same, one read fewer
|
|
1015
1073
|
content = store.load_versions(path, with_history=False)
|
|
1016
|
-
|
|
1074
|
+
_refuse_unreachable(path, content)
|
|
1075
|
+
requested = get_int(request.args.get('version') or body.get('version'), 'version', 'invalid_version')
|
|
1017
1076
|
if requested is not None and store.is_draft(content, requested) and not g.permission.admin:
|
|
1018
1077
|
raise ApiError(f'Version {requested} not found', 404, code='version_not_found')
|
|
1019
1078
|
number, saved = store.select_version(content, requested)
|
|
@@ -1038,6 +1097,8 @@ def _run_saved(ref, body, url_params):
|
|
|
1038
1097
|
if not (granted_by_name and connection_name == saved.get('connection_name')):
|
|
1039
1098
|
require_connection(connection_name)
|
|
1040
1099
|
|
|
1100
|
+
if 'placeholders' in body:
|
|
1101
|
+
deprecations.warn('placeholders')
|
|
1041
1102
|
raw = {**url_params, **get_object(body.get('params'), 'params'),
|
|
1042
1103
|
**get_object(body.get('placeholders'), 'placeholders')}
|
|
1043
1104
|
raw = bind_claims(saved, raw)
|
|
@@ -1255,6 +1316,7 @@ def run_saved_mongo(saved, path, number, ref, connection_name, raw, output_forma
|
|
|
1255
1316
|
@bp.route('/q/<name>', methods=['GET', 'POST'])
|
|
1256
1317
|
def run_named_query(name):
|
|
1257
1318
|
body = get_json_body(required=False) if request.method == 'POST' else {}
|
|
1319
|
+
refuse_unknown_body(body, ('version', 'connection_name', 'params', 'placeholders', 'format', 'timeout'))
|
|
1258
1320
|
url_params = {k: v for k, v in request.args.items() if k not in RESERVED_ARGS}
|
|
1259
1321
|
return run_saved(name, body, url_params)
|
|
1260
1322
|
|
|
@@ -1491,15 +1553,14 @@ def health():
|
|
|
1491
1553
|
|
|
1492
1554
|
@bp.route('/metrics', methods=['GET'])
|
|
1493
1555
|
def metrics_endpoint():
|
|
1494
|
-
"""
|
|
1495
|
-
|
|
1496
|
-
since its ingress would otherwise publish the counts and the key, query and connection names in them (ADR 0017's
|
|
1497
|
-
review)."""
|
|
1556
|
+
"""For a scraper (metrics.authorized(): its token, or without one a client on this machine), or an administrator
|
|
1557
|
+
whose role may observe, as the Console's Metrics screen reads it."""
|
|
1498
1558
|
from . import adminroles
|
|
1499
1559
|
permission = g.get('permission')
|
|
1500
1560
|
# every workspace's counts: a server-wide role's to read (ADR 0023)
|
|
1501
1561
|
observer = adminroles.allows(permission, 'observe') and getattr(permission, 'server_wide', True)
|
|
1502
|
-
if not (observer or metrics.authorized(request.headers.get('Authorization')
|
|
1562
|
+
if not (observer or metrics.authorized(request.headers.get('Authorization'),
|
|
1563
|
+
request.environ.get('queryapigate.peer_addr'))):
|
|
1503
1564
|
response = jsonify(error_body(metrics.UNAUTHORIZED, 401))
|
|
1504
1565
|
response.status_code = 401
|
|
1505
1566
|
response.headers['WWW-Authenticate'] = 'Bearer realm="metrics"'
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"""Collection bundles: a collection's queries as one portable JSON document (``queryapigate collection export``)
|
|
2
2
|
and back into a home folder (``... import``) - for moving a set of queries between environments or sharing
|
|
3
3
|
them. A bundle carries *definitions only*: the latest version of each query's SQL, description, tags, declared
|
|
4
|
-
parameters, default connection name and cache TTL
|
|
4
|
+
parameters, default connection name and cache TTL - and its query-level mask and MCP exposure, which a query would
|
|
5
|
+
otherwise arrive without, unmasked and listed over MCP. Never execution history, API keys, roles or connection
|
|
5
6
|
details (a connection is referenced by name and must exist where the bundle is imported).
|
|
6
7
|
|
|
8
|
+
**Format version 2** (rc1, B14) writes each query as the Management API and a configuration file name its fields -
|
|
9
|
+
`sql`, `parameters`, `columns` - where version 1 wrote the stored names `sql_query`, `query_parameters`,
|
|
10
|
+
`column_descriptions`. An export is version 2; an import reads either.
|
|
11
|
+
|
|
7
12
|
Import is held to exactly the rules saving a query is - every entry goes through
|
|
8
13
|
``definitions.validate_definition()`` - and is all-or-nothing up to the point of writing: the whole bundle is
|
|
9
14
|
validated and checked for conflicts first, so a problem in the tenth query stops the import before the first is
|
|
@@ -14,26 +19,32 @@ from . import definitions, store
|
|
|
14
19
|
from .errors import ApiError
|
|
15
20
|
|
|
16
21
|
FORMAT = 'queryapigate-collection'
|
|
17
|
-
FORMAT_VERSION =
|
|
22
|
+
FORMAT_VERSION = 2
|
|
23
|
+
READS = (1, 2)
|
|
18
24
|
POLICIES = ('fail', 'skip', 'new-version')
|
|
19
|
-
# Everything an entry may carry
|
|
25
|
+
# Everything an entry may carry - in version 2, a configuration file's query (configcode._QUERY_FIELDS) less its
|
|
26
|
+
# collection, which is the bundle's. Anything else is an error rather than silently dropped: a field the importer
|
|
20
27
|
# ignores is a field whose loss nobody notices.
|
|
28
|
+
# Version 1's, the stored names:
|
|
21
29
|
ENTRY_FIELDS = {'name', 'sql_query', 'query_type', 'mongo_collection', 'mongo_filter', 'mongo_projection',
|
|
22
30
|
'mongo_sort', 'author', 'description', 'tags', 'query_parameters', 'connection_name',
|
|
23
|
-
'cache_ttl', 'column_descriptions', 'agent_writes', 'max_affected_rows'}
|
|
31
|
+
'cache_ttl', 'column_descriptions', 'agent_writes', 'max_affected_rows', 'mask', 'mcp'}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _entry_fields_v2():
|
|
35
|
+
from . import configcode
|
|
36
|
+
return configcode._QUERY_FIELDS - {'collection'}
|
|
24
37
|
|
|
25
38
|
|
|
26
39
|
def export_bundle(collection):
|
|
40
|
+
from . import configcode
|
|
27
41
|
store.validate_collection_name(collection)
|
|
28
42
|
queries = []
|
|
29
|
-
for name, _,
|
|
43
|
+
for name, _, _, member_of in store.live_versions():
|
|
30
44
|
if member_of != collection:
|
|
31
45
|
continue
|
|
32
|
-
|
|
33
|
-
for
|
|
34
|
-
if data.get(field) not in (None, {}, []):
|
|
35
|
-
entry[field] = data[field]
|
|
36
|
-
queries.append(entry)
|
|
46
|
+
content = store.load_versions(store.resolve_saved_file(name))
|
|
47
|
+
queries.append({k: v for k, v in configcode._query_entry(name, content).items() if k != 'collection'})
|
|
37
48
|
if not queries:
|
|
38
49
|
raise ApiError(f"Collection '{collection}' not found or empty", 404, code='collection_not_found')
|
|
39
50
|
return {'format': FORMAT, 'format_version': FORMAT_VERSION, 'collection': collection, 'exported_at': store.now(),
|
|
@@ -44,9 +55,11 @@ def _parse(bundle, collection_override):
|
|
|
44
55
|
"""Validate a decoded bundle; return (collection, [(name, fields)])."""
|
|
45
56
|
if not isinstance(bundle, dict) or bundle.get('format') != FORMAT:
|
|
46
57
|
raise ApiError(f"Not a QueryAPIGate collection bundle (expected format '{FORMAT}')", code='invalid_bundle')
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
version = bundle.get('format_version')
|
|
59
|
+
if version not in READS or isinstance(version, bool):
|
|
60
|
+
raise ApiError(f"Unsupported bundle format_version {version!r} (this version reads 1 and 2)",
|
|
61
|
+
code='invalid_bundle')
|
|
62
|
+
allowed = ENTRY_FIELDS if version == 1 else _entry_fields_v2()
|
|
50
63
|
collection = collection_override or bundle.get('collection')
|
|
51
64
|
store.validate_collection_name(collection)
|
|
52
65
|
entries = bundle.get('queries')
|
|
@@ -58,14 +71,18 @@ def _parse(bundle, collection_override):
|
|
|
58
71
|
raise ApiError(f'Query #{position} has no name', code='invalid_bundle')
|
|
59
72
|
name = entry['name']
|
|
60
73
|
try:
|
|
61
|
-
extra = sorted(set(entry) -
|
|
74
|
+
extra = sorted(set(entry) - allowed)
|
|
62
75
|
if extra:
|
|
63
76
|
raise ApiError(f"unexpected field(s): {', '.join(extra)}", code='invalid_bundle')
|
|
64
77
|
store.saved_path_for_name(name)
|
|
65
78
|
if name in seen:
|
|
66
79
|
raise ApiError('listed more than once in the bundle', code='invalid_bundle')
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
if version == 1:
|
|
81
|
+
body = {**{k: v for k, v in entry.items() if k != 'name'}, 'filename': name}
|
|
82
|
+
else: # the Management API's names, read as it reads them
|
|
83
|
+
from .services import queries as query_service
|
|
84
|
+
body = query_service._legacy_body({**entry, 'author': entry.get('author') or 'import'}, name, 'cli')
|
|
85
|
+
fields, _ = definitions.validate_definition(body)
|
|
69
86
|
except ApiError as error:
|
|
70
87
|
raise ApiError(f"Query '{name}': {error.message}", error.status, code=error.code) from None
|
|
71
88
|
seen.add(name)
|
|
@@ -106,7 +123,7 @@ def import_bundle(bundle, on_conflict='fail', collection_override=None, dry_run=
|
|
|
106
123
|
if blocked:
|
|
107
124
|
hint = ('use --on-conflict skip to leave existing queries alone, or new-version to add a version'
|
|
108
125
|
if on_conflict == 'fail' else 'move it out of that collection first, or use --on-conflict skip')
|
|
109
|
-
raise ApiError(f"Nothing imported. Already exists: {', '.join(blocked)} - {hint}", 409)
|
|
126
|
+
raise ApiError(f"Nothing imported. Already exists: {', '.join(blocked)} - {hint}", 409, code='query_exists')
|
|
110
127
|
known = store.read_connections()
|
|
111
128
|
missing = sorted({f['connection_name'] for _, f in created + new_versions if f.get('connection_name')
|
|
112
129
|
and f['connection_name'] not in known})
|
|
@@ -5,7 +5,7 @@ from any other server is refused), and the secret its posts are signed with (Sta
|
|
|
5
5
|
|
|
6
6
|
**The secret is generated here and shown once** - in the response that creates the source, or the one that rotates
|
|
7
7
|
its secret - never accepted from a caller, so no source has a weak one. It must be usable to check a signature, so it
|
|
8
|
-
can't be hashed as an API key's is: it is stored like a connection password, encrypted with
|
|
8
|
+
can't be hashed as an API key's is: it is stored like a connection password, encrypted with QUERYAPIGATE_ENCRYPTION_KEY
|
|
9
9
|
when that's set (store._encrypt_password(), rekey.py). Rotating keeps the old one working for a grace period (ADR
|
|
10
10
|
0009), during which a post signed with either is accepted, so Debezium can be restarted with the new one at any point
|
|
11
11
|
in it.
|