[sqlalchemy] Reflect class sorting based on __mapper_args__['order_by']

2013-02-15 Thread Moritz Schlarb
Hi there, I'd like to be able to run sorted() on a list of model objects without class-specific code which sorts based on what's specified in __mapper_args__['order_by']. To do that, I would add __lt__(), __le__(), __gt__(), and/or __ge__() to the declarative base class, which try to get the

[sqlalchemy] How Do I improve performance for inserts.

2013-02-15 Thread Jan Palach
Hi everyone, first of all sorry my english :), this is my first email in this mainlist. My name is Jan Palach I'm from Brazil and i'm novice in SQLALchemy ecosystem. I'm testing the combination PostgreSQL + SQLAlchemy(using psycopg2) and CPython 2.x, to create a database layer for backend

[sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
Hello, I'm trying to upgrade a rather big webapp from 0.7.10 to 0.8.0b2 and I'm facing a strange RuntimeError: maximum recursion depth exceeded error: http://pastebin.ca/2314149 Any idea what could be wrong? (I'll start digging but I would like to avoid a loss of time if it's just a simple

Re: [sqlalchemy] Is this the right way to do a timestamp filter against CURRENT_TIMESTAMP in postgres ?

2013-02-15 Thread Michael Bayer
func.current_timestamp() would be idiomatic here, that object isn't present in the expression module itself (at least in tip). On Feb 14, 2013, at 5:16 PM, Jonathan Vanasco jonat...@findmeon.com wrote: i think this is right... query= dbSession.query( model.Post )\ filter_by(

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Michael Bayer
something to do with your mappings and likely lots of eager loads. I'd try tip just to confirm, and seems like a regression, so if you can try to reproduce with a test case that would be helpful. On Feb 15, 2013, at 9:04 AM, Julien Cigar jci...@ulb.ac.be wrote: Hello, I'm trying to

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
I forgot to add my mappers definition: http://pastie.org/6176391 On 02/15/2013 15:04, Julien Cigar wrote: Hello, I'm trying to upgrade a rather big webapp from 0.7.10 to 0.8.0b2 and I'm facing a strange RuntimeError: maximum recursion depth exceeded error: http://pastebin.ca/2314149 Any idea

[sqlalchemy] Potential Bug in 0.8b2

2013-02-15 Thread Chris
Hi The following fails to work in 0.8b2 (Works fine in 0.7.9) pp = aliased(PublicationPrice, name=pp) ppp= aliased(PublicationPrices, name=ppp) session.query(pp, ppp).\ join(ppp, ppp.id == pp.publicationpricesid).\ filter(pp.publicationid == publicationid).all() It generates the following SQL

Re: [sqlalchemy] corresponding attribute not updated

2013-02-15 Thread Michael Bayer
On Feb 14, 2013, at 5:18 PM, ru...@yahoo.com wrote: What is the best way to get the .Person attribute updated to match a new value assigned to .person? items = session.query(Task).order_by(Task.id).all() print ('before change:\n', str(items[0].t2p_[0]), '\n Person =',

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
I'll give a try with tip .. :) btw the old svn url is still used while fetching sqlalchemy==dev: (amnesia)jcigar@dev pip install -U sqlalchemy==dev ~/projects/amnesia Downloading/unpacking sqlalchemy==dev Error urlopen error [Errno 8] hostname nor servname provided, or not known while

Re: [sqlalchemy] Reflect class sorting based on __mapper_args__['order_by']

2013-02-15 Thread Michael Bayer
On Feb 15, 2013, at 5:23 AM, Moritz Schlarb mosch...@metalabs.de wrote: Hi there, I'd like to be able to run sorted() on a list of model objects without class-specific code which sorts based on what's specified in __mapper_args__['order_by']. To do that, I would add __lt__(),

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Julien Cigar
Same with tip, except that I get a RuntimeError: maximum recursion depth exceeded in cmp instead: 'http://pastebin.ca/2314168 I'll dig a little more tonight ... On 02/15/2013 15:49, Julien Cigar wrote: I'll give a try with tip .. :) btw the old svn url is still used while fetching

Re: [sqlalchemy] How Do I improve performance for inserts.

2013-02-15 Thread Michael Bayer
I wrote a detailed answer to a previous question including examples for all allowed styles of INSERT on SO here: http://stackoverflow.com/questions/11769366/why-is-sqlalchemy-insert-with-sqlite-25-times-slower-than-using-sqlite3-directly/11769768#11769768. Though it seems you're familiar with

Re: [sqlalchemy] trying 0.8.0b2

2013-02-15 Thread Michael Bayer
thanks, but you have to distill this down into something I can run, without all the amnesia imports, thanks. On Feb 15, 2013, at 9:33 AM, Julien Cigar jci...@ulb.ac.be wrote: I forgot to add my mappers definition: http://pastie.org/6176391 On 02/15/2013 15:04, Julien Cigar wrote: Hello,

Re: [sqlalchemy] Potential Bug in 0.8b2

2013-02-15 Thread Michael Bayer
Can I please get mapper definitions for this so that I can actually run this example, thanks. Also make sure the issue still remains in current tip. On Feb 15, 2013, at 9:34 AM, Chris chris.g@gmail.com wrote: Hi The following fails to work in 0.8b2 (Works fine in 0.7.9) pp =

Re: [sqlalchemy] How Do I improve performance for inserts.

2013-02-15 Thread Jan Palach
Thanks Mr. Michael, I will make changes in my code to reflect your tips and I will analyse the results. Thanks a lot. Att, Jan Palach -- See my linkedin: http://www.linkedin.com/pub/jan-palach/16/b1a/7a3 On Feb 15, 2013, at 1:11 PM, Michael Bayer mike...@zzzcomputing.com

[sqlalchemy] Re: Is this the right way to do a timestamp filter against CURRENT_TIMESTAMP in postgres ?

2013-02-15 Thread Jonathan Vanasco
ok. is from sqlalchemy.sql import func still the recommended import ? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com.

Re: [sqlalchemy] Is this the right way to do a timestamp filter against CURRENT_TIMESTAMP in postgres ?

2013-02-15 Thread Michael Bayer
or just from sqlalchemy import func sure On Feb 15, 2013, at 11:14 AM, Jonathan Vanasco jonat...@findmeon.com wrote: ok. is from sqlalchemy.sql import func still the recommended import ? -- You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Is this the right way to do a timestamp filter against CURRENT_TIMESTAMP in postgres ?

2013-02-15 Thread Jonathan Vanasco
On Feb 15, 11:17 am, Michael Bayer mike...@zzzcomputing.com wrote: or just from sqlalchemy import func sure thanks. friday is try to pay off technical debt day. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

[sqlalchemy] Many to One using Different Modules

2013-02-15 Thread Arkilic, Arman
Hi, I am quite new to sqlalchemy. I am trying to implement a many-to-one relationship between classes in different modules. I was able to get this to work when classes are inside the same module however when I put the classes in different modules I get import errors. I made sure I used strings

Re: [sqlalchemy] Many to One using Different Modules

2013-02-15 Thread Michael Bayer
in Python, this is called a circular module import: lattice_definition.py: from Irmis.model_definition import model model_definition.py: from Irmis.lattice_definition import Base from Irmis.lattice_definition import lattice both modules are dependent on each other: lattice_definition ---