@ponyorm

Страница 3 из 75
Serge
19.10.2016
17:56:47
Hi guys! Great to see Apache 2 license and 4 spaces indentation!:)

Alexey
19.10.2016
19:00:42
Рустамыч
19.10.2016
19:09:34
Как мир тесен )))

Serge
19.10.2016
19:16:42
Как мир тесен )))
That is not a coincidence:)

Google
Rozen
19.10.2016
19:16:47
whut?

i don't speak russian, sorry :(

Serge
19.10.2016
19:17:27
Как мир тесен )))
Translation: What a small world

Rozen
19.10.2016
19:18:04
well yeah, but i don't get the joke this time

Рустамыч
19.10.2016
19:18:14
Alexander
19.10.2016
19:18:48
It seems that several members of this chat know each other for a long time

Serge
19.10.2016
19:19:11
well yeah, but i don't get the joke this time
A couple of Russian guys who know each other by professional interests on the same professional chat

That is what you typically expect to happen, imo

It seems that several members of this chat know each other for a long time
Yeah! I remember you pitching me PonyORM concept on the job interview:)

Alexander
19.10.2016
19:22:29
Yeah :)

Rozen
19.10.2016
19:22:51
oh

awww

sweet

Google
Alexander
19.10.2016
19:27:40
It was in Netrika

Alexey
19.10.2016
19:28:09
Yeah, I figured

Serge
19.10.2016
19:52:16
How was it?)
Interview was great. Though I cannot say the same about the concept

?

Alexey
19.10.2016
19:53:13
Serge
19.10.2016
19:54:49
I felt like I don't swing that way

Alexey
19.10.2016
19:59:46
I felt like I don't swing that way
Didn't get what you mean

Serge
19.10.2016
20:30:57
Didn't get what you mean
I mean it looked like that is not the way I do things

Serge
19.10.2016
20:32:43
There were the second and the third layers of the joke to be honest...:)

You know me. I'm almost complete jerk in such a jokes

Alexey
19.10.2016
20:48:37
hehe)

Luckydonald
19.10.2016
21:13:59
Hello Telegram Group :D

Alexey
19.10.2016
21:16:45
Hello Telegram Group :D
Hey Luckydonald, welcome :)

Luckydonald
19.10.2016
21:25:00
Can I bother you guys with helping me write queries?

Alexey
19.10.2016
21:25:27
Sure, go ahead

Luckydonald
19.10.2016
21:25:31
https://editor.ponyorm.com/user/luckydonald/RssFeedStuff

I am very new to pony and aren't so good with it. I want to retrieve all Messages of a FeedEntry with status "UNREAD"

If I modelled correctly, the feed entry can have multible links, each have a own message. And the feed entry has his own message too

Google
Luckydonald
19.10.2016
21:32:21
So the message is either Feed or Link->Feed

Alexey
19.10.2016
21:34:11
feed_entry = FeedEntry[1] # instance of Feed Entry select(m for m in Message if m.feed_entry == feed_entry and m.feed_entry.status == 'UNREAD')

Oh, we need to check the other relationship in Message too, hold on

Luckydonald
19.10.2016
21:38:06
I assume FeedEntry[1] is the FeedEntry with ID 1?

Alexey
19.10.2016
21:38:42
yes

I am very new to pony and aren't so good with it. I want to retrieve all Messages of a FeedEntry with status "UNREAD"
feed_entry = FeedEntry[1] select(m for m in Message if (m.feed_entry == feed_entry and m.feed_entry.status == 'UNREAD') or (m.link.feed_entry == feed_entry and m.link.feed_entry.status == 'UNREAD'))

here we check both relationships of the Message entity

Luckydonald
19.10.2016
21:45:57
And together with doing that for each feed_entry it would look like this? for m in select( m for m in AMessage if ( m.feed_entry == feed_entry or m.link.feed_entry == feed_entry ) and feed_entry.status == 'UNREAD' for feed_entry in FeedEntry ): do_post(m)

Alexey
19.10.2016
21:50:51
if you want to use two 'for' this is going to be this way

select(m for m in Message for feed_entry in FeedEntry if (m.feed_entry == feed_entry or m.link.feed_entry == feed_entry) and feed_entry.status == 'UNREAD')

in the first case: select(m for m in Message if (m.feed_entry == feed_entry and m.feed_entry.status == 'UNREAD') or (m.link.feed_entry == feed_entry and m.link.feed_entry.status == 'UNREAD')) you iterate over the Message entity and check both relationships

actually, I think you should use the first case scenario

Alexey
19.10.2016
21:57:22
correct if you want to retriewe messages for all of them, you need to remove this condition

Luckydonald
19.10.2016
21:57:40
Right, I want to get all of them.

Alexey
19.10.2016
21:57:55
select(m for m in Message if m.feed_entry.status == 'UNREAD' or m.link.feed_entry.status == 'UNREAD')

Luckydonald
19.10.2016
21:58:04
Oh

Alexey
19.10.2016
21:59:11
you check Message.feed_entry and Message.link.feed_entry relationships

Luckydonald
19.10.2016
21:59:22
This is so short. I guess I was thinking way to complex

Google
Alexey
19.10.2016
21:59:53
each instance of Message can have one of those two relationships, right?

Luckydonald
19.10.2016
22:00:13
Yep

Alexey
19.10.2016
22:00:38
so you need to select the messages where one of the related FeedEntry instances has the status equal to 'UNREAD'

Luckydonald
19.10.2016
22:01:08
And it won't get None errors on m.feed_entry.*?

Alexey
19.10.2016
22:01:36
Nope

it will select only those messages, which have this relationship

Luckydonald
19.10.2016
22:02:16
Or right it is translating it first. So not real python properties. Always forget that.

Cool

Many thanks!

Roman
20.10.2016
08:16:57
I assume FeedEntry[1] is the FeedEntry with ID 1?
AFAIK it could be any primary key

Alexey
20.10.2016
08:40:05
AFAIK it could be any primary key
Correct, this was an example of extracting an instance of FeedEntry. You could retirew it in any other way, for example using FeedEntry.get() https://docs.ponyorm.com/api_reference.html#Entity.get

Serge
20.10.2016
08:49:24
Guys it looks like questions like this could be collected on a special web page with the answers and examples

This would be very handy

Alexey
20.10.2016
11:53:36
Guys it looks like questions like this could be collected on a special web page with the answers and examples
There is such a place https://docs.ponyorm.com/working_with_entity_instances.html

Roman
20.10.2016
11:55:42
Hi is talking about community provided faq I guess

Serge
20.10.2016
14:43:41
Hi is talking about community provided faq I guess
something like that. this page looks a bit tutorialish

may be a wiki or something like that

or... this is great and hacky:) you may post questions on StackOverflow and answer them, even if they wasn't originally asked there

Google
Serge
20.10.2016
14:45:31
this will allow to google an answer and spread PonyORM on SO at the same time:)

Roman
20.10.2016
15:13:58
@lig11 You just want to create stackoverflow

oh, I miss “you may post questions on StackOverflow and answer them”

Luckydonald
20.10.2016
15:20:44
Use the github wiki?

Mikki
21.10.2016
10:38:47
Welcome!

Andrew
21.10.2016
10:39:56
Hi guys!

Quazi Nafiul
21.10.2016
16:46:22
To guys

Really happy to join you all

Alexander
21.10.2016
16:48:22
Welcome

Quazi Nafiul
21.10.2016
16:48:32
Thanks buddy

Luckydonald
24.10.2016
09:34:34
Hey guys I have a problem with the display of the ORM online editor. I found no good place to file an issue, so I went for the doc repo: https://github.com/ponyorm/pony-doc/issues/1

Страница 3 из 75