peewee Questions

3

With Peewee I'm trying to use limit as follows: one_ticket = Ticket.select().limit(1) print one_ticket.count() This prints out 5 however. Does anybody know what's wrong here?
Ironmonger asked 19/11, 2013 at 9:6

3

I am using peewee to access a SQLite DB. I have made a model.py like: from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_...
Yolandayolande asked 19/1, 2017 at 8:7

4

Solved

I'm writing a "multi tenant" application. It's going to be hosted on different subdomains, and based on which subdomain it's hosted, it should use a different database. Is it possible to define, i...
Neela asked 22/12, 2014 at 20:22

3

Solved

I'd like to use peewee to create records from a csv. It looks like the syntax requires keyword args: user = User.create(username='admin', password='test') If the rows in the csv look like (admin...
Sacrilege asked 3/6, 2013 at 18:24

2

Solved

Considering to switch from SQLAlchemy to peewee but have a fundamental question as I'm not able to find an example of this. I want to execute a query that returns a list of the matched objects. Wha...
Lichen asked 4/8, 2017 at 7:55

3

Solved

I have a peewee model like so: class User(peewee.Model): name = peewee.CharField(unique=True) some_json_data = peewee.CharField() requested_at = peewee.DateTimeField(default=datetime.now()) I...
Gaytan asked 11/11, 2016 at 18:8

4

Solved

I would like a timestamp field updating each time the record is modified like in MySQL. DateTimeField(default=datetime.datetime.now()) will only set it the first time it is created... Any have a ...
Knowland asked 29/8, 2013 at 23:32

4

Solved

I'm inserting/updating objects into a MySQL database using the peewee ORM for Python. I have a model like this: class Person(Model): person_id = CharField(primary_key=True) name = CharField() I ...
Leyba asked 4/5, 2015 at 19:15

3

Solved

I tried to make a MySQL connection with peewee and followed the tutorial from their website: peewee quickstart So my code is the following: from peewee import * db = MySQLDatabase( host='127.0.0....
Chondriosome asked 13/7, 2020 at 12:1

3

I am a Discord bot developer, and recently completed an order. The client upon setting the application up on their server initially had no issues, but according to them after running for "about thr...
Sargassum asked 27/5, 2019 at 4:45

4

I need to transfer all data from an SQL table to an html page. In SQLAlchemy I would do something like this: class Author(db.Model): id = db.Column(db.Integer, primary_key=True) first = db.Column...
Maddocks asked 3/5, 2017 at 8:57

6

Solved

I am trying to implement a many-to-many scenario using peewee python ORM and I'd like some unit tests. Peewee tutorial is great but it assumes that database is defined at module level then all mode...
Photodynamics asked 13/4, 2013 at 0:22

1

Solved

Is it possible to use SQLite in AWS EFS safely? In my readings trying to determine if this is viable there appears to be some allusions that it should be doable since AWS EFS implemented NFSv4 back...
Coumarin asked 8/2, 2022 at 23:31

7

Solved

I define a lot of model classes using peewee. ClassName.create_table() can generate the table,but only one table. How could I create all tables using a single statement?
Gemperle asked 7/2, 2014 at 15:16

2

Solved

I'm working on simple html scraper in Python 3.4, using peewee as ORM (great ORM btw!). My script takes a bunch of sites, extract necessary data and save them to the database, however every site is...
Northnorthwest asked 2/1, 2015 at 18:54

3

Solved

Using the PeeWee ORM I have the following query: query = DataModel.select()where(DataModel.field == "value") Is there any way to convert query into a pandas DataFrame without iterating over all ...
Whorled asked 4/3, 2017 at 12:47

3

Solved

Simple peewee example: MySQL DB "Pet" with autoincrement "id" and char-field "name". Doing my_pet = Pet.select().where(name == 'Garfield') With .sql() we get the sql interpretation. How to ge...
Tryout asked 21/9, 2015 at 9:23

6

For a model class User(db.Model, BaseUser): name = CharField() phone = CharField() age = IntegerField() points = IntegerField() and a list of fields, lst = ['phone', 'name', 'points'] Is t...
Lindo asked 4/6, 2013 at 21:19

3

I use flask and peewee. Sometimes peewee throws this error MySQL server has gone away (error(32, 'Broken pipe')) Peewee database connection db = PooledMySQLDatabase(database,**{ "passwd": pass...
Lorola asked 2/12, 2015 at 8:40

7

Solved

I'm creating an API using peewee as the ORM and I need the ability to convert a peewee model object into a JSON object to send to the user. Does anyone know of a good way to do this?
Wagon asked 23/2, 2014 at 23:6

2

Solved

I am using ORM peewee for sqlite in Python. I would like to create table Item with field parent_id that will be foreign key to the Item: from peewee import * db = SqliteDatabase("data.db") class...
Fatso asked 28/1, 2020 at 8:22

2

I am trying to write a Python model which is capable of doing some processing in a PostgreSQL database using the multi-threading module and peewee. In single core mode the code works, however, wh...
Terminal asked 22/1, 2019 at 22:55

2

Solved

I'm trying to update many records inside a table using Peewee library. Inside a for loop, i fetch a single record and then I update it but this sounds awful in terms of performance so I need to do ...
Pluviometer asked 30/8, 2018 at 11:55

3

Solved

I am using the Peewee library in Python and I want to check if a query exists. I do not want to create a record if it doesn't exist, so I don't want to use get_or_create. There must be a better sol...
Cholecyst asked 30/7, 2015 at 3:9

3

Solved

Hi I am using Flask Peewee and trying to update merchant_details model but it is not working. Following is the error I am getting: AttributeError: 'SelectQuery' object has no attribute 'update' ...
Uraeus asked 8/10, 2013 at 4:50

© 2022 - 2024 — McMap. All rights reserved.