Noname
I tried with sqlite and memory DB like in example - same result
Volbil
Strange, I never encountered such behaviour before
Volbil
What python version you using?
Noname
3.11
Alexander
Did you override select by any chance?
Alexander
Oh, wait. Pony doesn't support Python 3.11 yet.
Noname
😂
Noname
Course, that I study - worse that I think)
Noname
What version can advice?
Noname
3.10 or earlier ?
Noname
"Can be installed on python 2.7 or 3" - official doc, all info about versions)
Alexander
3.6 - 3.10 included
Alexander
Yeah should be updated
Evan
is there an easy way to select all _attrs_with_columns_ in a query?
Evan
something equilvalent of select * from table
Evan
ended up with something like this
@orm.db_session
def load_table_into_df(table):
attrs = [x.name for x in table._attrs_with_columns_]
data = [el.to_dict() for el in table.select()]
df = pd.DataFrame(data)
return df
Alexander
I really liked firebase
Alexander
Migrations are almost done for postgres almost 2-3 years, to be honest.
PirraToZ
How to add multiple objects to a table at once?
Alexander
At this point it would be not fair to give any promises about its release. Since we gave a lot of them.
Alexander
PirraToZ
Alexander
https://stackoverflow.com/questions/51655297/python-pony-orm-insert-multiple-values-at-once/51670740#51670740
Henri
Migrations are almost done for postgres almost 2-3 years, to be honest.
So it's available on a branch?
Alexander
Henri
Alexander
That would be nice.
Actually migrations and python bytecode support don't intersect in general, so maybe simple merge\rebase should do the job.
Henri
Henri
Alexander
Oh yeah, you're right.
migrations_dev is the branch you need. orm_migrations is a super old migrations approach which was declined.
How can I get these values from the list?
exp:
ids = [1,2,3,4,5,6,90]
User.select(lambda u: u.id in ids) # this not work
Try this:
ids = [1,2,3,4,5,6,90]
values : list["User"] = [ User.get(id = id) for id in ids ]
PirraToZ
this many iterations)
Yes 😅
I don't know if PonyOrm support other method if you found tell me to learn also..
Daniel
Good day everyone, I just started using ponyorm my question is can I separate my models into different files
Daniel
Like all the entity that belongs to use in one file and all the model that belongs to post in another file
Alexander
Whats the problem uve met?
Daniel
Please... I want to ask if ponyorm is still being maintain😕, I want to use it for a big project, that will be hard for me rewrite. Thanks
Daniel
According issues from the pony repo the cockroachdb is no longer supported.
Daniel
I want to know how true
Daniel
And lastly is there a migration tools
Alexander
Any (coding) help would be appreciated
Daniel
Edward
But if the message is >aa
Brandon
Is this an appropriate place to ask a question regarding relationships and cascade delete?
Alexey
Lennart
@akozlovsky Is it possible for you to take a look at this PR:
https://github.com/ponyorm/pony/pull/677
It is a fix for this issue:
https://github.com/ponyorm/pony/issues/675
For the record, it is an issue we are hitting in production. I have deployed a work-around in my system, but it would be nice to slove this properly.
Lennart
Alexander
Evan
hey guys quick question - is it possible to create a constraint where say I have two columns but not both can be filled in - one or the other have to be filled in
Evan
smth like this
https://stackoverflow.com/a/960591/1764089
Alexander
If your database allows that, you can manually add constraint:
alter table ... add constraint ...
And also add before_insert/before_update handlers to the entity with a check
Evan
thank you
Karsten
Hello everyone, I just switched from Python 3.10 to Python 3.11.2. Suddenly get an error in a simple select query.
Does somebody has any idea ?
Christian
Karsten
Evan
how can I choose the schema I create my tables in?
Evan
seems like this is all I need to do?
class Person(db.Entity):
_table_ = ("my_schema", "person_table")
name = Required(str)
Alexander
Yes
Evan
do the a if b else c expressions work now? - I tried them and got a "this expression is too complex" message
https://stackoverflow.com/questions/16115713/how-pony-orm-does-its-tricks#comment59802214_16118756
Alexander
I works if you supply query as a string instead of a generator code
select((x.a if x.b else x.c) for x in X) - does not work
select("(x.a if x.b else x.c) for x in X") - works
Evan
Ok got it
Evan
yeah that worked - though got a weird error when I wrap it with orm.min it returns '\n' but if I wrap an orm.select() with orm.min it returns the correct value
Evan
Also getting an ERDiagramError: Entity Table already exists
when I define define tables in different schemas
ie model1.py
from utils import db
class Table(db.Entity):
_table_ = 'schema1', 'table'
model2.py
from utils import db
class Table(db.Entity):
_table_ = 'schema2', 'table'
Evan
i'd expect this to work but it complains
Evan
when i later do
import model1
import model2
Evan
posted the question here if easier:
https://stackoverflow.com/questions/75602565/in-ponyorm-do-i-need-to-declare-classes-with-different-names-even-if-they-belong
Alexander
Why you are trying to re-create same entity?
Alexander
Ah, different schemas, i see
Alexander
It says about class name, it should be different
Evan
the class names should be different right?
Alexander
Yes