sqlrules-postgresql
PostgreSQL backend provider for SQLRules. The package version follows the core 2.x line.
Install
pip install "sqlrules>=2,<3" "sqlrules-postgresql>=2,<3"
Use
from typing import Annotated, Any
from pydantic import Field
from sqlalchemy import Column, MetaData, String, Table
from sqlalchemy.dialects.postgresql import ARRAY, INT4RANGE, JSONB
from sqlrules import ArrayContains, Compiler, JsonContains, RangeContains, RuleSchema, where
from sqlrules_postgresql import PostgresPlugin
rows = Table(
"rows",
MetaData(),
Column("name", String),
Column("meta", JSONB),
Column("tags", ARRAY(String)),
Column("span", INT4RANGE),
)
class RowRules(RuleSchema):
name: Annotated[str, Field(pattern=r"^A")]
meta: Annotated[dict[str, Any], JsonContains({"active": True})]
tags: Annotated[list[str], ArrayContains(["admin"])]
span: Annotated[int, RangeContains(5)]
compiled = Compiler(plugins=[PostgresPlugin(server_version=(16, 0))]).compile(RowRules, rows)
statement = rows.select().where(*where(compiled))
Capabilities
pattern: PostgreSQL~/~*- JSONB containment and key membership
- ARRAY containment and overlap
- Range containment and overlap
- Safe lax text-to-int/float/Decimal parsing on PostgreSQL 16+
String Literal and Enum fields require a column with C or POSIX
collation. Review the type support matrix
for the exact conversion profile and limitations.
Pattern cost
Untrusted regular expressions can cause expensive engine-side evaluation. Prefer patterns authored with the rule model. See the SQLRules security notes.
Metadata
Release files for sqlrules-postgresql 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlrules_postgresql-2.0.0.tar.gz | 4.6 kB | Without provenance | Details for sqlrules_postgresql-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlrules_postgresql-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for sqlrules_postgresql-2.0.0-py3-none-any.whl |
Total release size: 10.9 kB
Release files / sqlrules_postgresql-2.0.0.tar.gz
| Download URL | sqlrules_postgresql-2.0.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5dd4c39e69740d230b61ab928093e8cbc3bf5ed21faac7dac20b6be9a1b8af9
|
|
BLAKE2b-256 checksum How to use checksums |
ce9c50bf90e6702b389f83c37d359d5c49353d8f42e6da4285a6d216efd0e170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / sqlrules_postgresql-2.0.0-py3-none-any.whl
| Download URL | sqlrules_postgresql-2.0.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73897d64071f15a2df7695787b4dbaa2534c524f859aad56dff624e71df0dac1
|
|
BLAKE2b-256 checksum How to use checksums |
6e43dbd1ae465b4ae4532dfb431ff80636683f88a5f2da3449575a958be4fbf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for sqlrules-postgresql 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.