Questions tagged [peewee]
peewee is a small ORM written in Python, providing a lightweight querying interface over SQL.
peewee
1,224
questions
0
votes
0
answers
43
views
How can I execute combined multiple queries using peewee execute_sql
USE_DB_POOL = db_pool_enabled() and not is_test_environment()
if USE_DB_POOL:
db_manager = PooledDatabaseManager(db_config)
else:
db_manager = DatabaseManager(db_config)
class MySQLClient(...
0
votes
0
answers
38
views
How to find user place in DB
I have a peewee class with table for Users
class User(peewee.Model):
"""Class for Telegram user"""
user_id = peewee.BigIntegerField(unique=True)
xp = peewee....
0
votes
0
answers
11
views
Optimization of updating table cells in the database with pewwee python
I'm using the python version 3.12.0
The problem is that updating the data is very slow in this way. It is much more efficient to write all the data from the table into an array of dictionaries, and ...
0
votes
1
answer
18
views
Bind Model schema similar to binding Model database
How can I dynamically bind a schema, similar to binding a model:
db = PooledPostgresqlExtDatabase(
cfg_db, max_connections=8,
stale_timeout=300,
user=cfg_user, password=cfg_password,
...
-1
votes
1
answer
75
views
I installed peewee but it does not support pysqlite in the peewee file
When I try to install it, I get this error.
Collecting pysqlite3
Using cached pysqlite3-0.5.2.tar.gz (40 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
...
2
votes
0
answers
164
views
Improve performance in insert with PGVector with HNSW Index
I am using peewee and PGVector to manage a PostreSQL database with Documents. The documents are chunked into a DocumentChunk class, let's say:
class DocumentChunk(BaseModel):
id = TextField(...
1
vote
0
answers
30
views
How to work with PosrgreSQL's point type in peewee?
How do I work with PostrgreSQL's geometric type point?
When I create the model code with pwiz, a point column is defined as column_name = UnknownField() # point. When I try to read this field, I only ...
0
votes
1
answer
109
views
How can I pass an expression to use in a SQLAlchemy filter or where clause around?
I am trying to reproduce a behavior from ORMs like sqlalchemy and peewee that allow to pass an entire expression as a single argument to a function. For example in sqlalchemy or in peewee that i ...
0
votes
1
answer
31
views
peewee: SQLite - peewee Create() is forcing integer in PrimaryKeyField if leading character is numeric (even if there is a non-numeric in the middle)
Here is my code. The goal is to insert a record into a table and to use two concatenated numeric values (separated with an underscore) as the primary key. Ultimately, this will be made up of an ...
0
votes
1
answer
60
views
creating instance of peewee model returns null None
For some reason I'm in the state of using peewee and this happened:
I've got a big app already and it works everywhere else, I have some Models like this:
class SomeModel(Model):
day = DateField();...
0
votes
0
answers
35
views
Understanding how to bulk insert a many-to-many using PeeWee ORM
I`m a C# developer trying to solve a problem with python, please bear with my nonpythonic practices.
I'm trying to get my head around on how to implement a bulk insert on a Many-to-Many relationship ...
1
vote
0
answers
45
views
Maximum acceleration of large peewee python queries
I have a table in a database that has only 2 fields. I just need to send a certain number of new rows to it, regardless of their pk. The main problem is that queries even to the local database are ...
0
votes
2
answers
87
views
Is it possible save peewee SQL query as string or json and then load back to ModelSelect object
I created a universal keyboard with pagination in telegram bot. It works on a peewee query object ModelSelect, but I can't save it to redis or other storage, now I save it in memory, and every run the ...
0
votes
0
answers
274
views
ORM peewee ModuleNotFoundError: No module named 'peewee'
In venv, I installed the module using the command pip install peewee (it was written into requirements.txt). I wrote this code for testing and got an error: line 1, in <module>
from peewee ...
0
votes
1
answer
111
views
Peewee overwrites default SQL mode
There's no error raised when calling save(), create(), or insert().execute() on a model instantiated with one or more fields omitted, even on fields configured as null=False and default=None (the ...