
Grigori
26.07.2018
14:38:23
Thanks! I need to think about it...
Alexander , you know, it would be very cool if all this dialogs from Telegram channel were available online at Pony website for Google to index...
Like old-school subscription lists.
It would really save you a lot of time ))

Google

Jim
26.07.2018
15:09:51
I already thougt to that too. maybe we coulld fill up the pony github wiki like FAQ ?

Grigori
26.07.2018
15:10:27
too much work, I guess. It is easier to just set up some export routine.

Alexander
26.07.2018
15:21:37
Actually we had (and still have) an old-school mailing list which I like for exactly this reason:
http://ponyorm-list.ponyorm.com
Some time ago we moved to Telegram, because it was more "cool", but maybe we need to revive the classic mailing list again. The ability to search archives using Google is very important thing, imo.
Also I probably need to develop a habit to write an answer at some wiki FAQ page instead of answering here, and then referring to this answer in the chat

Grigori
26.07.2018
15:23:27
Alexander , just auto-exporting messages from this chat with a bot will be enough.

J J
26.07.2018
15:23:53
Like the web irc logs

Grigori
26.07.2018
15:27:57
yep

Alexander
26.07.2018
15:39:34
Sounds like a good idea. Can someone suggest such a bot?

Grigori
26.07.2018
16:07:52
Its really easy to write one in Python.

Jim
26.07.2018
18:02:29
But with telegram bot, you loose thr thread thing
I agree on the facr that telegram bot is very easy to work with

Adam
26.07.2018
19:24:54
i looked into making a telegram bot at one point, as ive made a fully working discord bot (that has pony in it)

Jim
26.07.2018
19:51:45
the function is already implemeted https://core.telegram.org/method/messages.getHistory

Adam
26.07.2018
21:33:02
still would need a program to do it automaticly

Google

Johannes
28.07.2018
15:30:21
Hey,
short question into the crowd (but not very important, since it's just syntactic sugar):
Is there a way to clone an Entity-Instance (except for the id) to add a copy of it to the db?

Matthew
28.07.2018
15:49:16
x = X[1]
d = x.to_dict()
del(d['id'])
X(**d)
I think that may work, but may not handle some relationships?

Johannes
28.07.2018
15:54:04
I guess this should work for my case (no child-relationships). So maybe I should just add some baseClass which adds this behaviour as a clone operator.

Jim
28.07.2018
23:29:18
shorter:
```
new = X(*old.to_dict(exclude=['id']))
https://docs.ponyorm.com/api_reference.html#Entity.to_dict

Vitaliy
29.07.2018
06:32:58
More universal solution:
X(**old.to_dict(exclude=[a.name for a in X._pk_attrs_])
Primary key is not necessary can be id, moreover it can be composite

Luis
30.07.2018
23:08:13
Hi, how to can instance an db and tables existent whit pony, sorry for my english

Matthew
31.07.2018
07:30:51
Say in your native language please

Alexander
31.07.2018
07:32:14
He wants to apply pony models to existing database, I think

Jim
31.07.2018
13:19:57
Looking at bufixes maybe you should remove the new releases after 7.3 and put evertyhing after 7.3 in a new 8.0 ? It could prevent auto update of dependencies since they are some backward incompatibility.

Alexander
31.07.2018
13:43:39
I think it is better at this moment to specify exact version of Pony in requirements, as for projects with version < 1.0 minor version can break compatibility. Hopefully most compatibility problems should be fixed in 0.7.6 that we plan to release soon
The version 0.8-dev is used in migration branch. Because of this, it is better to release 0.8 when migrations will be ready. Hopefully it will be soon

Vitaliy
31.07.2018
13:47:53
I have a question about coalese function. If I try to coalesce Json attribute pomy throws TypeError: All arguments of coalesce() function should have the same type, but in case with Json field we can not known what exactly type has an attribute. Maybe it should omit type check for Json attributes?
Here is example code: select(coalesce(u.settings['remind_period'], 7) for u in User)

Luis
31.07.2018
13:49:18
Como hacer uso de una base de datos existente en pony y hacer hacer actualizaciones en los registros

Alexander
31.07.2018
13:51:28
Vitaliy, I think I need to fix it. Can you open an issue for this?

Vitaliy
31.07.2018
13:51:40
Ok

Alexander
31.07.2018
13:52:18
Luis, what database do you use? SQLite, PostgreSQL?
You can define entities and attributes so the resulted table and columns corresponds to the original tables and columns:
class Person(db.Entity):
_table_ = 'Table1'
id = PrimaryKey(int, auto=True, coulmn='ID')
name = Required(str, column='ColumnA')
age = Required(int, column='ColumnB')
and then, when you call generate_mapping, you should not specify create_tables=True, because you want to use existing tables:
db.generate_mapping(check_tables=True)
If some tables has less number of columns than entity expects, you will get an error.
Also, you can define entities using site editor.ponyorm.com and check SQL tab corresponding to the database that you use in order to check that the existing table has the same columns.
Also, you can try this script to automatically generate entity defnitions from existing tables:
https://github.com/abetkin/pony-inspect

Google

Permalink Bot
31.07.2018
14:01:25

Luis
31.07.2018
15:01:59
I share my andvance
Thanks ?

Alexander
31.07.2018
21:22:53
So you were able to connect to existing database and select data from a table. Congrats!

Luis
31.07.2018
21:24:53
Yes, its fantastic pony

Alexander
31.07.2018
21:25:23
Also, keep in mind that it is not necessary to define all attributes at once in all entities. It is enough to define primary key and the most important attributes, and add the rest columns later
You would be able to read such entities, but to create a new objects it is necessary to define all required attributes

Luis
31.07.2018
21:26:49

Alexander
31.07.2018
21:27:30
Yeah, with ORM it looks a bit more concise ;)

印章
01.08.2018
05:50:37
@admin could you remove those spam accounts?

Alexander
01.08.2018
06:16:35
Yes, but he's offline now. They are joining like 10 per day.

Alexey
01.08.2018
06:57:46

Juan
01.08.2018
07:25:16
Proof

Vitaliy
01.08.2018
07:57:45
Spam 2.0 :) Weird

Adam
01.08.2018
07:59:19
im looking into making a bot to automatically deal with them

Google

Grigori
01.08.2018
10:44:02
Alexander , is it possible/safe to automatically generate PrimaryKey based on other attributes of the object that is being created?
For example, I have some routine that concatenates some fields of my object and then takes cryptographic hash of the result. Is it possible to use this result as a PrimaryKey without writing my own classmethods?
Say, I want to be able to write something like:
class HashedEntry(db.Entity):
propertyA = orm.Optional(buffer)
propertyB = orm.Optional(buffer)
hash = orm.PrimaryKey(buffer, default=calculateHash(str(self.propertyA)+str(self.PropertyB))
HashedEntry(propertyA="foo", propertyB="bar")
instead of having to call
HashedEntry.my_create_routine(propertyA="foo", propertyB="bar")
?
Thanks!

Alexander
01.08.2018
11:01:02
you can override __init__ method:
def __init__(self, propertyA, propertyB):
hash = calculateHash(propertyA, propertyB)
super().__init__(hash=hash, propertyA=propertyA, propertyB=propertyB)

Artur Rakhmatulin
01.08.2018
11:08:23
WTF

Grigori
01.08.2018
11:27:19
Alexander , thanks! It's really cool that Pony does not break with this things.

印章
02.08.2018
00:26:02