Skip to content

Tag: flask

Updating HTML Table Every 60 Seconds

I am trying to use an ajax call to update an HTML table every 60 seconds on a flask app. I am very new to flask and jquery, and followed this similar stackoverflow question: Python Flask Refresh table every 60 seconds However my table isn’t displaying any data. Currently my file is setup as below: And my nfl_template.html: When

The function processes the sql request

The function processes the sql request. It receives parameters and one of them can be either “null” or a value (uuid), I need to add this value to where. But there is a problem, because with null “where param is null”, but with the value “where param = value” Example Answer In sql, null = null and null <> null

single or multiple search with a single query based on condition

For example i have this table component_information with these atrribute I will pass the group_code,category_code,compnent_code from the frontend for searching.Now i want to do single or multiple search based on this. Like on first condition if it gets only group_code value from frontend it will do search only based on group_code.On second condition,If it gets group_code and category_code then it

For loop in Jinja2 splitting the chars in nested list, instead of returning whole of nested list

My doubts list is [[‘a’,’b’,’This is a sentence’]] My HTML (Jinja) is My Flask is :- x is giving a,b,T,h,i,s,i,s,a,s,e,n,t,e,n,c,e [Each char one iteration] I expected a,b,This is a sentence. [Only one iteration] How do I resolve this? Thanks in advance! Answer You have dumped the output to json for some reason. Don’t do that. Pass the value of cursor.fetchall()

SQL wildcards in PYMYSQL search

I am struggling to put together a simple SQL wildcard search for my Flask application. I am using an HTML form field to run a simple mysql query “WHERE CustomerName LIKE ‘a%'”- – However I am unable to get the right positioning for the search place holder… here the HTML form field (working fine) The python route and finally