Flask -> Redis -> Template -> Datatable

Flask -> Redis -> Template -> Datatable

jdsjds Posts: 1Questions: 1Answers: 0

Hi,

I am populating a datatable through the captioned process.
I.e., I have data in JSON format in a Redis Key Value store.
It's not a massive amount of data ~3MB in data maybe 400 rows, but a complex datamodel.

Once, I click the url (/sheet) to load the data through the flask template, the data loading is really really slow.
~20-30 seconds slow.

The table is shown quickly, but the responsive formatting is only applied once all data has been loaded.
Since I am not too familiar with integrating Datatables with Flask, I'd need advice on how to speed it up?

Should I add pagination to the Flask call and then add that to the logic on the front-end?
But, then how can I hook up the pagination of the datatable to the URL ? This would be javascript to flask.

Or are there pre-built functions in datatable that helps me properly segment the data from Redis?

Many thanks in advance.

Answers

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949

    They way I use Flask with Datatables is to fetch the table data using the ajax option and let Datatables populate the table.

    Sounds like you are using the template to populate the table then initializing Datatables. The first thing to do is to determine if the delay is with using the template to populate the table or if Datatables is taking 20 to 30 seconds to initialize and render the table. Have you tried commenting out the Datatables init code to see how long it takes to display the table?

    Kevin

Sign In or Register to comment.