Skip to content

Instantly share code, notes, and snippets.

View brandomr's full-sized avatar

Brandon Rose brandomr

View GitHub Profile
@kaiserama
kaiserama / DataTables.py
Last active March 16, 2022 14:52
Jquery DataTables class implementation in Flask with MySQL. There was an example of using DataTables with MongoDB + Flask, but nothing for using MySQL + Flask. Be sure you install Flask-MySQL extension first!
from MySQLdb import cursors
from flask import request
class DataTablesServer(object):
def __init__( self, request, columns, index, table, cursor):
self.columns = columns
self.index = index
self.table = table
# values specified by the datatable for filtering, sorting, paging