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

Peewee ORM inserts blank value for a column

I've been trying to use peewee orm to insert values to db for my project, problem is that it inserts a blank value for one of the columns for seemingly no reason, I have a for loop inserting these values and it only ignores the url value, heres my…
neophyte88_
  • 1
  • 1
  • 2
-2
votes
1 answer

Convert SQL to peewee

How to convert this to peewee query? _, storage, spaceLeft = db.execute(''' SELECT session, storage, storage - count(questID) FROM Hypos INNER JOIN Quests ON Hypos.hypoID = Quests.hypoID WHERE Hypos.hypoID = ?1 AND session = ?2 GROUP…
-2
votes
1 answer

Is it recommended to create a dataclass to save data queried from peewee or directly modify the model?

I have a model Service to save data from ping probes, so i ping at the IP address, i must enter the result value in a list "history" of 30 values, delete the oldest value in that list and calculate the average to save the list and the average in the…
ehidoz
  • 21
  • 5
-2
votes
1 answer

Safe database query (peewee) from thread Flask

I have couple of simple tasks which could take maximum 20 seconds to complete, so I decided to use separate thread to accomplish them. I want thread to do the job and update database with result. While it works (no exceptions yet) I have lack of…
Olvin Roght
  • 7,677
  • 2
  • 16
  • 35
-2
votes
1 answer

Peewee - Optional fields in Model?

We have a few thousand databases, but the number of columns are not consistent. Is it possible to define columns that may or may not appear in the table? As example: class ContactFields(Model): id = IntegerField() id_2 =…
user1157751
  • 2,427
  • 6
  • 42
  • 73
-2
votes
1 answer

How to select column items of a table from a table with matching id in table referenced

I have two tables: select * from patient WHERE name = 'Dharam'; +----+--------+----------+---------------+-----+--------+ | id | name | townCity | contactnumber | age | gender | +----+--------+----------+---------------+-----+--------+ | 5 |…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
-2
votes
1 answer

Querying flask-peewee REST API by datetime

I'm using flask-peewee, and I'm trying to run a query and filter by a DateTime field. However something like this does not seem to work: http://127.0.0.1:5000/api/obj/?group=1&at_date=Thu,%2021%20Jul%202016%2012:28:29%20GMT Nor do the other formats…
KimiNewt
  • 501
  • 3
  • 14
-2
votes
1 answer

Does anyone have an example to store crawl data from scrapy to MySQLdb using Peewee?

I'm new to Scrapy. I have Googled around and searched in Stack Overflow, but there's no exact things I want to do. I have been struggling with these for two days. This is what I have gotten so far for pipelines.py. Would anyone point out what's…
Ken Hui
  • 31
  • 3
-2
votes
1 answer

Get weekly information about transactions

I have a simple website made with Flask and Peewee as the ORM that annotates the drinks everyone in the office gets to then, once a week or so, check who drink what, how much and when. I have a simple table named orders that looks like this: Orders…
Leandro Poblet
  • 1,424
  • 1
  • 14
  • 19
-2
votes
2 answers

CompositeKey as a foreign key in peewee with mysql

I'm using peewee as my ORM for mysql DB. I have 3 tables in my scheme, one for devices, one for apps and one for results per device per tester app and tested app. the APPS table looks like: package name | version name | version code |apk name the…
codeScriber
  • 4,582
  • 7
  • 38
  • 62
-3
votes
1 answer

Peewee ORM: How get() in column value?

I am trying to select a value from a database by condition. What am I doing wrong?
1 2 3
79
80