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
1
vote
1 answer

Why am I getting an empty array response when attempting to render my PostgreSQL data in Flask?

I am struggling to render my PostgreSQL data in my flask app and I am not sure why. The GET route I am attempting to render all of the data with is returning an empty array, even though my data table has 16 records in it (I premade this…
SirJamesG
  • 11
  • 3
1
vote
1 answer

Using multiple gunicorn workers cause the error with status PGRES_TUPLES_OK and no message from the libpq

I have a Flask website that uses the peewee ORM. The connection is managed by FlaskDB. When I only use 1 gunicorn worker, it works well. But as soon as I use 2 or more gunicorn workers, I start getting this error: Traceback (most recent call last): …
antoyo
  • 11,097
  • 7
  • 51
  • 82
1
vote
1 answer

How to create pages pagination using Peewee Flask?

I created a practice blog using Flask and Peewee. I wanted to include pagination in the app . I followed Colifier example blog pagination and it works fine. My question, is there a way for me show number of pages like this: This is the example…
Ismail9403
  • 59
  • 7
1
vote
1 answer

Peewee Meta class inherence

I am struggling with the following: from my_db_definition import db from peewee import * class A(Model): class Meta: database=db table_name = 'random' class B(A): pass when…
Martin
  • 13
  • 2
1
vote
1 answer

Can't order query results randomly with Peewee

I am using MySQL with Peewee. Everything has worked nicely, but now I can't order my query in a random order. Based on the documentation I've tried the following code: import peewee as pw objz = featured.select().order_by(fn.Rand()).limit(5) After…
rihekopo
  • 3,241
  • 4
  • 34
  • 63
1
vote
1 answer

Python Flask-Restful Error: Delete method in API is deleting ALL database entries

I've written a flask-restful API, and a SQLite database with peewee. I am able to 'get' on my list of art pieces that I am storing data for. I am also able to 'get' single pieces, 'post', and 'put' without issue. However, if I want to delete a…
HellowThar
  • 83
  • 1
  • 7
1
vote
2 answers

How to check (count) are returned data?

I have got this query in Peewee: return c = Products.get(Products.sku == article).get() How to check if it returns data? I tried: if c.count() > 0: if len(c) > 0 It does not work for me This is full code: try: r =…
Gundama
  • 33
  • 1
  • 5
1
vote
1 answer

Join Queries in Peewee

Hello Stackoverflow Community, I have just started working on peewee application and little stuck with join queries. Currently, I have following models setup : class Equipment(BaseModel): equip_id = CharField(primary_key=True) is_fullset =…
aak
  • 107
  • 1
  • 4
  • 12
1
vote
1 answer

peewee 'no such table' error

I am trying to put data into a database using flask and peewee, and I have come across the following error: peewee.OperationalError: no such table: post My models.py file is below: from peewee import * import datetime db =…
mathmagician
  • 45
  • 1
  • 3
  • 6
1
vote
1 answer

Peewee Operational Error in Flask app

I am writing a simple social media app using flask python framework and Sqlite as database. But after running the program, it shows the following error. I am kind of confused what is causing the bug. peewee.OperationalError: Connection already…
Naz Islam
  • 409
  • 1
  • 6
  • 20
1
vote
1 answer

Flask/Peewee Delete A Row

I am using Peewee with Flask. I have a table of parts that I want to be able to add to, delete and update from a form. I have the add part working and am working on the delete function. This function will delete a row from the db that is equal to…
user2865435
1
vote
3 answers

Model is not defined

I'm using Flask and Peewee to create models for Users and Appointments, and each of them have a ForeignKeyField referencing each other. The problem is, if I define one above the other, Flask will give me x is not defined. For example: class…
josh
  • 75
  • 1
  • 8
1
vote
1 answer

Peewee Python Default is not reflecting in DateTimeField

Not able to set default timestamp in spite of using DateTimeField(default=datetime.datetime.now) The column is set to not null but no default value is set I have my model import datetime database =…
code_rum
  • 872
  • 6
  • 21
1
vote
1 answer

Peewee ORM sets IntegerField to none

Two servers, different results. Same version of peewee, same version of mysql, same python (2.7.10) code: from peewee import * import pprint mysql_db = MySQLDatabase('my_database', user="root", password="") class ItemType(Model): id =…
1
vote
1 answer

Flask-Security - Application Context Issue - Peewee

I am working on expanding my flask skills and have worked on the treehouse flask social network project and got it to work. I am now playing with changing settings and allowing social login I have moved over to flask-security from plain bcrypt as it…
bobthemac
  • 1,172
  • 6
  • 26
  • 59