I have a set that depending on the situation can contain anywhere between 1 and 5 elements. I am saving this set to a database table using a format string. My table contains 5 tables, but when creating it, I did include that it was okay to have null values in the columns. my set below can be: but it
Tag: flask
Best way to check if database already exists with flask-sqlalchemy, otherwise create
I have a database app, and want to create the tables and database on the fly when starting the app for the first time. If the app is restarted, it should only create the database and tables if they do not exist, otherwise ignore this creation. I have a few questions. 1.) Is this a proper way of dealing with
Create subquery using peewee, using `.select` on the subquery results
I have a rather complex peewee query that looks like that: This one actually works, generating the following SQL query: But I don’t really want to use RIGHT_JOIN as it isn’t supported by SQLite. When trying to query using the subquery query and JOINing the Solution table into the subquery’s result, I get an error from peewee. The new query:
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 app.py file is setup as below: And my nfl_template.html: When
AttributeError: ‘NoneType’ object has no attribute ’email’. Flask-sqlalchemy
i’ve a strange problem… i do this: and gives me this problem: Who can help me?? thanks <3 Answer it means it didn’t find any users matching your filter
Compare date of input type datetime with date in SQL using flask
I use this .html page to get input type datetime: And my .py code: my DB: DB Example I want to show only all data of ‘sessioncreate’ when only date of ‘sdate’ equal of today date How can i achieve that? Answer Use the DATE() function. This way you can convert the DATETIME in your database to DATE and easily
How do I create a dict of values from the results of an SQL query?
I’m trying to create a journey booking system in python/flask and am trying to create a dict of starting destinations and their ending destinations to allow me to run some ajax code which restricts the options of selecting destination based on the starting location like this (this is just an example of what I’m trying to create, not exactly the
How do I correct my sql query(s) so i don’t get the error “keyword UNION not expected”?
I have one (possibly two) troublesome raw sql queries in a python flask API. I think the first sql query is causing this error, but I am by no means a master at sql. The database is DB2. The full error is as follows: “[SQL0199] Keyword UNION not expected. Valid tokens: FOR USE SKIP WAIT WITH OPTIMIZE.”. Here are my
ORM query many to many to one, Flask sql-alchemy
I have three flask-sqlalchemy-models. Books – unique entries by admin: class Book(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) book_name = db.Column(db.String(20)…
Best way to create and host a python webapp that takes user input and adds it to sql databases?
I’m currently working on a project to make data entry easier for myself, I have sql tables set up in an azure database, and i can write python code that adds data to them easily enough, but what i …