Re: [sqlalchemy] Belonging to a session vs being in the session

2014-07-25 Thread George Sakkis
On Thursday, 24 July 2014 21:56:11 UTC+3, Michael Bayer wrote: expunge() is a bug: https://bitbucket.org/zzzeek/sqlalchemy/issue/3139/expunge-after-delete-fails it’s supposed to raise (hence can’t fix this til 1.0). so ignore expunge. if you were to emit session.rollback(), you’d find

Re: [sqlalchemy] One-off listeners

2013-11-26 Thread George Sakkis
On Monday, 25 November 2013 17:27:02 UTC+2, Michael Bayer wrote: On Nov 25, 2013, at 9:00 AM, George Sakkis george...@gmail.comjavascript: wrote: Hi all, is there a feature or pattern for adding a listener that is to be executed (at most) once? For example, say you want to send

[sqlalchemy] One-off listeners

2013-11-25 Thread George Sakkis
Hi all, is there a feature or pattern for adding a listener that is to be executed (at most) once? For example, say you want to send an email when user is created and the session is committed. If event.listen() supported a once boolean parameter, this could be expressed as: def

Re: [sqlalchemy] Code organization with declarative models

2013-08-13 Thread George Sakkis
On Tuesday, August 13, 2013 12:59:57 AM UTC+3, Ams Fwd wrote: On 08/12/2013 02:50 PM, George Sakkis wrote: Hello everyone, this is more of a code architecture and design question but I'm wondering what the best practices are regarding declarative models. On the one extreme, models

[sqlalchemy] Code organization with declarative models

2013-08-12 Thread George Sakkis
Hello everyone, this is more of a code architecture and design question but I'm wondering what the best practices are regarding declarative models. On the one extreme, models are pretty barebone, with little more than the columns, relationships and possibly a few declared attributes and

Re: [sqlalchemy] order_by hybrid property fails when specifed as string in a relationship

2013-06-20 Thread George Sakkis
On Wednesday, June 19, 2013 9:47:08 PM UTC+1, Michael Bayer wrote: On Jun 19, 2013, at 4:19 PM, George Sakkis george...@gmail.comjavascript: wrote: It seems that hybrid properties are not allowed to be specified as strings for the order_by parameter of a relationship; attempting

[sqlalchemy] order_by hybrid property fails when specifed as string in a relationship

2013-06-19 Thread George Sakkis
It seems that hybrid properties are not allowed to be specified as strings for the order_by parameter of a relationship; attempting it fails with InvalidRequestError: Class ... does not have a mapped column named '...'. Is this a known limitation or a bug? Sample test case below. Thanks,

[sqlalchemy] Re: Session identity map and PyPy

2013-01-31 Thread George Sakkis
On Jan 30, 3:54 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 30, 2013, at 5:43 AM, George Sakkis wrote: Hello, I am in the process of migrating to PyPy and have a handful of unit test failing due to the different garbage collector and SQLAlchemy's usage of weak references

[sqlalchemy] Session identity map and PyPy

2013-01-30 Thread George Sakkis
Hello, I am in the process of migrating to PyPy and have a handful of unit test failing due to the different garbage collector and SQLAlchemy's usage of weak references in the Session identity map. Most failures are probably safe to ignore and all of them are fixed after manually calling

[sqlalchemy] Re: Non-deterministic insertion order

2012-10-02 Thread George Sakkis
On Oct 2, 10:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 2, 2012, at 4:29 PM, George Sakkis wrote: I had the impression that the Session’s unit of work figures out automatically the potential object dependencies and makes sure that the insertion order is consistent

[sqlalchemy] bindparam ignores required=True

2012-01-21 Thread George Sakkis
Hi, I found an older thread about using a bindparam with required=True (http://groups.google.com/group/sqlalchemy/tree/browse_frm/thread/ cc0cafb0241c51da/a5fdd0aeefecd75c) but the example doesn't work for me on 0.7.4, it still passes None instead of raising an exception. Am I missing something

[sqlalchemy] Re: Query - column names

2009-06-04 Thread George Sakkis
Thanks, didn't know that, though in this case I want the keys in the same column order but keys() doesn't preserve it. George On Jun 3, 8:59 pm, Michael Bayer mike...@zzzcomputing.com wrote: each row has a keys() attribute if that helps... On Jun 3, 2009, at 8:49 PM, George Sakkis wrote

[sqlalchemy] Re: Query - column names

2009-06-04 Thread George Sakkis
On Jun 4, 5:09 am, King Simon-NFHD78 simon.k...@motorola.com wrote: George Sakkis wrote: Is there a (public) API for getting the column names of a given Query instance and other similar introspection needs  ? I didn't find anything related in the docs but after digging in the code I came

[sqlalchemy] Query - column names

2009-06-03 Thread George Sakkis
Is there a (public) API for getting the column names of a given Query instance and other similar introspection needs ? I didn't find anything related in the docs but after digging in the code I came up with col_names = [e._result_label for e in q._entities] but I'm not sure how stable and

[sqlalchemy] Re: Relation spanning multiple tables

2009-06-02 Thread George Sakkis
:46 PM, George Sakkis george.sak...@gmail.comwrote: I can't for the life of me figure out how to specify a relation spanning 3 tables. I think I've tried all combinations of primaryjoin, secondaryjoin, viewonly, foreign_keys, remote_dest and all that jazz, to no avail so far

[sqlalchemy] Specifying Foreign Keys not enough for join

2009-06-01 Thread George Sakkis
I'm trying to use the primaryjoin/foreign_keys parameters (http:// www.sqlalchemy.org/docs/05/mappers.html#specifying-foreign-keys) to specify a relation between tables that don't have explicit foreign keys but apparently it's not enough for join() to figure it out: from sqlalchemy.orm import

[sqlalchemy] Re: Specifying Foreign Keys not enough for join

2009-06-01 Thread George Sakkis
On Jun 1, 3:34 pm, Michael Bayer mike...@zzzcomputing.com wrote: George Sakkis wrote: I'm trying to use the primaryjoin/foreign_keys parameters (http:// www.sqlalchemy.org/docs/05/mappers.html#specifying-foreign-keys) to specify a relation between tables that don't have explicit foreign

[sqlalchemy] Relation spanning multiple tables

2009-06-01 Thread George Sakkis
I can't for the life of me figure out how to specify a relation spanning 3 tables. I think I've tried all combinations of primaryjoin, secondaryjoin, viewonly, foreign_keys, remote_dest and all that jazz, to no avail so far. If this is possible at all, there should be a sample usage at the docs

[sqlalchemy] Bulk insert on related tables

2009-03-23 Thread George Sakkis
I've been trying to speed up a bulk insert process that currently seems too slow. I've read the past threads about how to replace the orm/session based inserts with table.insert().execute(*valuedicts) but in my case the objects are related (via 1-to-many relations if it makes a difference). In

[sqlalchemy] Re: FlushError (unsaved, pending instance and is an orphan)

2007-04-06 Thread George Sakkis
On Apr 6, 2:52 am, svilen [EMAIL PROTECTED] wrote: what's your mappers? many2one/one2many relations etc? I expected that I can create a parent-child link either from parent to child (by appending to ranker.results) or from child to parent (as above), but apparently the latter doesn't

[sqlalchemy] FlushError (unsaved, pending instance and is an orphan)

2007-04-05 Thread George Sakkis
I'm using SA (with Elixir on top) and I have a parent Entity Ranker that has many children Results; that is, for a Ranker instance rk, rk.results gives its children and for a Result rs, rs.ranker gives its parent. When I add new children by providing the parent to the constructor of the child

[sqlalchemy] Stored procedures

2006-10-17 Thread George Sakkis
Is there a way to call a stored procedure from sqlalchemy and access the returned result set ? If it makes a difference, I'm specifically interested in MySQL stored procedures. What I want to do is use this result set as part of another query, but MySQL doesn't currently allow treating a stored

[sqlalchemy] Re: Stored procedures

2006-10-17 Thread George Sakkis
Michael Bayer wrote: the func keyword is used for stored procedures. in the latest trunk, you can also create table-like elements out of funcs to support multi-column stored procedures, and you can create the SQL corresponding to the patterns you describe. That's pretty cool, too bad I