This release is a pre-release and may not be stable for production use.
DataTables Python server-side libraries
This is a collection of Python libraries to provide easy server-side support for the DataTables Javascript library - the Javascript table library.
These libraries provide support for:
- Server-side processing - work with millions of rows
- Editor - CRUD UI for DataTables
- ColumnControl - Column search controls for DataTables
- SearchBuilder - Complex search logic UI
SQLAlchemy Core is used to provide the SQL database integration, allowing a wide range of databases to be supported. Furthermore, the library is framework-agnostic: use it with Flask, FastAPI, Django, or any other Python web framework that can pass a request body and a SQLAlchemy Connection or Engine to a route handler.
Installation
pip install datatables_server
SQLAlchemy 2.x and Python date utilities are the two required dependencies for this library and are installed automatically with the above command. A database driver (e.g. psycopg2, pymysql, aiosqlite) must be installed separately.
Quick Start
The following shows a Flask endpoint that will accept both DataTables and Editor requests:
from flask import Flask, request, jsonify
from sqlalchemy import create_engine
from datatables_server import Editor, Field
app = Flask(__name__)
engine = create_engine("postgresql+psycopg2://user:pass@localhost/mydb")
@app.route("/api/staff", methods=["GET", "POST", "PUT", "DELETE"])
def staff():
with engine.connect() as db:
editor = (
Editor(db, "staff", "id")
.field(Field("first_name"))
.field(Field("last_name"))
.field(Field("position"))
.field(Field("salary"))
)
response = editor.process(request.values.to_dict(flat=True))
return jsonify(response)
Similarly, if your table is readonly, the DataTable and Column classes can be used (this will support DataTables' client-side or server-side processing modes):
from flask import Flask, request, jsonify
from sqlalchemy import create_engine
from datatables_server import DataTable, Column
app = Flask(__name__)
engine = create_engine("postgresql+psycopg2://user:pass@localhost/mydb")
@app.route("/api/staff", methods=["GET"])
def staff():
with engine.connect() as db:
table = (
DataTable(db, "staff", "id")
.column(Column("first_name"))
.column(Column("last_name"))
.column(Column("position"))
.column(Column("salary"))
)
response = table.process()
return jsonify(response)
Documentation
For full documentation, please refer to the DataTables site.
License
MIT — see LICENSE for full text.
Metadata
Release files for datatables-server 3.0.0b1
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 | |
|---|---|---|---|---|
| datatables_server-3.0.0b1.tar.gz | 79.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datatables_server-3.0.0b1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 172.4 kB
Release files / datatables_server-3.0.0b1.tar.gz
| Download URL | datatables_server-3.0.0b1.tar.gz |
|---|---|
| Size | 79.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47ebd8fecd992b414e09bc7722be80164888abb9ef7d68cd406d113475ed756c
|
|
BLAKE2b-256 checksum How to use checksums |
c1e094c1093f48125c6f31a85e9b13b5d24569d966bc8b868e750a5bd0318b97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / datatables_server-3.0.0b1-py3-none-any.whl
| Download URL | datatables_server-3.0.0b1-py3-none-any.whl |
|---|---|
| Size | 92.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00ae0fd7dbb727f6b1dd3249df144fa566a59e648f140d9129d27fb9750bdc73
|
|
BLAKE2b-256 checksum How to use checksums |
937ce956262eb90a4695812f350d82fcde9a2c65d1cd465da38e3a71f737fd67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for datatables-server 3.0.0b1
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.