Skip to main content

xyz-tablestore

Django REST Framework integration

Install the optional dependencies with pip install 'xyz-tablestore[rest]'. Configure the OTS environment variables used by Store and provide explicit serializer fields:

from rest_framework import serializers
from rest_framework.routers import DefaultRouter
from xyz_tablestore.rest_framework import TableStoreSerializer, TableStoreViewSet

class UserSerializer(TableStoreSerializer):
    id = serializers.CharField(required=False)
    name = serializers.CharField()
    age = serializers.IntegerField(required=False)

class UserViewSet(TableStoreViewSet):
    store_name = 'users'
    serializer_class = UserSerializer
    filter_fields = ['name', 'age']
    filter_types = {'age': int}
    ordering_fields = ['age', 'id']

router = DefaultRouter()
router.register('users', UserViewSet, basename='users')
urlpatterns = router.urls

Admin permission is required by default. The table and search index must already exist; list queries use the search index. Configure normal DRF authentication in the host application.

GET accepts page (starting at 1), page_size (1-100), ordering=-age,id, and field filters such as age__gte=18 and age__in=18,20. Use filter_types to convert query string values; unspecified fields remain strings. Set filter_fields and ordering_fields to restrict accepted field names. List responses contain count, next, previous, next_token, and results. Follow next for token pagination; do not combine page with next_token. Token pagination has no previous-page link.

POST requires all primary key fields and rejects duplicate keys (400). PUT replaces all attributes with validated writable fields; PATCH only updates submitted attributes. Primary keys cannot change. Null attributes and deletion are not supported in this first implementation. Read-back after writes uses primary-key reads, without waiting for the search index to refresh.

For a custom Store subclass, set store_class. For composite keys, provide custom URL patterns and lookup_fields = {'tenant': 'tenant', 'id': 'pk'}, where values name URL keyword arguments. INTEGER primary keys are converted from URL strings.

The old MongoViewSet, MongoSerializer, and mongo_posted import names remain aliases. Existing subclasses must migrate to explicit serializer fields; Mongo schema inference, random queries, and foreign-key expansion are not used. store_posted is emitted after create/update. send_robust means receiver failures do not roll back writes.

Run isolated tests with python -m unittest discover -s tests.

Metadata

Release files for xyz-tablestore 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for xyz-tablestore 0.1.1
File Interpreter ABI Platform Actions
xyz_tablestore-0.1.1-py3-none-any.whl Python 3 none any Details for xyz_tablestore-0.1.1-py3-none-any.whl

Release files / xyz_tablestore-0.1.1-py3-none-any.whl

Download URL xyz_tablestore-0.1.1-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
012fb20a6286c7913c1e192a4c9905026d1069ac6b9eb177170720b9dbb524ce
BLAKE2b-256 checksum
How to use checksums
e80aabb0cd832f3b34418356ce8e495f9cc1fe04413f7619073dd64944e35990
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for xyz-tablestore 0.1.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page