Anonymous
when i call "add" or "set" on a model does it do anything on the db side ?
Alexander
It should not be a problem to update two tables at the same time
As I understand it, the reason for the error that you show is the following:
1) enum value was assigned to Scale.source. Pony see it as an enum value (but doesn't actually support working with enums)
2) After the object was stored to the database, the value was saved as a string
3) Then object was read from the database again, in the same transaction. Pony sees the value from the database and panics, because the string value that was read from database does not exactly match enum value that was initially assigned to the attribute
So, the error has nothing with updating two tables at the same time
Anonymous
oh, ok
Anonymous
seems logical
Anonymous
I will change my Enums then, thanks!]
Alexander
i am new to pony, I don't get the diferencce between flush and commit
flush saves all unsaved objects to database, but does not commit transaction
commit performs flush and then commits transaction
Usually it is not necessary to call flush or commit manually:
* At the end of db_session commit will be executed automatically
* Before each select Pony perform flush implicitly to be sure that select take into account all changes which were made to objects
Usually the only reason to perform flush manually is to get object id value if it is necessary. If id value is generated automatically you need to save object in order to see actual id value
Alexander
So, if you set the same object several times at row, all changes will be combined together to be sent as a single UPDATE
Anonymous
brillant
Anatoliy
when i run Token.select(lambda t: t.token == bearer and datetime.now() <= t.ts + timedelta(seconds=t.ttl))
Anatoliy
i got NotImplementedError: timedelta(seconds=t.ttl)
Anatoliy
I can't use this in PonyOrm? Only static?
Vitaliy
Try t.ts >= datetime.now() - timedelta(seconds=t.ttl))
Anatoliy
same result :)
Martin
using python pony orm with postgres(aws rds)... using it to execute raw sql ... so i created a wrapper class around pony classes to initialize database object
Martin
self.db = Database()
self.db.bind(provider="postgres", user=self.username, password=self.password,
host=self.hostname, database=self.database)
Martin
every time a method is called to execute raw sql query(below line), a new connection is made. when does connection pooling kick in
Martin
self.db.execute(query, query_args)
Martin
or is there a way to set connection pooling params
Young
How can I return an object to json format?
Matthew
obj.to_json()
Jim
I overwrite to_json to serialize some data type like date time from to_dict result. It also permits tu use rapidjson. I might remember Alexander told us that native to_json should not be used
Matthew
Oh yes you’re right Jim, so to_dict() to get a dict and then serialize with any json library
Young
Anonymous
hi,guys,i desgined an ER Dirgarm https://editor.ponyorm.com/user/mlzboy/zzz/designer I have a many to many relationship between Student and Exam through Score Entity,but generate the model seems loop reference,occur error could not find xxx class
Young
I have an entity with 12 attributes, when I do a query and call to_dict method to the result object, it return me a dict with 11 attributes! it takes away one, and that one is precisely an attribute of type LongStr, does that have something to do with it?
Young
this is my original object
Young
and this is the resulting dictionary
Young
I really need help here
Alexey
I really need help here
docs.ponyorm.org
to_dict
“By default this method doesn’t include collections (to-many relationships) and lazy attributes. “
Alexey
to_dict(only=None, exclude=None, with_collections=False, with_lazy=False, related_objects=False)
Alexey
https://docs.ponyorm.org/api_reference.html?highlight=to_dict#Entity.to_dict
Alexey
By default lazy is set to True for LongStr and LongUnicode and to False for all other types.
Young
Alexey
csa3d
pardon me if not completely obvious.. but is there a way to query the physical sqlite filepath of a db?
Matthew
https://stackoverflow.com/questions/13912731/python-sqlite3-get-sqlite-connection-path
Matthew
use db.get_connection() to get the conn object from pony
Alexander
You can get filename that Pony uses to connect to the database as
db.provider.pool.filename
Alexey
csa3d
fantastic info, ty
Lucky
Is there way way to have the minimap not take away 80% of the property window?
Alexey
what device are you using? what is the screen resolution?
Lucky
Standart 13'' macbook, half of the screen.
Lucky
1280px x 800px so the window is 640px x 800px
Alexey
oh, I see
we didn't consider such use case
currently there is no way to adjust the prop window width
Lucky
more like x 747px with the menubar and stuff.
Lucky
Alexey
Lucky
And about the whole "Did-it-save" thing: How about a tooltip over the save button, saying something like "saved 23 seconds ago"?
Something like Moment.js with Tooltip.js could help out there.
Alexey
Lucky
Lucky
#editor #todo
that was something I requested some time ago, but it probably just got forgotten.
Alexey
Lucky
Thankies!
Alexey
Lucky
I have more of those if you like.
Lucky
Like the ability to actually use the "Comments" field in the SQL output.
CREATE TABLE `table` (
`id` INTEGER PRIMARY KEY AUTO_INCREMENT COMMENT "bla blah blah"
Alexey
Lucky
And a pure json output format. Because then I could create my own templates for when forced to use more ugly languages like PHP.
Lucky
Alternatively a way to upload templates or such to Ponyorm.
Alexey
Lucky
For those folks who have to take stuff under version control even if downloading and uploading is quite cumbersome. Still better as a models.txt containing a link to a snapshot.
Lucky
Alexey
integration with git, both the python model and json model description, correct?
Lucky
Lucky
Something went wrong: Invalid discriminator type: None
Lucky
Another idea, not as important:
Having a button & dropdown to move a column between classes (especially between inheranced classes)
If that functionallity is done, maybe even drag and drop could be implemented in a second step.
Lucky
#Bug: When Cloning a diagram to a new name, e.g. export and that one is already existent it creates export_1 instead,
however it still loads export not export_1.
Alexey
Alexey
Lucky
The reason I discovered that bug is that I want to only export part of the diagram to SVG/PNG so I have to duplicate it and delete all the entities I don't want
Lucky
@metaprogrammer spam
Lucky
Either an admin, or telegram itself deleted that user.
Lucky
Who is in charge of this group, or would be, if the creator account would not be deleted?
Lucky
I.e. who to contact best about applying as admin and stuff?
Alexander
At this moment it is better to contact Алексей about this stuff