Load and deploy Particles
Both methods need Python 3.11 or newer with the particledb package, as python3 on the PATH or named by PDB_PARTICLES_PYTHON. See requirements.
Load at startup
Section titled “Load at startup”Add --python-functions to the start command. It accepts a module file, a package directory or a dotted module name, and can be repeated:
particledb start --data-dir ./pdb-particles --python-functions ./tools.pyUse tools.py from your first Particle, and bind the listeners as in the quickstart. Startup loading registers the functions for that server process only: start the server with the same flags every time. A restart without --python-functions does not have the functions.
Check registration
Section titled “Check registration”SELECT priority(0.9, 0.8) AS score;If the server did not start, read its startup error: a missing interpreter, a missing particledb package, a failed import in the module and a name collision are each reported with the module path.
Verify a module
Section titled “Verify a module”Check a module without a server. This prints each function’s SQL signature:
particledb particles verify ./tools.pyDeploy durably
Section titled “Deploy durably”particledb particles deploy registers the functions on a running server through its SQL client address. A deployed function survives a restart without --python-functions:
particledb particles deploy ./tools.py --target 127.0.0.1:5432 --yesRun particledb particles deploy --help for the other options.
Update a function
Section titled “Update a function”Test a change on a disposable server first. Validate its inputs, outputs, dependencies and any stored results that depend on its old behavior. Keep a previous version of the module available for rollback.
Persistence
Section titled “Persistence”Restart a test server with your production start command and call the function again before depending on it in application queries.
Related
Section titled “Related”This site uses Google Analytics cookies to count visits. Privacy · License