M
M
mcrack2019-11-17 18:50:08
Python
mcrack, 2019-11-17 18:50:08

How to pull records from a linked table using Peewee?

Hello, those who are familiar with Laravel will understand me very well. In Laravel, to get records from a related table, it is enough to do this: the $user->tweets object, and thus get all the tweets of a particular user.
Now I have started developing in Python, I found a convenient Peewee ORM, but I don’t understand how to make a one-to-one, many-to-many, and many-to-many relationship. As I understand it, through ForeingKey it is done in the model, but how to get, for example, all the user's tweets? If I make userModel.tweets, then I get only the id of the tweet, but how do I get the rest of the info? And what's up with the lazy girlfriend of bound mozhels? Why not make a separate request from each user to get all of their tweets?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question