Questions tagged [peewee]

peewee is a small ORM written in Python, providing a lightweight querying interface over SQL.

peewee is a small ORM written in Python. It provides a lightweight querying interface over SQL, and uses SQL concepts when querying, like joins and where clauses. It supports sqlite, mysql and postgresql.

1197 questions
-1
votes
1 answer

Peewee 3 - Order by and Recursive common table expression (cte)

Tools: Peewee 3, SQLite, Python 3 Official documentation for Peewee 3 recursive common table expression (cte): http://docs.peewee-orm.com/en/latest/peewee/querying.html#common-table-expressions I am storing a family tree in a simple…
-1
votes
2 answers

Is there a specific ordering needed for classes in Peewee models?

I'm currently trying to create an ORM model in Peewee for an application. However, I seem to be running into an issue when querying a specific model. After some debugging, I found out that it is whatever below a specific model, it's failing. I've…
Phlex
  • 401
  • 2
  • 6
  • 17
-1
votes
1 answer

How to return the number of records per day for every day of the year without the costly query in a loop?

In a database table we find records with filepaths, a employee who handled the file(s) and a timestamp when the file was handled. The table "Log" contains only a few thousand records per employee. Per employee there is mostly several records per day…
-1
votes
1 answer

Recommendation for new python user

I'm new on the programming world using python, so i have some questions for desktop aplications development. 1. Im currently using pycharm as my idle, can i use it for my purpose? 2. Can i use peewee as my ORM and Tkinter for my GUI? or should i…
Euri Perez
  • 23
  • 5
-1
votes
1 answer

How to create a record in multiple tables in peewee?

my knowledge about database driven app and database ORM is wee, I have written this model in peewee https://codereview.stackexchange.com/q/210293/22943 and I want to be able to update the 3 tables Patient, Relative and PatientAttendOnVisit at the…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
-1
votes
2 answers

How to store binary data in pewee BlobField

How can I store binary data io.BytesIO() in SQLlite DB using peewee? When I try to store it in BlobField I'm getting following error: ValueError: Value must be either a bytes, memoryview or BigBitFieldData instance.
Leopoldo
  • 795
  • 2
  • 8
  • 23
-1
votes
1 answer

Peewee error on model.create() [ Proxy ]

Hello. When i'm trying to create new record in model, i'm getting AttributeError: 'dict' object has no attribute 'compiler' Possible, that i'm getting this error because using Proxy class, but can't find mistake in my code. init.py from flask…
Chemoday
  • 191
  • 1
  • 8
-1
votes
1 answer

How to init db in Peewee?

I'm new in Flask stack. I need to run some project. I created virtualenv and installed all…
maximkalga
  • 59
  • 1
  • 6
-1
votes
2 answers

How to use input from the user to put as the name of a variable in python?

I have a piece of code I'm trying to write. It is sort of like a lot of functions in one program. I'm giving it the form of a person. So I want to have different "accounts" in it that can change some things in it. This is what I have so far. …
Raamis
  • 1
  • 1
-1
votes
1 answer

Routing Call in Flask leads towards 404 when index routing works

I'm having trouble trying to route URLs in Flask using an Amazon Machine Image (AMI) Apache, and Peewee. Essentially, I'm trying to use a GET to retrieve database content and a POST to insert data into the database. Index routing ("/") works but…
user1449249
  • 196
  • 10
-1
votes
2 answers

'SqliteDatabase' object has no attribute '_meta'

I'm using on Windows python 3.5 and peewee 2.8.0 When trying in my code to run: for field in db._meta.sorted_field_names: print(field.name) This is my output: # py -3 .\basic_example.py Info about Grandma L. using SelectQuery: Grandma…
Djalaboum
  • 1
  • 1
-1
votes
2 answers

peewee, mysql and auto incrementing id

I have model in peewee ORM with unique=True field. Im saving data to my MySQL db like this : try: model.save() except IntegrityError: # do not save if it's already in db pass But when peewee trying to save data that already in db, MySQL…
ayb
  • 54
  • 4
-1
votes
2 answers

Sorting foreign key items in the template

The following code works in an application: user.tweets.order_by(Tweet.message) The following code works in a jinja2 template: {% for tweet in user.tweets %} But the following code fails in a template: {% for tweet in…
stenci
  • 8,290
  • 14
  • 64
  • 104
-1
votes
3 answers

Dynamically define name of class in peewee model

I'm trying to assign a class name dynamically using a string. Much like this... classname='cats' class classname(peewee.Model): Peewee doesn't seem to think I should be able to do this and I'm having a lot of trouble finding a way to define the…
Byron Hill
  • 11
  • 1
  • 6
-2
votes
1 answer

peewee.IntegrityError: NOT NULL constraint failed: user.id

''' from peewee import * forum_db = SqliteDatabase("forum.db") class BaseModel(Model): class Meta: database = forum_db class User(BaseModel): name = CharField(unique = True) id = IntegerField() class Post(BaseModel): id =…
1 2 3
79
80