
Micaiah
15.03.2017
02:00:05
the exception shows up in my console
but in discord is says it worked

Alexander
15.03.2017
06:29:57
Why doesn't the try except work
In Python, context managers inside generator functions cannot catch exceptions which were thrown into a genreator from the outside. If you use an async function, you need to use @db_session as a decorator: https://docs.ponyorm.com/transactions.html#using-db-session-with-generator-functions

Luckydonald
15.03.2017
08:31:36

Google

Micaiah
15.03.2017
20:57:18

BEast
17.03.2017
06:38:00
Hi, guys.
Is it possible to use desc for lambda expression inside order_by?
Like "select((f1.name, f1.price) for f1 in Food).order_by(desc(lambda n, p: n))". Or "...desc(lambda: f1.name)...". The result is the same for both versions.
And it differs from "select((f1.name, f1.price) for f1 in Food).order_by(desc(1))".
Am I not getting something?

Artur Rakhmatulin
17.03.2017
07:16:51
Hi! I recently found similar in the doc on site

BEast
17.03.2017
07:23:35

Alexander
17.03.2017
11:23:40
Hi @bassbeast, yes, it is vald to use desc inside lambda, but not the other way around. That is, instead of
select((f1.name, f1.price) for f1 in Food).order_by(desc(lambda: f1.name))
you should write
select((f1.name, f1.price) for f1 in Food).order_by(lambda: desc(f1.name))
This document doesn't explains how to work with errors...
Maybe we need to add something about exceptions, but if a programmer wrap an async function with @db_session decorator then from the programmer's point of view the handling of errors should look the same as usual, he just need to wrap some lines of code with try..except block.
And if somebody tries to write async code using with db_session context manager instead of @db_session decorator, it just will not work, because in Python context managers cannot catch the event of generator suspending.

BEast
17.03.2017
11:52:45

Alexander
17.03.2017
12:05:43
Sure, we need to fix it

Rozen
18.03.2017
21:14:18
questiong!
can i have a function defined inside a class that extends from db.Entity?
(that uses the database)

Alexander
18.03.2017
21:17:11
It is possible to have a method defined inside an entity subclass, but right now it is not possible to use such functions in queries. We plan to fix it

Rozen
19.03.2017
16:33:14
it has any sense if..

Google

Rozen
19.03.2017
16:33:44
i have a class that has an attribute with defaultvalue 0
but i want a class extending the first class
with that defaultvalue to be .... 5
?
i know databases can have asigned default values
i change my question
there is a way to overload __init__ so i can change one of the defaults values of one of the values with default with another value?

stsouko
19.03.2017
17:34:00
def __init__(self, data):
*magic*
super(Entity, self).__init__(attr1=x, attr2=y)

Rozen
19.03.2017
17:40:03
thanks :D

Micaiah
22.03.2017
00:40:14
https://stateofprogress.blog/choose-sql-d017cfc08870#.tx8i11op2
An article on SQL vs NoSQL that references Pony

Neil
22.03.2017
01:42:25
welp that was dumb of me. I figured it out. I had default=uuid.uuid4() in my entity definitions but couldn't figure out why it was not creating new UUIDs for each time I created a new object
it's been too long of a day :P

Cristian
22.03.2017
03:27:02
Hi i am looking for a ORM to work with sqlite just in readonly mode, i have an existing sqlite db so i want to query it... i see generate_mapping(), i want to know if this will pool and not create tables ?

Micaiah
22.03.2017
03:29:42

Cristian
22.03.2017
03:32:12
@micaiahparker but dont create tables w/ False?

stsouko
22.03.2017
06:03:31

Alexander
22.03.2017
07:07:03
By default generate_mapping just check that all necessary tables present in the database and have all necessary columns (without checking column types, etc.)
Pony does not support reflexion from the database yet, so you need to define entities as a Python classes. If you want to have entity/attribute name which differs from corresponding table/column name, you can set table/column name explicitly

stsouko
22.03.2017
07:12:24
Is it possible to use callable? Good

Luckydonald
22.03.2017
08:45:17

Google

Serge
22.03.2017
20:32:31
https://m.facebook.com/story.php?story_fbid=1431212776900553&id=100000355343616
Sorry for Russian. Hope Facebook will be able to translate it correctly

BEast
22.03.2017
20:34:17

Serge
22.03.2017
20:35:30
This is hard to translate in any way

BEast
22.03.2017
20:37:50

Romet
22.03.2017
20:38:22
i know enough russian to understand the wordplay, but almost nothing else in that post ?

Serge
22.03.2017
20:42:59
Hmm it looks like the things were more complicated than that, I need to delete this

Alexander
22.03.2017
20:43:48
ok ) It was so long ago that nobody remember all the details already )

Serge
22.03.2017
20:51:03

Alexander
22.03.2017
20:51:23
Sure! :)

A
22.03.2017
22:26:39
Hi guys, I just heard about Pony ORM a few minutes ago.
Can anyone tell me how does it compare to SQLAlchemy?
Thanks!

Micaiah
22.03.2017
22:27:12

A
22.03.2017
22:28:58
Thanks for the reply, can you elaborate on "More Pythonic" if you don't mind :)

Micaiah
22.03.2017
22:29:13
Sure!
It takes better advantage of Python features like comprehensions, decorators, and with as part of its core API, whereas SQLalchemy is a straight forward C++ styled API, such as PyQt
(plus it has a really cool editor on the website)

A
22.03.2017
22:56:07
Thanks again! I will check that editor

Micaiah
22.03.2017
22:56:35
Np

Luckydonald
22.03.2017
22:58:43

Google

Micaiah
22.03.2017
22:59:08
I just copy/paste

A
22.03.2017
23:01:00
How is the developement? is it active?

Micaiah
22.03.2017
23:01:12
Quite

A
22.03.2017
23:02:11
I see on github that kozlovsky is the only major contributor
I like the idea, I wish it gains more popularity for more active developement

Micaiah
22.03.2017
23:03:21
@akozlovsky gets work done haha

A
22.03.2017
23:03:37
@akozlovsky ?
So, I am still new to Python, is there a specific part that I should learn to make Pony easier for me?
I know some basics on decorators, map, sum and some other functional programming concepts, but I feel like I need to learn more.
Does Pony require a strong functional programming knowledge or will I be fine with just the basics of Python?

Alan
22.03.2017
23:07:53
For me, understanding list comprehension was that biggest benefit for pony
Because queries become so much simpler

Micaiah
22.03.2017
23:08:46

A
22.03.2017
23:08:59
Yeah, list comprehensions are awesome!

Luckydonald
22.03.2017
23:29:07
Aye

Rozen
23.03.2017
06:25:45
Questiong!
if i have ... lets say class A(db.Entity) , Class B(A) and Class C(A), there would be a way to when loaded any of them as A, to know if it's really A B or C?

Micaiah
23.03.2017
06:27:46
Look up the python docs for isinstance
Basically
class A(db.Entity):
thing = Required(str)
class B(A):
pass
class C(A):
pass
>>> b = B(thing='thing')
>>> isinstance(b, B)
True
>>> isinstance(b, C)
False
>>> isinstance(A(thing='thing'), C)
False

Luckydonald
23.03.2017
09:01:52
Hey, I have a diagram made on the online editor,
Now I have invoted someone else.
How can he edit stuff?
The "save a copy" button says it doesn't work for free users?
But he has no normal "save" button
So, what is the purpose off sharing diagrams with users?

Google

Luckydonald
23.03.2017
09:04:15
He can't do anything
Or do I need to toggle edit rights for him somewhere?
For reference: https://editor.ponyorm.com/user/luckydonald/pbft

Romet
23.03.2017
09:18:00
by the way, I know this is probably unimportant but the english text on pony's website is very.. foreign
is there a way to contribute? as in, suggest changes?
example: Here is Pony query example: vs Here is an example of a Pony query:


Alexey
23.03.2017
09:21:16
hey @luckydonald
currently there is no way for someone else to edit the diagram, the person that you invite can see it in read-only mode
we developed the editor for our internal needs and opened it to public in order to see if it will be useful for someone else
when we found that it actually got traction, we decided to add some other features into it. The work is almost done, we have been adding the following features:
- abiltiy to download a Pony project as a zip file, with models, settings, mixins files in it
- teams - an ability for more than one person to work on a diagram
- ability to assign tag names to diagram snapshots
- Django tab - an ability to get Django project from a diagram
- reflection - an abiltity to build a diagram based on a Pony or Django project
also we've replaced knockout.js with Mobx and ReactJS
we tried to use Redux+ReactJS, and found that it is not easy
then we moved to Mobx and never looked back


Romet
23.03.2017
09:23:01
Huh.. Mobx doesn't look much easier than Redux

Luckydonald
23.03.2017
09:23:11
Oh, that's great,
Do you need beta testers?

Alexey
23.03.2017
09:23:14
I think that we deploy the new interface in beta mode in April-May

Luckydonald
23.03.2017
09:24:57

Alexey
23.03.2017
09:25:27