Re: [sqlalchemy] Order by the sequence in_ ?

2012-01-03 Thread Vlad K.
Thanks, I think that's exactly what I was looking for! .oO V Oo. On 12/28/2011 06:10 PM, Michael Bayer wrote: On Dec 27, 2011, at 8:37 PM, Vlad K. wrote: Hi all. I need to select some rows where pkey is in a sequence. How do I order by that very sequence? images_all =

[sqlalchemy] Inserting when the row depends on id generated by the same transaction.

2012-01-03 Thread Thiago de Arruda
I need to implement a simple accounting subsytem that will record all the transactions for future auditing. This uses two tables: 'transactions' and 'entries'. Transaction-Entry is a parent-child relationship. My customer has two requeriments : All the records(entries/transaction) must be

Re: [sqlalchemy] cascade delete in relationship and session.execute(table.update())

2012-01-03 Thread Michael Bayer
On Jan 2, 2012, at 4:06 PM, Wubin wrote: class Product(PolymorphicClass): #there are different types of the product __tablename__ = products id = Column(id, Integer, primary_key=True, key=id) name = Column(name, String(50), unique=True, nullable=False) storeId

Re: [sqlalchemy] Inserting when the row depends on id generated by the same transaction.

2012-01-03 Thread Michael Bayer
On Jan 3, 2012, at 9:52 AM, Thiago de Arruda wrote: I need to implement a simple accounting subsytem that will record all the transactions for future auditing. This uses two tables: 'transactions' and 'entries'. Transaction-Entry is a parent-child relationship. My customer has two

Re: [sqlalchemy] Inserting when the row depends on id generated by the same transaction.

2012-01-03 Thread Thiago Padilha
On Tue, Jan 3, 2012 at 1:18 PM, Michael Bayer mike...@zzzcomputing.com wrote: Not sure what the issue is for the first aspect here, do you just need to call Session.flush() ?   http://www.sqlalchemy.org/docs/orm/session.html#flushing That's exactly what I need to do :) This is a common

Re: [sqlalchemy] Inserting when the row depends on id generated by the same transaction.

2012-01-03 Thread Michael Bayer
On Jan 3, 2012, at 1:17 PM, Thiago Padilha wrote: It's nice to see sqlalchemy provides a way to hold database locks. This is a good option but my customer didn't like this since he believes his system will be highly concurrent. I will just use another temporary table for fast

[sqlalchemy] 'TypeError: expecting numeric data' is only raised for do_executemany

2012-01-03 Thread Kent
The statements that are executed as a single statement make no such check (and the database engine correctly translates a string to integer), but cursor.executemany checks type: lib/sqlalchemy/engine/default.py, line 327, in do_executemany cursor.executemany(statement, parameters) TypeError:

[sqlalchemy] Re: 'TypeError: expecting numeric data' is only raised for do_executemany

2012-01-03 Thread Kent
Oh. Makes sense. Then the only reason I'm starting to hit this is that you've optimized the orm to use executemany() more often, correct? On Jan 3, 3:09 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 3, 2012, at 1:58 PM, Kent wrote: The statements that are executed as a single

Re: [sqlalchemy] Re: 'TypeError: expecting numeric data' is only raised for do_executemany

2012-01-03 Thread Michael Bayer
On Jan 3, 2012, at 3:20 PM, Kent wrote: Oh. Makes sense. Then the only reason I'm starting to hit this is that you've optimized the orm to use executemany() more often, correct? that it does, yes. On Jan 3, 3:09 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 3, 2012, at

[sqlalchemy] column_property and class Mixin problem

2012-01-03 Thread sector119
Hello. Can't get this to work, I want to get users who is online - users where last_read column = now() - 30 minutes With DBSession.query(User).filter(User.is_online) query But get the following error: File /home/eps/devel/tourclub/pbb/pbb/models/__init__.py, line 147, in module class

Re: [sqlalchemy] column_property and class Mixin problem

2012-01-03 Thread Michael Bayer
On Jan 3, 2012, at 3:31 PM, sector119 wrote: Hello. Can't get this to work, I want to get users who is online - users where last_read column = now() - 30 minutes With DBSession.query(User).filter(User.is_online) query But get the following error: File

Re: [sqlalchemy] column_property and class Mixin problem

2012-01-03 Thread sector119
Now I get File /home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/visitors.py, line 59, in _compiler_dispatch return getter(visitor)(self, **kw) File /home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/compiler.py, line 370, in visit_column raise exc.CompileError(Cannot

Re: [sqlalchemy] column_property and class Mixin problem

2012-01-03 Thread Michael Bayer
On Jan 3, 2012, at 4:14 PM, sector119 wrote: Now I get File /home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/visitors.py, line 59, in _compiler_dispatch return getter(visitor)(self, **kw) File /home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/compiler.py, line 370,

[sqlalchemy] Re: column_property and class Mixin problem

2012-01-03 Thread sector119
Thanks a lot, Michael! Works like a charm! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/W6s3M_bzrRAJ. To post to this group, send email to

[sqlalchemy] Is there a way to accrue all references to a declarative mapped object?

2012-01-03 Thread Jackson, Cameron
I have a relatively complex structure to my data. In essence it's something like: * A Foo is a small object containing some data. * A Bar has a fixed number of (say, 3) references to Foos * A Baz has a single Bar, plus one additional Foo * A Qux has a single

[sqlalchemy] RE: Is there a way to accrue all references to a declarative mapped object?

2012-01-03 Thread Jackson, Cameron
In case anyone was going to attempt to solve this, I have come up with a better way to approach the problem. The data is still structured the same way, but I am now going to traverse it in a different way, such that I no longer need a Foo to be aware of everywhere it is being referenced from.