SQLAlchemy_JSONField
SQLALchemy JSONField implementation for storing dicts at SQL independently from JSON type support.
Why?
SqlAlchemy provides JSON field support for several database types (PostgreSQL and MySQL for now) and semi-working dict <-> JSON <-> VARCHAR example, but… In real scenarios we have tests on sqlite, production on MySQL/MariaDB/Percona/PostgreSQL and some of them (modern Oracle MySQL & PostgreSQL) support JSON, some of them (SQLite, Percona & MariaDB) requires data conversion to Text (not VARCHAR).
As addition, we have different levels of Unicode support on database and connector side, so we may be interested to switch JSON encoding between deployments.
Solution:
SQLALchemy JSONField has API with suport for automatic switch between native JSON and JSON encoded data, and encoding to JSON string can be enforced.
Pros:
Free software: Apache license
Open Source: https://github.com/penguinolog/sqlalchemy_jsonfield
Self-documented code: docstrings with types in comments
Uses native JSON, if possible
Support miltiple Python versions:
Python 2.7 Python 3.4 Python 3.5 Python 3.6 PyPy PyPy3
Usage
Direct usage with MariaDB (example extracted from functional tests):
import sqlalchemy_jsonfield
class ExampleTable(Base):
__tablename__ = table_name
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
row_name = sqlalchemy.Column(
sqlalchemy.Unicode(64),
unique=True,
)
json_record = sqlalchemy.Column(
sqlalchemy_jsonfield.JSONField(
# MariaDB does not support JSON for now
enforce_string=True,
# MariaDB connector requires additional parameters for correct UTF-8
enforce_unicode=False
),
nullable=False
)
Usage on PostgreSQL/Oracle MySQL(modern version)/SQLite(testing) environments allows to set enforce_string=False and use native JSON fields.
Testing
The main test mechanism for the package sqlalchemy_jsonfield is using tox. Test environments available:
pep8 py27 py34 py35 py36 pypy pypy3 pylint docs
CI systems
For code checking several CI systems is used in parallel:
Travis CI: is used for checking: PEP8, pylint, bandit, installation possibility and unit tests. Also it’s publishes coverage on coveralls.
coveralls: is used for coverage display.
Circle CI: is used for functional tests at separate docker infrastructure. This CI used for HUGE tests.
CD system
Travis CI: is used for package delivery on PyPI.
Metadata
Release files for SQLAlchemy-JSONField 0.6.2
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 |
|---|---|---|---|---|
| SQLAlchemy-JSONField-0.6.2.tar.gz | 11.4 kB | Without provenance | Details for SQLAlchemy-JSONField-0.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| SQLAlchemy_JSONField-0.6.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for SQLAlchemy_JSONField-0.6.2-py2.py3-none-any.whl |
Total release size: 19.0 kB
Release files / SQLAlchemy-JSONField-0.6.2.tar.gz
| Download URL | SQLAlchemy-JSONField-0.6.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dfa9b7fc4eb2a1ee7782aff589c72e9e86f23706241ab15a2d65700fd92b986
|
|
BLAKE2b-256 checksum How to use checksums |
b8bbadf670069d63deadcc124ffa8fc14362650820b77fa681faf7538f03203c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / SQLAlchemy_JSONField-0.6.2-py2.py3-none-any.whl
| Download URL | SQLAlchemy_JSONField-0.6.2-py2.py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
792591ba7718a7ccace985041afd734bf7527afdafee2d84916cc36bb6c29600
|
|
BLAKE2b-256 checksum How to use checksums |
108d517e939cb2660430679b44438e1a69668bb75b6a475470cc4d71225d6ab9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for SQLAlchemy-JSONField 0.6.2
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.