Store Volto form submissions in PostgreSQL instead of the default soup/annotation storage: form data as JSONB, metadata (content UID, block id, author, timestamps) as columns. Listing, CSV export, clearing and the retention mechanism of the form packages keep working unchanged.
Both maintained Volto form stacks are supported, each via its own adapter on the same table:
- collective.volto.formsupport
(
formblocks; contract verified against 3.3.2) - plone.formblock /
@plone/volto-form-block(schemaFormblocks, Volto 19+; contract verified against 1.0.0a3)
Part of the sqlastack family (built on sqlastack-core).
IFormDataStoreadapters (sqlastack.formstore.store.SQLFormDataStorefor formsupport,sqlastack.formstore.store_formblock.FormBlockDataStorefor plone.formblock) are registered for(IDexterityContent, ISqlastackFormstoreLayer)— install the GenericSetup profile and they win over the default stores, no overrides.zcml needed.- Each adapter registration is guarded by a ZCML condition
(
installed collective.volto.formsupport/installed plone.formblock), so any subset of the two form packages may be present. - Sessions come from a process-wide
sqlastackdatabase registry; writes join the Zope transaction (commit/abort by the publisher). Request-end teardown is wired viaIPubSuccess/IPubFailuresubscribers. - The Python code imports nothing from the form packages or Plone — the adapter contracts are declared purely in ZCML.
-
Add
sqlastack-formstoreto your Plone deployment, next to your form package (collective.volto.formsupport or plone.formblock). The adapters register only for form packages that are importable (ZCML condition), so the package is safe to install ahead of them. -
Configure the database connection in the Zope process environment:
SQLASTACK_FORMS_URL=postgresql+psycopg://user:pass@host/dbname(Optional pool tuning:
SQLASTACK_FORMS_POOL_SIZEetc.) -
Create the schema: run
sqlastack-formstore-migrate(console script; uses the sameSQLASTACK_FORMS_URL). From a source checkout,alembic upgrade headworks too. -
Install the sqlastack.formstore profile (Site Setup → Add-ons).
-
Enable Store on your form block — submissions now land in SQL.
- File attachment fields are not persisted (skipped with a log warning); attachment e-mailing by the form packages is unaffected.
- PostgreSQL only.
uv sync --extra develop
uv run pytest # needs Docker (testcontainers, postgres:16)
Real end-to-end tests (ZCML load, GS profile, adapter override, submit
endpoint through the actual publisher into PostgreSQL) live in tests_plone/
(formsupport, @submit-form) and tests_plone_formblock/ (plone.formblock,
@schemaform-data). They are not part of the default test run — they boot a
full Plone site — and the two suites share file basenames, so run them in
separate pytest invocations (as CI does):
uv sync --extra develop --extra test-plone
uv run pytest tests_plone/ # slow: needs Docker + boots Plone
uv sync --extra develop --extra test-plone-formblock
uv run pytest tests_plone_formblock/
Requires a sibling checkout of sqlastack-core (path dependency via
[tool.uv.sources]).
License: GPL-2.0-only