Jonah
@metaprogrammer when do you guys expect a migrations to be in beta? Is it a platform for continuous migration?
Jonah
I only ask because I'm presently rolling one myself for my own work.
Alexander
What do you mean by platform?
Jonah
I mean is it going to integrate with the diagram editor?
Jonah
will there be api hooks?
Alexander
Not in the first version
Jonah
Ok I'm currently doing some work to do that with the diagram editor - should we collab?
Jonah
bearing in mind I use Pony to save time because I'm terrible at database design without it
Jonah
is there a curl request you have somewhere that authenticates diagram editor?
Alexander
Please explain your last sentense
Jonah
sorry - Pony has an editor so I'd like to authenticate to pull the code from it with cURL or python requests
Jonah
I have an account - I'd like to know if that breaks terms of service
Jonah
if not I'd like to know if you have some basic code to authenticate (since I don't know how you guys wrote it) so that I can pull the code - thats all 🙂
Alexander
Ah, I don't think we have such functionality now.
Jonah
I will write the code and send you a pull request
Alexander
Currently our migrations are not tied to editor
Jonah
I was thinking it might be a fun exercise
Alexander
Ok, cool, let's try
Jonah
yah I'm keen to whip up something for continuious migration
Jonah
let me analyze post request for auth
Alexander
Keep in mind that editor is not open source software
Jonah
Yes so I'm wondering how I might be breaking your terms by doing this
Jonah
XHRPOSThttps://m.stripe.com/4 [HTTP/2 200 OK 367ms] Response Cookies m expires 2030-02-04T19:03:15.000Z httpOnly true samesite Unset secure true value dospkcodpkocdpskocpskosdpkospkcs Request Cookies m dospkcodpkocdpskocpskosdpkospkcs
Alexander
I think you don't break our terms by doing this
Jonah
ok
Jonah
this is where the POST goes to --> https://m.stripe.com/4
Jonah
what is this?
Jonah
so they handle your auth and billing etc
Jonah
ok I will write some code now - brb
Alexander
We use stripe to bill accounts, I don't think you need to access stripe to do anything with migrations
Jonah
It seems to be where the auth response comes from
Jonah
when you login
Alexander
We handle auth at backend, stripe is not used for it
Alexey
Hey @minskmaz I’m away this weekend Let’s catch up on Monday and see how we can collaborate on this
Jonah
ok!
Alexey
What do you develop @minskmaz ? Can you share the link?
Jonah
Oh there's nothing to show yet. I started this morning on continuous migration concept. Haven't put into version control. I use twisted / klein / treq - is that ok or should I do in python requests?
Alexey
@minskmaz twisted 😱
Alexander
Hi, what do you mean by "the code stops right there"? The code hangs is some lock?
Alexander
What is the last log record that you can see?
Alexander
When you create an object, like x = MyObject(foo=10, bar=20) the object doesn't become saved to database right now, it will be saved later when it become necessary (like, before exit from db_session or before executing a query) It is possible that your application creates object in memory and than hangs for some reason unrelated to Pony (like, waiting for some queue or lock) After object creation you can force insert by performing explicit flush(). It is not necessary, but maybe it will make for you easier to debug the problem
Alexander
Are you sure that pony-related code is executed at all?
Alexander
I mean, in db session
Alexander
Yes, I mean the following code, that wrapped in db_session
Alexander
Try to use db_session with sql_debug=True option Maybe the debug turned off for some reason?
Alexander
Or maybe the log messages are suppressed?
Alexander
Do you have explicit flush() after object creation?
Alexander
And how the line where you create an object looks like?
Alexander
I suspect some typo somewhere
Alexander
Do print after flush executed correctly?
Alexander
What is the reason for rollback? Do you see some exception?
Alexander
Can you show me the whole method? You can send it privately if you wish
Alexander
Normal execution should not lead to rollback, and if you have rollback that there should be a reason for this (explicit rollback() or catching an exception)
Alexander
So the reason was an unhandled exception during object creation which does not appear in output, because the function was executed in a separate thread
Anonymous
Hello. I have an issue with show() method. Full code: # Person class is just a Person from official docs mary = Person.get(name='Mary') orm.show(mary) Then I get an error: --------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-22-86c678a1794a> in <module> ----> 1 orm.show(mary) ... Large Error ... :\users\user\appdata\local\programs\python\python37\lib\site-packages\pony\orm\core.py in __init__(self, query, limit, offset, lazy) 6292 __slots__ = '_query', '_limit', '_offset', '_items', '_expr_type', '_col_names' 6293 def __init__(self, query, limit, offset, lazy): -> 6294 translator = query._translator 6295 self._query = query 6296 self._limit = limit AttributeError: 'list' object has no attribute '_translator' You can see full error log in file below
Anonymous
Anonymous
How can I solve it? All of the code I used is code from official "Get Started". I translated this page to Jupyter Notebook (it's how I learn new libraries) and got this error.
Anonymous
If you want to look at this notebook with error
Anonymous
Matthew
I think the problem is that you are trying to show a pony object rather than a query. It is normally used like Person.select(lambda p: p.name == ‘Mary’).show()
Matthew
You could do mary.to_dict() to show the object’s data
Anonymous
You could do mary.to_dict() to show the object’s data
Yes, maybe, but I just run code from official docs
Matthew
Where do the official docs show that use of “show”?
Anonymous
Where do the official docs show that use of “show”?
https://docs.ponyorm.org/firststeps.html#getting-objects
Anonymous
Matthew
Ah you are right
Anonymous
Is it bug?
Anonymous
I am using Python 3.7
Alexander
Hi kop! I think this is a bug, I'll try to fix it a bit later today
Anonymous
can I see any big projects written using Pony?
Anonymous
Hi there, I'm currently in the design phase for a new web application providing league results and ranking tables. Due to the fact that this app should serve different leagues, I'd like to break things up in smaller portions, means that I try to use a schema in PostgreSQL like <league>.<league_abbr>_<season>_results and <league>.<league_abbr>_<season>_ranking. The _ranking tables are calculated through Pandas, which only can either append or recreate when using their direct to_sql-function on dataframes. The main problem now is that I'd like to use a common model with various table names, which may also change in the frontend when the visitor views results of more than just one league, maybe also from multiple seasons. And it should be able to read from existing tables not created through the ORM layer itself. I'm now somehow stuck on how to solve this. Maybe one of you has some idea or a solution in the bottom drawer. 🙂 Many thansk in advance! Regards, Thomas
Matthew
can I see any big projects written using Pony?
I think most big projects are commercial and therefore not available to share.
Matthew
Thomas, maybe it would be easier to not have many tables and work out how to take the results from pandas and use pony to insert them into the database?
Anonymous
Anonymous
E.g how to create separate threading class of Database and put entities into it for make ability to use it in other threads
Alexander
For example, we used Pony in https://fineartbiblio.com/ (it is a commercial project, sources are not available)
Anonymous