Rozen
probably define a new entitiy that holds everything you want to gather?
A
I thought about that but it felt gimmicky. Guess theres no other choice
PSoftware 👨🏻‍💻
good morning
PSoftware 👨🏻‍💻
how to register more than 1 record with ponyorm
PSoftware 👨🏻‍💻
¿?
PSoftware 👨🏻‍💻
one consult, before y after in pony
PSoftware 👨🏻‍💻
?
PSoftware 👨🏻‍💻
yes
Alexander
In a loop
PSoftware 👨🏻‍💻
yes
PSoftware 👨🏻‍💻
more of 15millon register
Alexander
Loop of batch
PSoftware 👨🏻‍💻
I want to upload this information to my database
PSoftware 👨🏻‍💻
error: (2002, "Can't connect to server on 'localhost' (10048)")
PSoftware 👨🏻‍💻
disconnect for limit max_connection
PSoftware 👨🏻‍💻
helpme!
PSoftware 👨🏻‍💻
please
Alexander
It is not pony related case, you should disconnect them manually (since it is a localhost)
PSoftware 👨🏻‍💻
the same happens a remote
Oualid
any update for pony? (migration, async-await )
Alexander
any update for pony? (migration, async-await )
Development was paused for now; I hope to release a version with Python 3.11 support on Monday
Miko
Development was paused for now; I hope to release a version with Python 3.11 support on Monday
Can you please share few words about the state and plans of the project? I like your approach a lot but lack of updates makes me a bit anxious.
Alexander
Can you please share few words about the state and plans of the project? I like your approach a lot but lack of updates makes me a bit anxious.
Our project still in a state when we don't have resources to develop new features. We're struggling to find some time to release new version, but plan is to it today.
Alexander
I merged Python 3.11 support into the main branch. Need a bit more time for the actual release, I think we can do it tomorrow
Ben
That's amazing news thanks a lot!
Christian
Seconded, that's great to hear!
Miko
Our project still in a state when we don't have resources to develop new features. We're struggling to find some time to release new version, but plan is to it today.
Thanks for info and congratulations for the integration of 3.11. Knowing you struggle with resources, do you consider widening the team? Taking some contributors on board?
Miko
I know, but I also see many merge requests that seems to be hanging, and it matters to me how you see the project going forward.
Alexander
Oh thats true
Miko
We could do something like https://github.com/faust-streaming/faust if that's what you mean?
Permalink Bot
We could do something like https://github.com/faust-streaming/faust if that's what you mean?
Permanent link to the faust-streaming/faust project you mentioned. (?)
Alexander
We need to think how to make it accessible to everyone
Miko
Sure
yg
excuse me, how to update multi values at one time ?
yg
there is no update syntax ?
Vitaliy
To update multiple attributes on single entity instance you can use .set() method, for example User[1].set(firstname='Blabal', lastname='Blabloff'). Bulk (dirty) update is not supported.
yg
thanks~ i will
yg
i will try
yg
sorry my fault, actually i want to update multi entity by one condition, eg: update users set status='online' where id > 100;
Ben
Pony is open source after all. You are free to contribute anything :)
Was there anything I can help with to do before the release can be made?
Ben
Or any way I can help make a Github action to publish to Pypi?
plusi
Hi folks, are you planning to support async operations?
Miko
Bulk?
Putting implementation aside, I was wondering what would be a syntax for bulk update? One cool feature of Pony is its Pythonic natural expression. Any ideas how to make bulk in a similar spirit?
Ben
Has anybody seen that error before: pony.orm.decompiling.DecompileError: Unsupported operation: EXTENDED_ARG
Ben
Since migrating to Python 3.11 with the current main branch
Alexander
Ben
Let me try to figure out which generator it comes from
Ben
it's a bit burried in the traceback of my test suite
Denis
Hello. Is the project still supported? When can we expect an update?
Alexander
Hi, we expect to be able to do a release with Python 3.11 support this Saturday
Denis
This is great news. I really like pony orm, but the lack of updates has cast doubt on its continued use.
Alexander
PonyORM 0.7.17 release with Python 3.11 support is out: https://github.com/ponyorm/pony/releases/tag/v0.7.17
Radim
great work! thank you Alex
Dañiel
Thank you!
Alexander
Since we dropped lower python version I think of 0.8 tag but it's okay i think
Alexander
Too late, I think
Ben
Thanks so much! That's amazing news!
Vitaliy
🥳 Greatest news!!!
anand
Thanks Alex !! 🎉
Christian
Amo
Good job. Thanks
Miko
😍
Henri
Hi! That's great news! 👌
Henri
I have a question. Here is my query: def query(self): query = ProductVariation.select(product=self.product) if not self.is_shop_owner: query = query.where(lambda p: p.active is True) query = query.sort_by(ProductVariation.sku) self.product_variation_count = len(query) return query[:] And I get this error: E TypeError: Lambda argument `p` does not correspond to any variable in original query What do I wrong?
PSoftware 👨🏻‍💻
query = ProductVariation.select(lambda a: a.product==self.product)
Alexander
Consider the following query: query = select( a for a in EntityA for b in EntityB if a.attr1 == b.attr2 ) Let's suppose you want to filter the result of the query. You have two similar methods for this: filter and where. Both of them expect the lambda function as an argument. But the meaning of lambda arguments in these methods is different. The filter method is like a filter function in Python. When you use the filter method, lambda receives items from the previous query result: query2 = query.filter(lambda x: x.attr3 > 0) # x is an instance of EntityA In this example, x is actually a from the first query result. You can name lambda argument for the filter function as you wish, so the next example works the same way as the previous one: query2 = query.filter(lambda y: y.attr3 > 0) # y is an instance of EntityA Using the filter method is convenient because you can use any names for lambda arguments.
Alexander
But what if you want to add a condition to EntityB instances that were iterated using the b variable of the original query? They are not included in the query result, so the filter method can't see them. You can try: query2 = query.filter(lambda b: b.attr3 > 0) # Nope, b is still an instance of EntityA But without success: the filter method always passes the query result items to the lambda function, and the name of the argument is not important. With filter you cannot apply additional criteria to objects that are not in the query result. In that case, you can use the second method where: query = select( a for a in EntityA for b in EntityB if a.attr1 == b.attr2 ) query2 = query.where( lambda b: b.attr > 0 ) In the where method, the name of the lambda argument is important; it should be the same as in the original query. As query2 uses the b name for the lambda argument, the result is equivalent to: query2 = select( a for a in EntityA for b in EntityB if a.attr1 == b.attr2 and b.attr > 0 )
Alexander
Now back to your question:
Alexander
In your query, you use where for query result filtering. The where method expects lambda with an argument name that corresponds to the iterator variable from the initial query. But your initial query is not a generator, and it does not have an explicitly specified name for the iterator variable! query = ProductVariation.select(product=self.product) In that case, Pony treats the original query as a generator with an implicitly specified name for the iterator variable. So, your query is equivalent to: query = select( pv for pv in ProductVariation if pv.product == self.product ) The name for the implicit iterator variable is constructed by joining all upper-case letters from the class name and converting them to the lover case: ProductVariation -> pv So, to fix your query, you should write: if not self.is_shop_owner: query = query.where(lambda pv: pv.active is True) But it can be easier to use the filter method in your case, as with filter, you can specify any name for the lambda argument: if not self.is_shop_owner: query = query.filter(lambda p: p.active is True)
Henri
Thanks a lot! That makes sense. I thought you use only the first letter and that what it says in the docs. But to use all capital letters makes more sense.
Henri
Thanks a lot! That makes sense. I thought you use only the first letter and that what it says in the docs. But to use all capital letters makes more sense.
Maybe it would be good to fix it in the docs. In https://docs.ponyorm.org/api_reference.html?highlight=where#Query.where under "Specifying where() condition using lambda function" it says: When the query is written using the select() method of an entity, the query does not have any explicitly defined loop variable. In that case the argument of lambda function should be the first letter of the entity name in the lower case: q = Product.select() q2 = q.where(lambda p: p.name.startswith('A'))