Questions tagged [flask-peewee]

A flask web framework extension that provides a layer of integration between flask and the peewee orm.

Website for Flask-Peewee: https://flask-peewee.readthedocs.io/en/latest/

Website for the peewee ORM: https://peewee.readthedocs.io/en/latest/

104 questions
0
votes
0 answers

peewee.ProgrammingError: column must appear in the GROUP BY clause or be used in an aggregate function

I am trying to write a query in Peewee with a PostgreSQL backend to return the top product exported by each state based on the export_value for a given product-state pair. Here is the query I have right now: subquery = ( …
MarcioPorto
  • 555
  • 7
  • 22
0
votes
2 answers

Peewee AttributeError - When select with more than one join

I needs help please, I'm getting the following error when I try a select with join in a existing database (it's from a client, and I have only permission for read (select) I can't modify it in any aspect) May be the error is in the model classes,…
0
votes
1 answer

Flask with SQLite and peewee returns only 20 results/rows

I have been developing a flask based app for my college event. I have used an SQLite database along with Peewee and it's playhouse extensions. There is a particular page where I need to show all the entries from a database table. # The…
0
votes
3 answers

How to get insert return value using peewee?

I use peewee in my project, my table has a filed named is id and it's auto increment and primary key. I need to get id value when API insert function is called. My Model is class UserModel(pw_db.Model): id = IntegerField(primary_key=True) …
Yang
  • 215
  • 1
  • 3
  • 12
0
votes
1 answer

Get next row in peewee

I creating blog using Flask and peewee this is the sample query to get the current post using url total_data = wired_model.EN.select().order_by(wired_model.EN.id.desc()) post = total_data.where(wired_model.EN.url == url).get() I am using total_data…
Jeeva Kumar
  • 353
  • 2
  • 8
0
votes
0 answers

flask pagination object_list not defined

I am trying to paginate results in my Flask app with peewee model but get this error: ... File "/home/pi/ehome/main/app.py", line 148, in financeAll return object_list('/financeAllTrans.html', trans_list) NameError: name 'object_list' is…
michal
  • 327
  • 4
  • 15
0
votes
1 answer

Error as I'm switching to peewee for flask app. 'peewee.IntegerField object' has no attribute 'flags'

I began switching from using standard basic SQL in my flask app to using peewee and am getting a weird bug I cant seem to find any info about. My endpoints are working fine but when I tried going to the landing page I get…
0
votes
2 answers

How to create the tables in a model FlaskDB with peewee?

Going off the documentation here. I have this code: from playhouse.flask_utils import FlaskDB, app = Flask(__name__) app.config.from_object(__name__) flask_db = FlaskDB(app) database = flask_db.database class Item(flask_db.Model): title =…
BigBoy1337
  • 4,735
  • 16
  • 70
  • 138
0
votes
1 answer

Search all records/rows in Peewee ORM model that contain a given word in a column

I have the following peewee model: class Product(peewee.Model): key = peewee.IntegerField(unique=True) name = peewee.CharField(null=False) is_active = peewee.CharField(null=True) base_price = peewee.IntegerField(null=True) I would…
M.E.
  • 4,955
  • 4
  • 49
  • 128
0
votes
1 answer

Flask Form Only Passing First Item

I am building a cart using Flask for learning purposes. I chose to use SQLite with peewee(ORM) and WTForms. I have it set to display the items from the db with a description and image. I have a form that asks for the quantity then it should add the…
user2865435
0
votes
1 answer

Peewee model_form not updating

I am using Peewee's model_form to update an instance of an entry in my database. Below is my code for the form, template and app. For some reason, I don't think I am getting a POST when I submit the form, but I am writing my code the same way I did…
Brian
  • 421
  • 3
  • 20
0
votes
1 answer

Compare string with CharField with peewee?

I'm trying to get a list of results where the given string address is in models.Listing.address. My code at the moment is: @app.route('/search/
') def search(address): results = models.Listing.select().where(address <<…
TomHill
  • 614
  • 1
  • 10
  • 26
0
votes
2 answers

Test peewee fn.rand error

I'm writing the API tests and when I use peewee function fn.Rand() I get this error: cursor.execute(sql, params or ()) OperationalError: no such function: Rand My code is: query = Questions.select().order_by(fn.Rand()).limit(limit) list =…
Rangel
  • 11
  • 2
0
votes
0 answers

Peewee Flask Test API in memory

I want to test my application API using Flask + Werkzeug + SQLite in memory. The application was configured using application factory pattern, like this: def create_app(config_name): application = Flask(__name__) …
Rangel
  • 11
  • 2
0
votes
2 answers

Flask-peewee to Flask-sqlalchemy - Operand should contain 1 column(s)

I am having an issue with this error Operand should contain 1 column(s), I get that is about their being two fields in the subquery but from my code and using flask-sqlalchemy I can't work out what is going wrong. I am converting my application from…
bobthemac
  • 1,172
  • 6
  • 26
  • 59