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

error in flask-peewee Admin User creation

Database example.db is created but generates error !!! Traceback (most recent call last): File "db_testing.py", line 39, in admin.save() File "C:\Users\dell\Envs\surveyApp\lib\site-packages\peewee.py", line 2405, in save new_pk =…
beebek
  • 1,893
  • 5
  • 29
  • 33
0
votes
1 answer

Init an empty Database instance

I want to use a factory method to create an app instance. To do this I need to init a Database inside that function. The problems is that I actually need the object before I create an app instance. I tried this…
kechap
  • 2,077
  • 6
  • 28
  • 50
0
votes
1 answer

flask-classy and peewee, metaclass conflict error

I'm trying to get my user class to work with both BaseModel and FlaskView. This results in the metaclass conflict error and I can't solve it. Things I have tried to fix the problem: This didn't work because of the from noconflict import…
CyberFly
  • 757
  • 1
  • 10
  • 15
0
votes
1 answer

Asking some method in flask-peewee

I have found the method get_flashed_messages() in base.html (from example tweet app of flask-peewee):
{% for message in get_flashed_messages() %}
{{ message }}
{% endfor %}

{% block content_title %}{%…

hepidad
  • 1,698
  • 1
  • 15
  • 16
0
votes
1 answer

Wildcard and search syntax formatting on peewee and python

Trying to refactor out keywordAlt bit in collectionsQuery def countSubject(genres): for keyword in genres: keywordAlt = '%'+keyword+'%' collectionsQuery = Collection.select().join(Subject).where(Subject.name ** keywordAlt,…
Justin
  • 367
  • 1
  • 5
  • 15
0
votes
2 answers

Using Keys as Variables in Python

There is probably a term for what I'm attempting to do, but it escapes me. I'm using peewee to set some values in a class, and want to iterate through a list of keys and values to generate the command to store the values. Not all 'collections'…
Justin
  • 367
  • 1
  • 5
  • 15
0
votes
1 answer

SQLite3 OperationalError: Table XYZ has no column named ABC

I am new to peewee, so please forgive me if this is a stupid question. I have searched on Google and in the peewee cookbook, but found no solution so far. So, I have the following models to four of my DB tables: class games_def(Model): id =…
Matthias
  • 9,817
  • 14
  • 66
  • 125
0
votes
2 answers

Python web.py peewee and heroku

I have a small all based on web.py and peewee. Deployment to heroku goes fine and I have a DB running, but how do I configure peewee to use the heroku postgress db? The peewee documentation doesn't reveal anything useful…
kristian nissen
  • 2,809
  • 5
  • 44
  • 68
0
votes
1 answer

Passing a list from peewee to jinja2 in flask

I'm trying to write a Flask application that queries my database (using peewee), and sends the results into Jinja2 for rendering. My view looks like this: @application.route('/maindash') def maindash(): sq =…
BridgetG
  • 113
  • 1
  • 14
0
votes
1 answer

peewee installer for windows

I'm trying to install peewee on windows machine. Is there an installer for windows? or installation instructions for windows? I'm new to Python/peewee and cant seem to find any.
Erans
  • 401
  • 1
  • 5
  • 11
-1
votes
2 answers

Why columns aren't created via one-to-one relationship

I use peewee as package providing an ORM functionality. I created models related one another by one-to-one relationship. The following code is my models. def __account_model(self) -> Type[Model]: db = self.__sql_db class…
blnk.off
  • 44
  • 5
-1
votes
1 answer

Functions are not populating database

GitHub URL I’m facing issues with three functions in my Betsy electronics project. Possible causes: Indentation errors. Missing imports. Syntax error. File structure: ├── README.md ├── betsy.db ├── license.txt ├── main.py ├── models.py └──…
-1
votes
1 answer

Peewee updating the single record using save method

Lets say I have two models. User and Post. I am iterating over the users and updating few fields lets day likes, dislike etc. The problem is, when I pass the likes n dislikes as integer, it is getting assigned as tuple and its causing issue while…
lazy_coder
  • 13
  • 4
-1
votes
1 answer

PeeWee Relational Databases - Getting TypeError: expected str, not ModelBase

I am working with SQLite and peewee and have run into a TypeError that im not sure how to fix. Here is my program. file = 'network.db' if os.path.exists(file): os.remove(file) db = pw.SqliteDatabase(pw.Model) class BaseModel(pw.Model): class…
-1
votes
4 answers

Get range of dates across multiple years

I have a sqllite table which contains a datetime col of dates and col of real numbers. Any ideas on how i can query to get all all the years within that date range Note the dates are stored as yyyy-mm-dd For example if I had a table with all the…
B4dmonkey
  • 112
  • 1
  • 2
  • 12