queryapigate 0.50.1__tar.gz → 0.52.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.
Files changed (256) hide show
  1. {queryapigate-0.50.1/queryapigate.egg-info → queryapigate-0.52.0}/PKG-INFO +1 -1
  2. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/__init__.py +1 -1
  3. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/adminroles.py +4 -0
  4. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/admins.py +20 -3
  5. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/apikeys.py +2 -0
  6. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/app.py +54 -17
  7. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/cache.py +31 -9
  8. queryapigate-0.52.0/queryapigate/cdcsources.py +319 -0
  9. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/cli.py +12 -4
  10. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/config.py +53 -4
  11. queryapigate-0.50.1/queryapigate/console_dist/assets/AccessMapPage-BqpyY309.js → queryapigate-0.52.0/queryapigate/console_dist/assets/AccessMapPage-BLTtrvV7.js +2 -2
  12. queryapigate-0.50.1/queryapigate/console_dist/assets/AdministratorsPage-CnpThaBb.js → queryapigate-0.52.0/queryapigate/console_dist/assets/AdministratorsPage-gWX1epBr.js +1 -1
  13. queryapigate-0.50.1/queryapigate/console_dist/assets/AgentsPage-CstMaWCJ.js → queryapigate-0.52.0/queryapigate/console_dist/assets/AgentsPage-CQCw6zsv.js +1 -1
  14. queryapigate-0.50.1/queryapigate/console_dist/assets/AlertsPage-Cqgw-gjl.js → queryapigate-0.52.0/queryapigate/console_dist/assets/AlertsPage-Dcs615rM.js +1 -1
  15. queryapigate-0.50.1/queryapigate/console_dist/assets/ApiKeyDetailPage-CqkTTOG9.js → queryapigate-0.52.0/queryapigate/console_dist/assets/ApiKeyDetailPage-CTdAD9mo.js +1 -1
  16. queryapigate-0.50.1/queryapigate/console_dist/assets/ApiKeysPage-DeTp-Tvt.js → queryapigate-0.52.0/queryapigate/console_dist/assets/ApiKeysPage-DrydnYjp.js +1 -1
  17. queryapigate-0.50.1/queryapigate/console_dist/assets/ApprovalsPage-DwxYSh0k.js → queryapigate-0.52.0/queryapigate/console_dist/assets/ApprovalsPage-0cJWRfX2.js +1 -1
  18. queryapigate-0.50.1/queryapigate/console_dist/assets/AuditLogPage-BGx-z4m6.js → queryapigate-0.52.0/queryapigate/console_dist/assets/AuditLogPage-BKUfkk9p.js +1 -1
  19. queryapigate-0.50.1/queryapigate/console_dist/assets/CachingPage-7YLR6pgM.js → queryapigate-0.52.0/queryapigate/console_dist/assets/CachingPage-D9z2sT0j.js +1 -1
  20. queryapigate-0.52.0/queryapigate/console_dist/assets/CdcSourcesPage-ColAZA6a.js +2 -0
  21. queryapigate-0.50.1/queryapigate/console_dist/assets/ConnectionsPage-DjPDF35w.js → queryapigate-0.52.0/queryapigate/console_dist/assets/ConnectionsPage-DDzYECYe.js +1 -1
  22. queryapigate-0.50.1/queryapigate/console_dist/assets/DesignerPage-CjarWa3p.js → queryapigate-0.52.0/queryapigate/console_dist/assets/DesignerPage-CUtj9F6J.js +1 -1
  23. queryapigate-0.50.1/queryapigate/console_dist/assets/DestinationsPage-DC65t6uF.js → queryapigate-0.52.0/queryapigate/console_dist/assets/DestinationsPage-jEO9uCHi.js +1 -1
  24. queryapigate-0.50.1/queryapigate/console_dist/assets/ExportsPage-DDYnQOv4.js → queryapigate-0.52.0/queryapigate/console_dist/assets/ExportsPage-B1BcJ83k.js +1 -1
  25. queryapigate-0.50.1/queryapigate/console_dist/assets/HelpPage-VuoYRxNo.js → queryapigate-0.52.0/queryapigate/console_dist/assets/HelpPage-BKnEzwAb.js +2 -2
  26. queryapigate-0.50.1/queryapigate/console_dist/assets/HomePage-9wC8oh7y.js → queryapigate-0.52.0/queryapigate/console_dist/assets/HomePage-CU0QeQNe.js +2 -2
  27. queryapigate-0.50.1/queryapigate/console_dist/assets/KeyActivity-BcdRGwDe.js → queryapigate-0.52.0/queryapigate/console_dist/assets/KeyActivity-BhV8qZ-p.js +1 -1
  28. queryapigate-0.50.1/queryapigate/console_dist/assets/Managed-CyN2vftX.js → queryapigate-0.52.0/queryapigate/console_dist/assets/Managed-C6wP4b1l.js +1 -1
  29. queryapigate-0.50.1/queryapigate/console_dist/assets/McpPage-B7-ynyNV.js → queryapigate-0.52.0/queryapigate/console_dist/assets/McpPage-CvjuiKZV.js +1 -1
  30. queryapigate-0.50.1/queryapigate/console_dist/assets/MetricsPage-w2DLEdpb.js → queryapigate-0.52.0/queryapigate/console_dist/assets/MetricsPage-Cv2y-OBV.js +1 -1
  31. queryapigate-0.50.1/queryapigate/console_dist/assets/QueryInfo-DUO7ZZAX.js → queryapigate-0.52.0/queryapigate/console_dist/assets/QueryInfo--z9ZqXkQ.js +1 -1
  32. queryapigate-0.50.1/queryapigate/console_dist/assets/RepositoryPage-B4rnvPN9.js → queryapigate-0.52.0/queryapigate/console_dist/assets/RepositoryPage-Dx-NdAHu.js +1 -1
  33. queryapigate-0.50.1/queryapigate/console_dist/assets/Results-BhB7hstv.js → queryapigate-0.52.0/queryapigate/console_dist/assets/Results-CxkMrmv4.js +1 -1
  34. queryapigate-0.50.1/queryapigate/console_dist/assets/RolesPage-DVO9hrtx.js → queryapigate-0.52.0/queryapigate/console_dist/assets/RolesPage-BwJqzmix.js +1 -1
  35. queryapigate-0.50.1/queryapigate/console_dist/assets/SchemaBrowser-BH0L6i-5.js → queryapigate-0.52.0/queryapigate/console_dist/assets/SchemaBrowser-C-910PNM.js +1 -1
  36. queryapigate-0.50.1/queryapigate/console_dist/assets/SettingsPage-DBA5k-Wv.js → queryapigate-0.52.0/queryapigate/console_dist/assets/SettingsPage-CahRTpCG.js +2 -2
  37. queryapigate-0.50.1/queryapigate/console_dist/assets/Time-mYbHiVNM.js → queryapigate-0.52.0/queryapigate/console_dist/assets/Time-1LzS0WOr.js +1 -1
  38. queryapigate-0.50.1/queryapigate/console_dist/assets/WorkspacesPage-Db67AtBC.js → queryapigate-0.52.0/queryapigate/console_dist/assets/WorkspacesPage-QhgHD8D7.js +1 -1
  39. queryapigate-0.50.1/queryapigate/console_dist/assets/api-DkQ9BBEo.js → queryapigate-0.52.0/queryapigate/console_dist/assets/api-Culg17uJ.js +1 -1
  40. queryapigate-0.50.1/queryapigate/console_dist/assets/forms-BlUEe1Cq.js → queryapigate-0.52.0/queryapigate/console_dist/assets/forms-CietEOlU.js +1 -1
  41. queryapigate-0.50.1/queryapigate/console_dist/assets/forms-LCAOrBkZ.js → queryapigate-0.52.0/queryapigate/console_dist/assets/forms-Daj5x4ru.js +1 -1
  42. queryapigate-0.50.1/queryapigate/console_dist/assets/index-ClySKPZc.js → queryapigate-0.52.0/queryapigate/console_dist/assets/index-zWukbTre.js +2 -2
  43. queryapigate-0.50.1/queryapigate/console_dist/assets/shared-DBY-R_Ny.js → queryapigate-0.52.0/queryapigate/console_dist/assets/shared-DZEj-9yA.js +1 -1
  44. queryapigate-0.50.1/queryapigate/console_dist/assets/useMutation--I8ZWgpO.js → queryapigate-0.52.0/queryapigate/console_dist/assets/useMutation-kSEF_Amb.js +1 -1
  45. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/index.html +1 -1
  46. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/dataplane.py +4 -0
  47. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/db.py +57 -6
  48. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/destinations.py +4 -1
  49. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/engine.py +29 -7
  50. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/events.py +144 -21
  51. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/experimental.py +13 -0
  52. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/history.py +11 -0
  53. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/jwtauth.py +13 -10
  54. queryapigate-0.52.0/queryapigate/live.py +522 -0
  55. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/metrics.py +4 -2
  56. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/openapi.py +14 -0
  57. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/rediscache.py +60 -6
  58. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/rekey.py +36 -17
  59. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/runners.py +19 -6
  60. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/runstore.py +3 -1
  61. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/schema.py +1 -2
  62. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/secretrefs.py +46 -0
  63. queryapigate-0.52.0/queryapigate/services/cdc_sources.py +56 -0
  64. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/connections.py +13 -4
  65. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/destinations.py +2 -1
  66. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/mcp.py +2 -2
  67. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/workspaces.py +1 -1
  68. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/sso.py +22 -14
  69. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/store.py +17 -10
  70. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/v1.py +77 -0
  71. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/v1_spec.py +86 -3
  72. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/workspaces.py +28 -12
  73. {queryapigate-0.50.1 → queryapigate-0.52.0/queryapigate.egg-info}/PKG-INFO +1 -1
  74. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate.egg-info/SOURCES.txt +43 -33
  75. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_agent_writes.py +11 -0
  76. queryapigate-0.52.0/tests/test_cdc_sources.py +324 -0
  77. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_dataplane.py +21 -4
  78. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_db.py +53 -0
  79. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_descriptions.py +11 -0
  80. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_events_server.py +72 -7
  81. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_helm.py +2 -1
  82. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_jdbc.py +36 -0
  83. queryapigate-0.52.0/tests/test_live.py +513 -0
  84. queryapigate-0.52.0/tests/test_live_cache.py +338 -0
  85. queryapigate-0.52.0/tests/test_live_debezium.py +299 -0
  86. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_mcp_oauth.py +57 -1
  87. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_multinode.py +38 -4
  88. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_queryapigate.py +36 -2
  89. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_rekey.py +60 -1
  90. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_runstore.py +13 -2
  91. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_settings.py +4 -1
  92. queryapigate-0.52.0/tests/test_shutdown.py +142 -0
  93. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_sso.py +28 -0
  94. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_workspace_isolation.py +40 -0
  95. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_workspace_local_files.py +51 -0
  96. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_workspace_observability.py +21 -0
  97. queryapigate-0.52.0/tests/test_workspace_secret_refs.py +90 -0
  98. {queryapigate-0.50.1 → queryapigate-0.52.0}/LICENSE +0 -0
  99. {queryapigate-0.50.1 → queryapigate-0.52.0}/NOTICE +0 -0
  100. {queryapigate-0.50.1 → queryapigate-0.52.0}/README.md +0 -0
  101. {queryapigate-0.50.1 → queryapigate-0.52.0}/pyproject.toml +0 -0
  102. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/__main__.py +0 -0
  103. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/accesslog.py +0 -0
  104. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/agentwrites.py +0 -0
  105. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/alerts.py +0 -0
  106. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/auditchain.py +0 -0
  107. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/auditstream.py +0 -0
  108. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/aws.py +0 -0
  109. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/broadcast.py +0 -0
  110. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/bundle.py +0 -0
  111. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/collection_admin.py +0 -0
  112. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/configcode.py +0 -0
  113. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console.py +0 -0
  114. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/CodeBox-Cwh5KHLp.js +0 -0
  115. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/Experimental-B3dnaeV7.js +0 -0
  116. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/StatTile-Cft4kJPH.js +0 -0
  117. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/client-ZHNiMG8H.js +0 -0
  118. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/icons-CFXE8hAz.js +0 -0
  119. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/index-Cv64XKNs.css +0 -0
  120. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/maskRules-CvKQIPgN.js +0 -0
  121. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/reach-BAOLd75Y.js +0 -0
  122. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/assets/state-O13cl7cO.js +0 -0
  123. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/console_dist/favicon.svg +0 -0
  124. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/cors.py +0 -0
  125. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/databases.py +0 -0
  126. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/definitions.py +0 -0
  127. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/deprecations.py +0 -0
  128. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/descriptions.py +0 -0
  129. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/duckfiles.py +0 -0
  130. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/embeddings.py +0 -0
  131. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/errors.py +0 -0
  132. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/examples.py +0 -0
  133. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/exporting.py +0 -0
  134. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/exports.py +0 -0
  135. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/formats.py +0 -0
  136. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/governance.py +0 -0
  137. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/gunicorn_conf.py +0 -0
  138. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/instances.py +0 -0
  139. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/lib/h2-2.2.224.jar +0 -0
  140. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/limits.py +0 -0
  141. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/logging_setup.py +0 -0
  142. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/masking.py +0 -0
  143. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/mcp_server.py +0 -0
  144. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/metacache.py +0 -0
  145. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/mongodocs.py +0 -0
  146. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/mongotools.py +0 -0
  147. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/oidc.py +0 -0
  148. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/params.py +0 -0
  149. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/parquet.py +0 -0
  150. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/pool.py +0 -0
  151. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/postman.py +0 -0
  152. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/quotas.py +0 -0
  153. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/ratelimit.py +0 -0
  154. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/scope.py +0 -0
  155. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/secheaders.py +0 -0
  156. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/__init__.py +0 -0
  157. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/access.py +0 -0
  158. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/administrators.py +0 -0
  159. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/audit.py +0 -0
  160. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/collections.py +0 -0
  161. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/descriptions.py +0 -0
  162. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/exports.py +0 -0
  163. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/services/queries.py +0 -0
  164. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/sqlflow.py +0 -0
  165. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/sqltools.py +0 -0
  166. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/tableguard.py +0 -0
  167. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/tracing.py +0 -0
  168. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/usage.py +0 -0
  169. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate/vault.py +0 -0
  170. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate.egg-info/dependency_links.txt +0 -0
  171. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate.egg-info/entry_points.txt +0 -0
  172. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate.egg-info/requires.txt +0 -0
  173. {queryapigate-0.50.1 → queryapigate-0.52.0}/queryapigate.egg-info/top_level.txt +0 -0
  174. {queryapigate-0.50.1 → queryapigate-0.52.0}/setup.cfg +0 -0
  175. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_adhoc_history.py +0 -0
  176. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_adminroles.py +0 -0
  177. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_admins.py +0 -0
  178. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_alerts.py +0 -0
  179. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_api_administrators.py +0 -0
  180. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_api_keys.py +0 -0
  181. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_api_v1.py +0 -0
  182. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_audit_chain.py +0 -0
  183. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_audit_log.py +0 -0
  184. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_audit_siem.py +0 -0
  185. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_audit_stream.py +0 -0
  186. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_aws.py +0 -0
  187. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_backup_restore.py +0 -0
  188. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_broadcast.py +0 -0
  189. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_cli.py +0 -0
  190. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_collection_bundle.py +0 -0
  191. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_collection_postman.py +0 -0
  192. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_collections.py +0 -0
  193. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_configcode.py +0 -0
  194. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_connection_encryption.py +0 -0
  195. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_console.py +0 -0
  196. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_cors_and_rate_limit.py +0 -0
  197. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_data_protection.py +0 -0
  198. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_databases.py +0 -0
  199. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_dependency_floors.py +0 -0
  200. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_deprecations.py +0 -0
  201. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_destinations.py +0 -0
  202. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_docs_site.py +0 -0
  203. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_duckdb.py +0 -0
  204. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_duckdb_files.py +0 -0
  205. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_embeddings.py +0 -0
  206. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_errors.py +0 -0
  207. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_events.py +0 -0
  208. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_examples.py +0 -0
  209. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_experimental.py +0 -0
  210. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_export_security.py +0 -0
  211. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_exporting.py +0 -0
  212. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_exports.py +0 -0
  213. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_fips.py +0 -0
  214. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_history.py +0 -0
  215. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_howto.py +0 -0
  216. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_instances.py +0 -0
  217. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_integration.py +0 -0
  218. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_jwt.py +0 -0
  219. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_key_rotation.py +0 -0
  220. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_limits.py +0 -0
  221. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_masking.py +0 -0
  222. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_masking_requests.py +0 -0
  223. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_mcp.py +0 -0
  224. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_mcp_keycloak.py +0 -0
  225. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_metacache.py +0 -0
  226. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_mongo_streaming.py +0 -0
  227. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_mongotools.py +0 -0
  228. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_observability.py +0 -0
  229. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_oidc.py +0 -0
  230. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_params.py +0 -0
  231. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_parquet.py +0 -0
  232. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_pool.py +0 -0
  233. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_publishing.py +0 -0
  234. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_query_window.py +0 -0
  235. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_quotas.py +0 -0
  236. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_release_check.py +0 -0
  237. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_response_cache.py +0 -0
  238. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_roles.py +0 -0
  239. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_rolling_upgrade.py +0 -0
  240. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_runstore_differential.py +0 -0
  241. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_secretrefs.py +0 -0
  242. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_security_headers.py +0 -0
  243. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_shared_rate_limit.py +0 -0
  244. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_sql_guard_fuzz.py +0 -0
  245. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_sql_guard_writes.py +0 -0
  246. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_sqlflow.py +0 -0
  247. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_sso_keycloak.py +0 -0
  248. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_supply_chain.py +0 -0
  249. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_tableguard.py +0 -0
  250. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_tracing.py +0 -0
  251. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_upgrades.py +0 -0
  252. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_usage.py +0 -0
  253. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_vault.py +0 -0
  254. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_workspace_config_cli.py +0 -0
  255. {queryapigate-0.50.1 → queryapigate-0.52.0}/tests/test_workspace_store.py +0 -0
  256. {queryapigate-0.50.1 → queryapigate-0.52.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.50.1
3
+ Version: 0.52.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
@@ -1,5 +1,5 @@
1
1
  """QueryAPIGate - expose SQL databases as a REST API."""
2
- __version__ = "0.50.1"
2
+ __version__ = "0.52.0"
3
3
 
4
4
  from .app import create_app # noqa: E402 (app imports __version__)
5
5
 
@@ -72,6 +72,10 @@ OPERATIONS = {
72
72
  'v1.connection_databases': 'connections.write',
73
73
  'v1.list_descriptions': 'connections.read', 'v1.update_descriptions': 'connections.write',
74
74
  'v1.import_descriptions': 'connections.write',
75
+ 'v1.list_cdc_sources': 'connections.read', 'v1.get_cdc_source': 'connections.read',
76
+ 'v1.create_cdc_source': 'connections.write', 'v1.update_cdc_source': 'connections.write',
77
+ 'v1.rotate_cdc_source': 'connections.write', 'v1.end_cdc_source_previous_secret': 'connections.write',
78
+ 'v1.delete_cdc_source': 'connections.write',
75
79
  'v1.list_api_keys': 'access.read', 'v1.get_api_key': 'access.read', 'v1.list_roles': 'access.read',
76
80
  'v1.get_role': 'access.read',
77
81
  'v1.create_api_key': 'access.write', 'v1.update_api_key': 'access.write', 'v1.delete_api_key': 'access.write',
@@ -394,12 +394,26 @@ def _free_name(conn, wanted):
394
394
  raise ApiError('Could not find a free administrator name', 409, code='admin_exists')
395
395
 
396
396
 
397
- def sign_in_sso(issuer, subject, role, wanted_name, email):
397
+ def sign_in_sso(issuer, subject, group_role, default_role, wanted_name, email):
398
398
  """The administrator for someone who just signed in through SSO, created on first sign-in - (admin, change)
399
399
  where change is 'created', 'linked' (an administrator waiting for this verified email, now bound - 'linked_role'
400
400
  when their groups also gave them a new role), 'role' (their groups gave a new role) or None. The provider decides
401
- the role: one moved out of the owners' group is no longer an owner, last one or not - owners come from that
402
- group."""
401
+ the role: the one their groups map to (`group_role`), else the default role (`default_role`, anyone with a verified
402
+ email at an allowed domain) - one moved out of the owners' group is no longer an owner, last one or not.
403
+
404
+ Except for an administrator whose roles are all workspace memberships (ADR 0023 - no server-wide role): the
405
+ default role doesn't make them server-wide. Their invitation to a workspace is what lets them in, so they sign in
406
+ with no group too; only a group the provider puts them in gives them a server-wide role. Before, an invitation to
407
+ one workspace became a server-wide role - a data role in every workspace - at the first sign-in."""
408
+ def role_for(admin):
409
+ if admin is not None and admin['role'] is None and group_role is None:
410
+ return None
411
+ role = group_role or default_role
412
+ if role is None:
413
+ from .sso import NO_ROLE
414
+ raise ApiError(NO_ROLE, 403, code='sso_no_role')
415
+ return role
416
+
403
417
  with db.transaction() as conn:
404
418
  found = find_by_sso(issuer, subject)
405
419
  if found is None and email:
@@ -409,17 +423,20 @@ def sign_in_sso(issuer, subject, role, wanted_name, email):
409
423
  raise ApiError(f'More than one administrator waits for an SSO sign-in as {email}', 409,
410
424
  code='sso_ambiguous')
411
425
  if waiting:
426
+ role = role_for(waiting[0])
412
427
  found = {**waiting[0], 'sso': {'issuer': issuer, 'subject': subject}}
413
428
  change = 'linked' if found['role'] == role else 'linked_role'
414
429
  found['role'] = role
415
430
  _write_admin(conn, found)
416
431
  return found, change
417
432
  if found is not None:
433
+ role = role_for(found)
418
434
  if found['role'] == role:
419
435
  return found, None
420
436
  found = {**found, 'role': role}
421
437
  _write_admin(conn, found)
422
438
  return found, 'role'
439
+ role = role_for(None)
423
440
  admin = {'name': _free_name(conn, wanted_name), 'role': role, 'active': True, 'created_at': store.now(),
424
441
  'email': email if email and _EMAIL_RE.match(email) else None, 'created_by': 'sso',
425
442
  'last_seen_at': None, 'sso': {'issuer': issuer, 'subject': subject}}
@@ -541,6 +541,8 @@ def create_key(name, connections=None, allow_writes=None, queries=None, expires_
541
541
  example=False, mask=None, max_concurrent=None, query_timeout=None, max_rows=None, quota=None):
542
542
  if not isinstance(name, str) or not _NAME_RE.match(name):
543
543
  raise ApiError("API key name may only contain letters, digits, spaces, '.', '_' and '-'", code='invalid_name')
544
+ if name in admins.RESERVED_NAMES: # `admin` is every administrator's label in /metrics, `-` no caller's
545
+ raise ApiError(f"'{name}' is reserved - choose another name", code='invalid_name')
544
546
  admins.refuse_taken_name(name)
545
547
  if role is None:
546
548
  collections = _normalize_collections(collections)
@@ -38,6 +38,7 @@ from . import (
38
38
  instances,
39
39
  jwtauth,
40
40
  limits,
41
+ live,
41
42
  logging_setup,
42
43
  masking,
43
44
  metacache,
@@ -67,6 +68,8 @@ bp = Blueprint('api', __name__)
67
68
  RESERVED_ARGS = {'format', 'page', 'page_size', 'connection_name', 'version', 'timeout', 'stream'}
68
69
  PUBLIC_ENDPOINTS = {'api.index', 'api.favicon', 'api.health', 'api.docs', 'api.openapi_spec', 'api.admin_ui',
69
70
  'api.console_page', 'api.metrics_endpoint',
71
+ # Debezium Server's changes (live.py): signed with the source's own secret, never a key or token
72
+ 'api.ingest_cdc',
70
73
  # the data plane's reports and run store lease: gate() lets only its secret through (ADR 0028)
71
74
  'api.dataplane_runs', 'api.dataplane_lease',
72
75
  # Console sign-in (sso.py): each checks what it needs itself - state, the session and its CSRF token
@@ -179,8 +182,10 @@ class _CapturePeer:
179
182
  server sees the request as if the client had connected directly, ProxyFix and QUERYAPIGATE_TRUST_PROXY included.
180
183
  A peer that isn't an IP address counts as remote, as a Unix socket does. A data plane from another release
181
184
  (X-QAG-Dataplane-Version) is still the data plane, but is given no plan (dataplane.paired()). The rate-limit buckets
182
- it counted a call in before forwarding it (X-QAG-Rate-Counted, ADR 0032) are taken from it alone. Its headers are
183
- removed here, so nothing after this layer reads, logs or passes on the secret."""
185
+ it counted a call in before forwarding it (X-QAG-Rate-Counted, ADR 0032) are taken from it alone. Its own calls to
186
+ /internal/dataplane/* carry X-QAG-Own as well, which it takes off every request it relays: the secret alone means
187
+ "came through the data plane", which every client's call does. Its headers are removed here, so nothing after this
188
+ layer reads, logs or passes on the secret."""
184
189
 
185
190
  def __init__(self, app):
186
191
  self.app = app
@@ -191,7 +196,9 @@ class _CapturePeer:
191
196
  wanted = environ.pop(dataplane.WANTED_ENVIRON, None)
192
197
  version = environ.pop(dataplane.VERSION_ENVIRON, None)
193
198
  rate_counted = environ.pop(dataplane.COUNTED_ENVIRON, None)
199
+ own = environ.pop(dataplane.OWN_ENVIRON, None)
194
200
  if supplied is not None and dataplane.matches(supplied):
201
+ environ['queryapigate.dataplane_own'] = own == '1'
195
202
  is_paired = dataplane.paired(version)
196
203
  environ['queryapigate.dataplane'] = 'plan' if wanted == '1' and is_paired else True
197
204
  environ['queryapigate.dataplane_paired'] = is_paired
@@ -263,9 +270,9 @@ def create_app():
263
270
  from . import rekey
264
271
  found = rekey.report()
265
272
  if found['undecryptable']:
266
- log.warning('No key in QUERYAPIGATE_SECRET_KEY decrypts the password of %s - add the key it was '
273
+ log.warning('No key in QUERYAPIGATE_SECRET_KEY decrypts the secret of %s - add the key it was '
267
274
  'encrypted with (after the first), or enter it again.',
268
- ', '.join(f"{v['type']} '{v['name']}'" for v in found['undecryptable']))
275
+ ', '.join(rekey.describe(v) for v in found['undecryptable']))
269
276
  if found['under_old_keys']:
270
277
  log.warning('%d password(s) are still encrypted with an old key in QUERYAPIGATE_SECRET_KEY - run '
271
278
  '`queryapigate rekey` to move them to the first key, then remove the others.',
@@ -333,7 +340,8 @@ def create_app():
333
340
  g.request_id = new_request_id(request.headers.get('X-Request-Id'))
334
341
  g.request_started = time.monotonic()
335
342
  if request.endpoint in DATAPLANE_ENDPOINTS: # the data plane's own calls: nothing else applies to them
336
- if request.environ.get('queryapigate.dataplane'):
343
+ # Its own - not merely through it: every client's call through the data plane carries the secret too
344
+ if request.environ.get('queryapigate.dataplane_own'):
337
345
  return None
338
346
  return jsonify(error_body('Not Found', 404)), 404
339
347
  if request.environ.get('queryapigate.dataplane') == 'plan': # before the key is read: a plan names its row
@@ -669,7 +677,7 @@ def stream_sql_response(sql, connection_name, params, timeout, output_format, fi
669
677
  raise ApiError('stream=true exports the whole result and does not accept page/page_size', code='invalid_stream')
670
678
  key_name = metrics_key_name()
671
679
  columns, rows = engine.stream_sql(sql, connection_name, params, timeout, key_name=key_name,
672
- allowed_tables=allowed_tables, mask=mask)
680
+ allowed_tables=allowed_tables, mask=mask, database=database)
673
681
  # Captured here, not inside _record_stream_history(): that generator's body runs lazily, as the response
674
682
  # streams out - by then the request/app context this view function runs in is long gone (no
675
683
  # flask.stream_with_context() wrapping is used), so g, caller_key_name() and current_app are only safe to read
@@ -898,11 +906,13 @@ def _client_cache_control(ttl):
898
906
  return f'private, max-age={ttl}'
899
907
 
900
908
 
901
- def cache_lookup(cache_key, ttl):
902
- """A live entry rendered as a response (304 if the client already has it), or None on a cache miss."""
903
- hit = current_app.extensions['queryapigate_cache'].get(cache_key)
909
+ def cache_lookup(cache_key, ttl, fields=()):
910
+ """(response or None, generations): a live entry rendered as a response (304 if the client already has it), or
911
+ None on a miss; and ``fields``' generation counters now (live.cache_fields()), for cache_store() to keep - read
912
+ before the query runs, so a change during it leaves the result stored already out of date."""
913
+ hit, generations = current_app.extensions['queryapigate_cache'].lookup(cache_key, fields)
904
914
  if hit is None:
905
- return None
915
+ return None, generations
906
916
  body, content_type, headers, etag = hit
907
917
  quoted = f'"{etag}"'
908
918
  if request.headers.get('If-None-Match') == quoted:
@@ -914,17 +924,17 @@ def cache_lookup(cache_key, ttl):
914
924
  response.headers['ETag'] = quoted
915
925
  response.headers['Cache-Control'] = _client_cache_control(ttl)
916
926
  response.headers['X-Cache'] = 'HIT'
917
- return response
927
+ return response, generations
918
928
 
919
929
 
920
- def cache_store(cache_key, response, ttl, meta=None):
930
+ def cache_store(cache_key, response, ttl, meta=None, generations=None):
921
931
  """Store `response` under `cache_key` for `ttl` seconds and tag it as a fresh cache MISS. `meta`
922
932
  (name/version/connection/format/page) is never consulted to serve a hit - it exists purely for the
923
933
  admin UI's cache browser, see cache.py's ResponseCache.set() docstring."""
924
934
  replay_headers = [(name, value) for name, value in response.headers.items()
925
935
  if name.lower() not in ('content-type', 'content-length')]
926
936
  etag = current_app.extensions['queryapigate_cache'].set(cache_key, response.get_data(), response.content_type,
927
- replay_headers, ttl, meta)
937
+ replay_headers, ttl, meta, generations)
928
938
  response.headers['ETag'] = f'"{etag}"'
929
939
  response.headers['Cache-Control'] = _client_cache_control(ttl)
930
940
  response.headers['X-Cache'] = 'MISS'
@@ -1055,6 +1065,10 @@ def _run_saved(ref, body, url_params):
1055
1065
  raise ApiError('Over MCP, saved queries only read - this one writes, so it is not run here', 403,
1056
1066
  code='read_only')
1057
1067
  agent_write = True
1068
+ if g.get('transport') == 'live' and not sqltools.is_read_only(saved['sql_query'],
1069
+ store.get_connection(connection_name)['db']):
1070
+ # A live query (live.py) is re-run each time its tables change: a write would be repeated with every change.
1071
+ raise ApiError('Only a saved query that reads can be a live query - this one writes', 403, code='read_only')
1058
1072
  # Per-query write curation (apikeys.can_write_query()) only ever adds write reach for this one named
1059
1073
  # query on top of whatever the key's blanket allow_writes already grants - never the other way round.
1060
1074
  effective_allow_writes = g.permission.allow_writes or apikeys.can_write_query(g.permission, query_name)
@@ -1081,9 +1095,10 @@ def _run_saved(ref, body, url_params):
1081
1095
  # A saved query is only ever cached when it declares a cache_ttl *and* its SQL is read-only - never a
1082
1096
  # write, no matter the setting, since serving a cached response would silently skip that write.
1083
1097
  ttl = saved.get('cache_ttl') or 0
1084
- cache_key = None
1098
+ cache_key = generations = None
1085
1099
  if ttl > 0:
1086
- dialect = store.get_connection(connection_name)['db']
1100
+ details = store.get_connection(connection_name)
1101
+ dialect = details['db']
1087
1102
  if sqltools.is_read_only(sql, dialect):
1088
1103
  # Callers with different masking rules get different responses, so they never share one.
1089
1104
  cache_key = cache.ResponseCache.key(name=ref, version=number, connection=connection_name,
@@ -1092,7 +1107,13 @@ def _run_saved(ref, body, url_params):
1092
1107
  workspace=scope.current())
1093
1108
  cache_meta = {'name': path, 'version': number, 'connection': connection_name,
1094
1109
  'format': output_format, 'page': page, 'workspace': scope.current()}
1095
- cached = cache_lookup(cache_key, ttl)
1110
+ # With live queries on, a signal on its tables makes the entry a miss (live.cache_fields(), ADR 0033)
1111
+ fields = ()
1112
+ if config.live_queries():
1113
+ fields = live.response_fields(scope.current(), connection_name, sql, details)
1114
+ cached, generations = cache_lookup(cache_key, ttl, fields)
1115
+ if g.get('transport') == 'live':
1116
+ cached = None # a live re-run happens because the data changed: it refreshes the entry instead
1096
1117
  tracing.set_attributes(query_span, queryapigate__cache='hit' if cached is not None else 'miss')
1097
1118
  if cached is not None:
1098
1119
  return cached
@@ -1114,7 +1135,7 @@ def _run_saved(ref, body, url_params):
1114
1135
  'serialization_ms': g.serialization_ms,
1115
1136
  **masked_entry(result.masked)})
1116
1137
  if cache_key is not None:
1117
- response = cache_store(cache_key, response, ttl, cache_meta)
1138
+ response = cache_store(cache_key, response, ttl, cache_meta, generations)
1118
1139
  elif (g.get('dataplane_record') is not None and g.get('transport', 'rest') == 'rest' and not ttl
1119
1140
  and output_format == 'json'): # the one format the data plane renders
1120
1141
  plan = dataplane.build(g.dataplane_record, g.permission, query_name, number, saved, connection_name, result,
@@ -1331,6 +1352,22 @@ _open_streams = 0 # GET /events streams this process holds open right now - see
1331
1352
  _open_streams_lock = threading.Lock()
1332
1353
 
1333
1354
 
1355
+ @bp.route('/ingest/cdc/<source>', methods=['POST'])
1356
+ def ingest_cdc(source):
1357
+ """Debezium Server's HTTP sink posts its changes here (live.py, ADR 0033 - experimental): each request signed with
1358
+ Standard Webhooks, using the source's secret (/api/v1/cdc-sources, or QUERYAPIGATE_CDC_SOURCES) - outside
1359
+ `default`, at /w/<workspace>/ingest/cdc/<source>. Stored as one `table.changed` signal - the tables that changed,
1360
+ no row data - before answering 204, so Debezium only moves on once it's kept.
1361
+
1362
+ The body is read only up to live.MAX_BODY, and one that says it's larger is refused unread: nothing is checked
1363
+ before it's read (the signature covers it), so an unsigned post could otherwise make this hold any amount."""
1364
+ if (request.content_length or 0) > live.MAX_BODY:
1365
+ raise ApiError('The request is too large', 413, code='payload_too_large')
1366
+ body = request.stream.read(live.MAX_BODY + 1) # bounded however it's sent - chunked has no Content-Length
1367
+ live.ingest(source, request.headers, body, request.environ.get(scope.ENVIRON_KEY))
1368
+ return '', 204
1369
+
1370
+
1334
1371
  @bp.route('/events', methods=['GET'])
1335
1372
  def stream_events():
1336
1373
  """Server-Sent Events: one `data: {...}` line per live event (today: a run, `query.run` - events.run_payload() -
@@ -20,11 +20,21 @@ from collections import OrderedDict
20
20
  MAX_ENTRIES = 10_000 # bounds memory; the least recently used entry is evicted first
21
21
 
22
22
 
23
+ def stale(snapshot, current):
24
+ """Whether an entry stored with generation ``snapshot`` is out of date at generations ``current`` (both
25
+ {field: count}; a field missing counts 0): any counter it depends on has moved since it was stored."""
26
+ return any(current.get(field, 0) != (snapshot or {}).get(field, 0) for field in current)
27
+
28
+
23
29
  class ResponseCache:
30
+ """Entries, and the generation counters live queries' signals move (ADR 0033): an entry stored with the counters
31
+ its query depends on, as they were before it ran, is a miss once any of them moves - see lookup()."""
32
+
24
33
  def __init__(self, clock=time.monotonic):
25
34
  self._clock = clock
26
35
  self._lock = threading.Lock()
27
- self._entries = OrderedDict() # key -> (body, content_type, headers, etag, expires_at, meta)
36
+ self._entries = OrderedDict() # key -> (body, content_type, headers, etag, expires_at, meta, generations)
37
+ self._generations = {} # field (live.cache_fields()) -> count
28
38
 
29
39
  @staticmethod
30
40
  def key(**parts):
@@ -35,25 +45,37 @@ class ResponseCache:
35
45
 
36
46
  def get(self, key):
37
47
  """(body, content_type, headers, etag) for a live entry, or None if missing or expired."""
48
+ return self.lookup(key)[0]
49
+
50
+ def lookup(self, key, fields=()):
51
+ """(hit or None, generations): ``generations`` are ``fields``' counters now - the snapshot to store a fresh
52
+ result with, read before its query runs - and a hit whose own snapshot differs from them is a miss."""
38
53
  with self._lock:
54
+ current = {field: self._generations.get(field, 0) for field in fields}
39
55
  entry = self._entries.get(key)
40
56
  if entry is None:
41
- return None
42
- body, content_type, headers, etag, expires_at, _meta = entry
43
- if self._clock() >= expires_at:
57
+ return None, current
58
+ body, content_type, headers, etag, expires_at, _meta, snapshot = entry
59
+ if self._clock() >= expires_at or (fields and stale(snapshot, current)):
44
60
  del self._entries[key]
45
- return None
61
+ return None, current
46
62
  self._entries.move_to_end(key) # most recently used
47
- return body, content_type, headers, etag
63
+ return (body, content_type, headers, etag), current
64
+
65
+ def bump(self, fields):
66
+ """A signal: every entry depending on any of ``fields`` is out of date from now."""
67
+ with self._lock:
68
+ for field in fields:
69
+ self._generations[field] = self._generations.get(field, 0) + 1
48
70
 
49
- def set(self, key, body, content_type, headers, ttl, meta=None):
71
+ def set(self, key, body, content_type, headers, ttl, meta=None, generations=None):
50
72
  """Store a response and return its ETag (a hash of the body, so it changes only when content does).
51
73
  ``meta`` (name/version/connection/format/page - see app.py's cache_store()) is never used to serve
52
74
  a hit; it exists purely so the admin UI's cache browser (BACKLOG: real-time cache entries) can show
53
75
  something more useful than an opaque hash - see list_entries()."""
54
76
  etag = hashlib.sha256(body).hexdigest()
55
77
  with self._lock:
56
- self._entries[key] = (body, content_type, headers, etag, self._clock() + ttl, meta or {})
78
+ self._entries[key] = (body, content_type, headers, etag, self._clock() + ttl, meta or {}, generations)
57
79
  self._entries.move_to_end(key)
58
80
  while len(self._entries) > MAX_ENTRIES:
59
81
  self._entries.popitem(last=False)
@@ -70,7 +92,7 @@ class ResponseCache:
70
92
  with self._lock:
71
93
  items = list(self._entries.items())
72
94
  out = []
73
- for key, (body, content_type, _headers, _etag, expires_at, meta) in items:
95
+ for key, (body, content_type, _headers, _etag, expires_at, meta, _generations) in items:
74
96
  ttl_remaining = expires_at - now
75
97
  if ttl_remaining <= 0:
76
98
  continue # expired since the snapshot above - about to be evicted on its next get()