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

unknown heroku error/behavior for flask app using peewee/flask/postgres

I have 2 issues: I have an error below which I am not sure how to solve or what it means Flask ignores my requirements.txt , how to force it to always install it? 2021-02-08T03:54:08.379200+00:00 app[web.1]:…
0
votes
1 answer

How to show a list of same column value item in peewee?

How do i use group_by in python peewee? This is my table: order_id | eatery_id ---------------+-------------------------------------- 1596949079845 | 8e0c6adc-a65e-4a9b-95d2-82284299719d 1596949235150 |…
Jin Tan
  • 518
  • 6
  • 19
0
votes
1 answer

`peewee` how to get the parent model of a foreign key

Let's say I create several pweewee link models db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() class Meta: database = db # This model uses the "people.db" database. class…
Boris Gorelik
  • 29,945
  • 39
  • 128
  • 170
0
votes
1 answer

Looking for a simple way to implement a Simple Update records on My flask application using pewee

So I have controller Page when i defined different functions like adding new records. How ever i want to add a function on how to edit the existing records in a database. def addNewAsset(self, request): # connection =…
0
votes
1 answer

Peewee how select every n+ row?

Hy! How can I select every second or sixtieth row with peewee? For example (1st, 31st, 61st, 91st, ...) I try with loop but it's very disgusting. Every loop I increase the offset. I try the peewee.expression but unfortunately notworking: TypeError:…
0
votes
1 answer

Flask peewee AttributeError: 'ModelSelect' object has no attribute '_meta'

I have a very simple setup, a model and api file in a pipenv flask environment. I'm currently using peewee and been facing an issue with getting all results from a datatable. I've done this before in python and works fine however not sure what in…
JJ The Second
  • 77
  • 3
  • 11
0
votes
1 answer

SQL /peewee. How do I update a record based on condition from another table?

So I am trying to update a store after an item is bought. These are the models I'm working with. class Cart(): user = pw.ForeignKeyField(User, backref="cart_user", null=True) item = pw.ForeignKeyField( Item, backref="cart_item",…
0
votes
1 answer

peewee playhouse.flask_utils import object_list appear nothing in the home page

I am trying to use peewee flask utils but I dont know what's wrong. It doesn't show anything. Here is the code: backend: https://i.stack.imgur.com/sdPoU.png browser display: https://i.stack.imgur.com/PThzr.png html code:…
0
votes
1 answer

how to use backref in peewee

basically im trying to write a index route that returns the posts of a business that a user is subscribed to the last line is throwing an error for the backref (business.posts) # query that finds all the subscriptions of the logged in…
rgohma2
  • 1
  • 1
0
votes
1 answer

delete id but mantain data in Peewee db

I am new in using Flask and Peewee tools. However currently I have the following task: Imagine that someone uploads a dataset (in this case an excel file that will be migrated to a pandas df). This dataset will be processed and then stored in a…
Oliver
  • 443
  • 4
  • 10
0
votes
1 answer

Unwanted chars are added after saving string to MySQL database

I need to update an existing entry in my MySQL database with the help of peewee and experienced a quite weird issue. When I save a number as a string, some new chars will be added after I saved it. For example when I run the below code: obj =…
rihekopo
  • 3,241
  • 4
  • 34
  • 63
0
votes
1 answer

How to disable peewee's automatic connections?

Consider the following piece of code import peewee SQL_CONN = peewee.MySQLDatabase(database=SQL_DATA, host=SQL_HOST, port=SQL_PORT, user=SQL_USER, …
AlanSTACK
  • 5,525
  • 3
  • 40
  • 99
0
votes
1 answer

Building a FIQL query with peewee

I'm attempting to create a function that will take a FIQL formatted string and return a peewee expression. Let's say I have url params in FIQL format like so: fiql_str = "name==Foo,(country==USA;city==Kansas)" Using a FIQL Parser I am able to get…
Donato Perconti
  • 814
  • 2
  • 11
  • 28
0
votes
1 answer

How to find of user exists in mysql table using peewee ORM?

I have this table in mysql, import peewee class User(peewee.Model): username = peewee.Charfield(max_length=60) email = peewee.Charfield(max_length=300) def __repr__(self): return "".format(self.username) when I try…
Chang Zhao
  • 631
  • 2
  • 8
  • 24
0
votes
1 answer

getting error Unexpected value for ''rel_model" Expected "Model", "Proxy", "DeferredRelation", or "self"

I have the following class class User(db.Model, UserMixin): user = peewee.CharField(max_length=255) email = peewee.CharField(max_length=256) class UserRoles(db.Model): user = peewee.ForeignKeyField(User, related_name="roles") I have…
Chang Zhao
  • 631
  • 2
  • 8
  • 24