[sqlalchemy] Non negative integer column

2013-06-09 Thread Avishay Balderman
Hi I would like to create a table with an integer column. This column value must be = 0. How can I enforce it using table defintion? i have looked here and it looks fine. http://docs.sqlalchemy.org/en/rel_0_8/core/schema.html?highlight=checkconstraint#sqlalchemy.schema.CheckConstraint Will it work

[sqlalchemy] Ordering by composite column gives sqlite3 OperationalError

2013-06-09 Thread Greg Yang
Right now query.order_by(composite) gives a sqlite3 operational error, because the rendered SQL is ORDER BY (composite_val1, composite_val2, composite_val3) instead of ORDER BY composite_val1, composite_val2, composite_val3. (The parenthesis is causing an error) For example, consider the code

[sqlalchemy] using contains_eager with multiple aliases?

2013-06-09 Thread Gerald Thibault
I have a polymorphic class with a self-referential parent-children relationship. In an ideal world, I'd be able to do: session.query(Item) \ .options(joinedload('children')) \ .all() and get the info I need, but I'm on mysql, so this isn't doable due to sqlalchemy insisting on

Re: [sqlalchemy] Ordering by composite column gives sqlite3 OperationalError

2013-06-09 Thread Michael Bayer
On Jun 9, 2013, at 3:12 PM, Greg Yang sorcerero...@gmail.com wrote: So it seems like a fairly simple bug. sure, please post a ticket at http://www.sqlalchemy.org/trac/newticket -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: [sqlalchemy] using contains_eager with multiple aliases?

2013-06-09 Thread Michael Bayer
On Jun 9, 2013, at 7:41 PM, Gerald Thibault dieselmach...@gmail.com wrote: I have a polymorphic class with a self-referential parent-children relationship. In an ideal world, I'd be able to do: session.query(Item) \ .options(joinedload('children')) \ .all() and get the

Re: [sqlalchemy] Non negative integer column

2013-06-09 Thread Rory Hart
from sqlalchemy.dialects.mysql import INTEGER as Integer my_int = Column(Integer(unsigned=True)) from: http://blog.luhn.com/post/20919696026/unsigned-integers-with-sqlalchemy-and-mysql Keep in mind, as Theron notes on his blog post, that this is MySQL specific so you won't have compatibility

Re: [sqlalchemy] Non negative integer column

2013-06-09 Thread Michael Bayer
have you considered just using an UNSIGNED INT ? MySQL offers support for such types. The CHECK constraint is a good way to go as well, but unfortunately I believe MySQL does not actually enforce CHECK constraints (funny, huh?) . Here's an SO question regarding that issue:

Re: [sqlalchemy] using contains_eager with multiple aliases?

2013-06-09 Thread Michael Bayer
On Jun 9, 2013, at 8:06 PM, Michael Bayer mike...@zzzcomputing.com wrote: SELECT items.id AS items_id, items.item_type AS items_item_type, items.parent_id AS items_parent_id, items_ext.id AS items_ext_id, items_ext.custom_name AS items_ext_custom_name, items_1.id AS items_1_id,