MySQL/MariaDB dialect plugin for SQLRules (REGEXP, JSON, full-text).
Project description
sqlrules-mysql
MySQL / MariaDB dialect plugin for SQLRules.
Install
pip install sqlrules-mysql
Usage
from typing import Annotated, Any
from pydantic import BaseModel, Field
from sqlrules import Compiler, FullTextMatch, JsonContains
from sqlrules_mysql import MysqlPlugin
class RowFilter(BaseModel):
name: Annotated[str, Field(pattern=r"^A")]
meta: Annotated[dict[str, Any], JsonContains({"active": True})]
body: Annotated[str, FullTextMatch("sqlrules")]
compiler = Compiler(plugins=[MysqlPlugin()], dialect="mysql")
Operators
| IR operator | Notes |
|---|---|
pattern |
REGEXP (case-insensitive under typical collations) |
type_check |
Shape/type predicates from TypeSpec (partial matrix) |
json_contains |
JSON_CONTAINS(column, payload) = 1 |
json_has_key |
JSON_CONTAINS_PATH(column, 'one', '$.key') = 1 |
fulltext_match |
MATCH(column) AGAINST (value) — requires a FULLTEXT index |
Security note
pattern / fulltext_match values are bound parameters, but evaluation cost
is engine-dependent. Prefer static/allowlisted patterns and queries from
untrusted input. See
SECURITY.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqlrules_mysql-1.0.1.tar.gz
(5.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlrules_mysql-1.0.1.tar.gz.
File metadata
- Download URL: sqlrules_mysql-1.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa218908288caa41f58212ed74fe7ab06a04e8e51d8c3d01c8d07dbc2d4e4254
|
|
| MD5 |
2c4ec01f8c0933aed9800e4130bfe072
|
|
| BLAKE2b-256 |
d0830042722fbd0f10c2ba019ed8bd29958bf7787fe0ec9fc72147b2ea3804be
|
File details
Details for the file sqlrules_mysql-1.0.1-py3-none-any.whl.
File metadata
- Download URL: sqlrules_mysql-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc7594d5485a59efb4f0a878961f066445dbdd473a22e8e2fbb8e0b1f1fce7f0
|
|
| MD5 |
dbc4f73b4f0ebc3a0673ef84b94b8849
|
|
| BLAKE2b-256 |
c6a63d9fcb6fc90eab898db9f4fc344165c752f25032b8be2c47f540978a7f7f
|