peewee Questions
3
Solved
If I'm getting multiple records from a database with peewee, I can convert them to dicts like this:
users = User.select().where(User.attribute == some_value).dicts()
However, often I only want o...
1
Solved
I'm currently using Peewee as an ORM in my project. In my current situation, I have some processes each having a database connection. All of these processes need to access a certain table simultane...
2
I know there are a lot of similar questions on StackOverflow, but I have read and re-read them, and I cannot seem to solve my particular issue.
I am developing a Python application that uses Peewe...
Dol asked 26/11, 2015 at 0:6
1
Solved
I'm using Peewee as my ORM. I have a DateTimeField and I want to fetch all records that occur on a certain date:
event_date = '2018-04-18'
event_date_dt = datetime.datetime.strptime(event_date, '%...
2
Solved
I'm using the (awesome) Python Peewee ORM for my Flask project, but I now got stuck trying to do a query with a where value in ['a', 'b', 'c']. I tried doing it as follows:
MyModel.select().where(...
1
Solved
I have a table called jobs with a column called job_num.
How do i return the maximum value of the integers in that column?
I have tried
result = Job.select(max(Job.job_num))
I have also tried ...
Tears asked 20/3, 2018 at 22:49
4
I want a primary key id field to be Bigint
class Tweets(Model):
id = BigIntegerField(primary_key=True)
...
But it needs to be auto_incremented and I can't find a way in the Peewee docs.
Please...
3
Solved
I've looked through all the docs I could find, and read the source code...and it doesn't seem you can actually create a MySQL database (or any other kind, that I could find) using peewee. If so, th...
Binary asked 8/8, 2014 at 0:23
1
Solved
I want to define a table which the table name is gobang_server,i write code as follow:
class BaseModel(Model):
class Meta:
database = database
class GobangServer(BaseModel):
time = DateField(d...
Confiscable asked 29/12, 2017 at 7:2
2
Solved
I'm running nosetests which have a setup function that needs to load a different database than the production database. The ORM I'm using is peewee which requires that the database for a model is s...
1
I have the following code where I'm querying my peewee database. I'm getting an error in the for loop on the line that has term.sets_term_id. This is the error TermsDoesNotExist: Instance matching ...
1
Solved
Is there a way or setting in Peewee where I can get it to print out all the queries being executed in order to debug and understand potential performance issues.
Ectoblast asked 2/8, 2017 at 9:10
3
Solved
I want to have my database implementation in a separate module or class. But I am struggling with a few details. A simple example:
from peewee import *
db = SqliteDatabase(':memory:')
class Base...
3
Solved
is there a way how to obtain last saved row in database while using peewee with all its attributes?
Let's say I do this:
user = User.create(
email = request.json['email'],
nickname = request.jso...
2
Solved
I have been looking a the source code for peewee, specifically Model and the update function: https://github.com/coleifer/peewee/blob/a33e8ccbd5b1e49f0a781d38d40eb5e8f344eee5/peewee.py#L4718
I don...
Narda asked 19/2, 2017 at 2:18
1
Solved
I want to copy the data from multiple database, processing them, and after that moving them to a main database. All the databases have the same schema.
Even if I open and close the databases, peew...
Kassala asked 19/1, 2017 at 12:31
2
Solved
I'm stuck with a problem about querying multiple databases using Peewee:
I have 2 existing mysql databases (let's name them A and B) (Structures are similar because it's two Bugzilla databases)
I...
2
Solved
Suppose I have an object model A with a one-to-many relationship with B in Peewee using an sqlite backend. I want to fetch some set of A and join each with their most recent B. Is their a way to do...
2
Solved
I'm using Peewee with Postgres database. I want to know how to update multiple records in a tabel at once?
We can perform this update in SQL using these commands, and I'm looking for a Peewee equiv...
Allelomorph asked 7/12, 2016 at 22:16
3
When I insert a row, the field is filled with the time when the server was started not the time when the row was inserted. Why is this happening and what is the solution? BTW I am using SQLite.
cl...
2
Solved
I am trying to wrap my head around Tornado and async connections to Postgresql. I found a library that can do this at http://peewee-async.readthedocs.io/en/latest/.
I devised a little test to comp...
Contribute asked 1/10, 2016 at 6:37
1
Solved
I need to use some ORM engine, like peewee, for handling SQLite database within my python application. However, most of such libraries offer syntax like this to define models.py:
import peewee
db...
Assegai asked 8/9, 2016 at 15:59
1
Solved
I have SQLite database with tables that contains dates. I want ot select records that falls in particular range, but I fail to write correct query.
# This query returns nothing
rows = model.select...
Philipp asked 6/9, 2016 at 5:45
1
Solved
The title pretty much sums it up: I would like to specify whether nulls appear first or last in my results. In my specific case, I want to get nulls last with a descending sort order, corresponding...
Hyams asked 23/8, 2016 at 17:17
2
Solved
I am writing a basic gui for a program which uses Peewee. In the gui, I would like to show all the tables which exist in my database.
Is there any way to get the names of all existing tables, lets...
© 2022 - 2024 — McMap. All rights reserved.