
Etienne
19.05.2018
13:10:22
Thanks for the help =)

Matthew
19.05.2018
13:11:56
No problem :)

Schimon
21.05.2018
11:20:08
Do you know of an SQLite group?

Luckydonald
22.05.2018
05:26:30

Google

Luckydonald
22.05.2018
05:28:04
TIL There even is a PR for that

Alexander
22.05.2018
06:08:22
@luckydonald nice doggo btw

Luckydonald
22.05.2018
06:19:53
Is from @get_happiness
Edit
This one: https://t.me/get_happiness/586

Jim
24.05.2018
15:54:57
Hello. I have a one to one relationship. Following the doc example : How do I create a default "Passeport" automaticaly each time I create a new "Person" ?
Maybe in the init or Person or anything else ?

Matthew
24.05.2018
15:55:35
def before_insert(self): # make Passport object here
that method is for Person

Jim
24.05.2018
15:56:39
damn !! that one should not have been asked. sorry and thanks

Matthew
24.05.2018
15:56:46
No problem :)
I have found some weird behaviour in Pony I think
If I have a list of objects:
mappings = [X[1], X[2], X[3]]
if I then do:
for x in mappings: print len(x.y)

Google

Matthew
30.05.2018
10:40:21
(where y is a Set)
Pony will issue one big query at the start of the loop, with an in statement, for all mappings objects
so the first query is slow, then the others are very fast
is this intentional?
Nevermind, was working around a problem which turned out to be a missing index on a foreign key :)

Henri
07.06.2018
08:37:33
@akozlovsky Is it possible to use GraphQL together with PonyORM or are their plans to support it?

Alexander
07.06.2018
11:42:18
Vitalii Abetkin wrote the initial version of Pony GraphQL API some time ago, you can find it here: https://github.com/abetkin/pony_graphql
If I remember correctly, it does not fully provide GraphQL cursor API
Currently there are no plans to officially support GraphQL with PonyORM

Permalink Bot
07.06.2018
11:42:20

Henri
07.06.2018
12:25:33
Thanks!

Oleg
10.06.2018
13:09:14
Hi there! ?

Alexander
10.06.2018
13:09:46
You are welcome!

Oleg
10.06.2018
13:10:18
Does pony support asyncio?

Alexander
10.06.2018
13:14:59
Not yet. Maybe later we will add support of it. But it is possible to work with database synchronously even when using asyncio. For simple queries, like, retrieve object by primary key, it will be even faster

Luckydonald
10.06.2018
13:16:10
I'm new to async, so I really don't know.
Tried async yesterday for the first time

Oleg
10.06.2018
13:34:36

Adam
10.06.2018
23:35:23
i use pony with asyncio

Oleg
11.06.2018
11:32:08

Jim
11.06.2018
14:13:24
Hello, what's the usual way to deal with pictures, vidéo, pdf with pony ? Just a string with path to file ?

Google

Alexander
11.06.2018
14:14:44
Yes, it is typically better to store them outside of database. Pony does not have specific "filename" datatype, so you can use str datatype instead

Jim
11.06.2018
14:16:33
ok thanks

Matthew
11.06.2018
18:00:23
I upgraded to postgres 10, and no problems with pony
FYI

Alexander
11.06.2018
18:00:37
Thanks, cool

Henri
11.06.2018
20:50:07
If I have a query like
result = select(article for article in Article
 for author in article.author
 if self.user in author.followers)
Makes it sense to simplify it to
result = select(article for article in Article
 if self.user in article.author.followers)
Or is this not an optimization?

Matthew
11.06.2018
20:51:07
I think the latter is fine
use sql_debug and see what sql is generated

Alexander
11.06.2018
20:54:12
I think it should be about equivalent. Currently Pony translates in to SQL subquery with in. For MySQL it may be more efficient to use join instead of subquery with in. You can suggest Pony to use join by using the following syntax:
result = select(article for article in Article
for author in article.author
if JOIN(self.user in author.followers))
or
result = select(article for article in Article
if JOIN(self.user in article.author.followers))
JOIN is just a hint which may be ignored by Pony for some complex queries

Henri
11.06.2018
20:55:20
I use PostgresQL.

Alexander
11.06.2018
20:55:42
Then it is not necessary

Henri
11.06.2018
20:56:18
And SQLite for testing.
Thanks. So I will use the simplified form.

Alexander
11.06.2018
20:57:44
I think the simplest form is
result = Article.select(lambda a: self.user in a.author.followers)
It is the same query

Henri
11.06.2018
20:58:58
I will try.
@akozlovsky The whole query looks like
def query(self):
result = select(article for article in Article
if self.user in article.author.followers)
result = result.sort_by(desc(Article.created_at))
if self.limit:
result = result.limit(self.limit, offset=self.offset)
return result[:]Is your proposal here possible?

Alexander
11.06.2018
21:03:44
absolutely
def query(self):
result = Article.select(lambda a: self.user in a.author.followers)
result = result.sort_by(desc(Article.created_at))
if self.limit:
result = result.limit(self.limit, offset=self.offset)
return result[:]

Henri
11.06.2018
21:04:27
Great! Tests are passing...

Google

Alexander
11.06.2018
21:04:47
?

Matthew
13.06.2018
11:55:52
Hi, I have a TransactionIntegrityError on a flask view with Pony, when a record is created with a unique constraint, and the user submits two requests in parallel
Should I be setting SERIALIZABLE?
If there's a conflict, the record exists, so I want to return my success message
Could I catch an explicity commit() in a try / except block?