Re: [sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 11:57 PM, Bao Niu wrote: > Please allow me to clarify here. So if attributes on source object u are > different from attributes loaded from database, database will always prevail? > I thought the source object u should represent newer version of the data, > shouldn't it?

Re: [sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Bao Niu
Please allow me to clarify here. So if attributes on source object u are different from attributes loaded from database, database will always prevail? I thought the source object u should represent newer version of the data, shouldn't it? On Wed, Feb 19, 2014 at 7:21 AM, Michael Bayer wrote: > >

[sqlalchemy] SQLAlchemy 0.8.5 Released

2014-02-19 Thread Michael Bayer
Hey list - SQLAlchemy release 0.8.5 is now available. Release 0.8.5 is a bugfix release which includes a wide array of fixes backported from the 0.9 series. Both 0.8.5 and 0.9.3 are being released simultaneously to resolve a concurrency-related regression introduced in version 0.8.4, which can

[sqlalchemy] SQLAlchemy 0.9.3 Released

2014-02-19 Thread Michael Bayer
Hey list - SQLAlchemy release 0.9.3 is now available. Release 0.9.3 includes a wide array of bugfixes and a few new features. A critical subset of these fixes are also backported to release 0.8.5. Both 0.9.3 and 0.8.5 are being released simultaneously to resolve a concurrency-related regressio

Re: [sqlalchemy] Measure time to checkout a connection from the pool

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 9:27 PM, Shahaf Abileah wrote: > Hello, > > I'd like to measure how much time my code spends waiting to check out a > connection from the pool. Why? Because I suspect that I have too many > workers and not enough connections in the pool, and I'd like to gather some > ha

[sqlalchemy] Measure time to checkout a connection from the pool

2014-02-19 Thread Shahaf Abileah
Hello, I'd like to measure how much time my code spends waiting to check out a connection from the pool. Why? Because I suspect that I have too many workers and not enough connections in the pool, and I'd like to gather some hard numbers to prove my theory one way or the other. I see that th

Re: [sqlalchemy] Re: SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Jonathan Vanasco
Wow! Thanks. This is by far, the best written and more informative stuff I've read on this. I've been considering switching to AWS sooner-than-later for the RDS ( we bootstrapped on Linode with a plan to redeploy on AWS in the future ) , but it looks like we shouldn't pursue that yet! On Wed

Re: [sqlalchemy] Relationship issue with composite foreign key

2014-02-19 Thread Mariano Mara
On 19/02/14 16:01, Michael Bayer wrote: On Feb 19, 2014, at 1:34 PM, Mariano Mara wrote: On 19/02/14 15:28, Michael Bayer wrote: On Feb 19, 2014, at 1:14 PM, Mariano Mara wrote: # relationships runner = relationship("User", foreign_keys=[uid, oid], #

Re: [sqlalchemy] Relationship issue with composite foreign key

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 1:34 PM, Mariano Mara wrote: > > > On 19/02/14 15:28, Michael Bayer wrote: >> >> On Feb 19, 2014, at 1:14 PM, Mariano Mara wrote: >> >>># relationships >>>runner = relationship("User", foreign_keys=[uid, oid], >>> #primaryjoin=and_("Bet.u

Re: [sqlalchemy] HSTORE intermittent bug

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 1:28 PM, a...@bitcredits.io wrote: > Hi there, > > I've been hitting an intermittent bug with SQLAlchemy/PostgreSQL using an > HSTORE column. Some times, when I restart my process (pyramid over gevent > over chaussette), I get a spew of such errors... some other time, ever

Re: [sqlalchemy] Sharding without the ORM

2014-02-19 Thread Silviu Dicu
yes - if something is built in already. On Wednesday, 19 February 2014 12:46:48 UTC-5, Klauss wrote: > On Wed, Feb 19, 2014 at 1:03 PM, Silviu Dicu > > > wrote: > > Hi, > > > > I have a legacy application that doesn't use the ORM but I need to > implement > > horizantal sharding on mysql.

[sqlalchemy] tying multiple sessions together with one transaction

2014-02-19 Thread Chris Withers
Hi All, My other usual question now ;-) I have multiple databases that I'm connecting to from my application. I need to commit or rollback a single transaction across all of them. So, two phase commit, right? Okay, but how do I tie the sessions together? What and how do I call commit? Is th

Re: [sqlalchemy] Relationship issue with composite foreign key

2014-02-19 Thread Mariano Mara
On 19/02/14 15:28, Michael Bayer wrote: On Feb 19, 2014, at 1:14 PM, Mariano Mara wrote: # relationships runner = relationship("User", foreign_keys=[uid, oid], #primaryjoin=and_("Bet.uid==User.uid", "Bet.oid==User.oid"), ) loa

[sqlalchemy] HSTORE intermittent bug

2014-02-19 Thread alex
Hi there, I've been hitting an intermittent bug with SQLAlchemy/PostgreSQL using an HSTORE column. Some times, when I restart my process (pyramid over gevent over chaussette), I get a spew of such errors... some other time, everything goes just fine. It seems this bug hasn't been documented a

Re: [sqlalchemy] Relationship issue with composite foreign key

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 1:14 PM, Mariano Mara wrote: ># relationships >runner = relationship("User", foreign_keys=[uid, oid], > #primaryjoin=and_("Bet.uid==User.uid", > "Bet.oid==User.oid"), > ) >loader = relationship("User", foreign_key

[sqlalchemy] Relationship issue with composite foreign key

2014-02-19 Thread Mariano Mara
Hi everyone, I am hitting an error while defining a relationship with a parent table with a composite primary key (my child class has two attributes that point to the same parent class -with a composite pk- but both relationships are properly defined with the 'foreign_keys' parameter): I am not

Re: [sqlalchemy] Sharding without the ORM

2014-02-19 Thread Claudio Freire
On Wed, Feb 19, 2014 at 1:03 PM, Silviu Dicu wrote: > Hi, > > I have a legacy application that doesn't use the ORM but I need to implement > horizantal sharding on mysql. > Did anybody has done something similar or have any ideas. You mean besides manually computing a consistent hash and binding

[sqlalchemy] Sharding without the ORM

2014-02-19 Thread Silviu Dicu
Hi, I have a legacy application that doesn't use the ORM but I need to implement horizantal sharding on mysql. Did anybody has done something similar or have any ideas. thanks! -silviu ps: the examples I've seen are using orm (examples/sharding/attribute_shard.py -- You received this me

Re: [sqlalchemy] SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Michael Bayer
I got it, this is a regression due to #2880. On Feb 19, 2014, at 10:15 AM, Robert Forkel wrote: > FWIW I'm seeing not reproducible UnicodeEncodeErrors in my production > systems, too. Alas only on ones with heavier load, and also with sqlalchemy > 0.7.9. > > > On Wed, Feb 19, 2014 at 3:45 P

Re: [sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 10:01 AM, Bao Niu wrote: > Thanks for replying. Isn't it the case when I just provide a primary key for > the source object, the attribute shoul be marked expired on the target > instance? > no because the target instance a product of either a. essentially loaded by sess

Re: [sqlalchemy] SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Robert Forkel
FWIW I'm seeing not reproducible UnicodeEncodeErrors in my production systems, too. Alas only on ones with heavier load, and also with sqlalchemy 0.7.9. On Wed, Feb 19, 2014 at 3:45 PM, Michael Bayer wrote: > > On Feb 19, 2014, at 3:03 AM, Valentino Volonghi > wrote: > > > > >> 4. is this error

Re: [sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Bao Niu
Thanks for replying. Isn't it the case when I just provide a primary key for the source object, the attribute shoul be marked expired on the target instance? In my example I only give the object u a primary key value, so the newly created object should be an object that only has a primary key value

Re: [sqlalchemy] SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 3:03 AM, Valentino Volonghi wrote: > >> 4. is this error only under load ? >> >> it may be the issue noted by Jeff in another email, or not. > > Nah, this issue is all the time, with or without load and we applied > Jeff fix and so far, early to say as it's a race conditio

Re: [sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Michael Bayer
On Feb 19, 2014, at 6:08 AM, Bao Niu wrote: > I thought I understood the behaviour of session.merge() from reading the > documentation, but I'm wrong. Here is an example. I have codes below, > > class User(Base): > __tablename__ = 'user' > id = Column(Integer, primary_key=True) > n

[sqlalchemy] So session.merge() does not automatically do .add()?

2014-02-19 Thread Bao Niu
I thought I understood the behaviour of session.merge() from reading the documentation, but I'm wrong. Here is an example. I have codes below, class User(Base): > __tablename__ = 'user' > id = Column(Integer, primary_key=True) > name = Column(String(50), nullable=False) > addresse

Re: [sqlalchemy] Is there a way to examine how many objects a session currently contains?

2014-02-19 Thread Gunnlaugur Thor Briem
Hi, read the section Session Attributes. You might just need something like len(session.identity_map) + len(session.new) ... but there are some caveats, involving exactly what you mean by the session

[sqlalchemy] Is there a way to examine how many objects a session currently contains?

2014-02-19 Thread Bao Niu
I've looked through the documentation on session, however I didn't seem to be able to locate a method that allows me to list all the objects a session currently is holding. Could someone point out a tip? Many thanks. -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Issue with cx_oracle

2014-02-19 Thread Christoph Zwerschke
Am 18.02.2014 23:20, schrieb Michael Bayer: > good catch, I've rewritten the docs here: > http://docs.sqlalchemy.org/en/latest/dialects/oracle.html#unicode. > The more common approach of using text() is included. Thanks a lot for the quick reponse and explanations. Your recipe of specifying colu

Re: [sqlalchemy] Re: SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Valentino Volonghi
On Tue, Feb 18, 2014 at 4:11 PM, Jonathan Vanasco wrote: > I just want to bring this up, because the Pylons/Pyramid error reporting -- > and the SqlAlchemy reporting -- can often make an error look to be in a > different spot than it really is It looks like it might be what Jeff was talking abou

Re: [sqlalchemy] SQLAlchemy 0.9.2 UnicodeEncodeErrors with PG 9.3.2 on Amazon RDS

2014-02-19 Thread Valentino Volonghi
On Tue, Feb 18, 2014 at 4:08 PM, Michael Bayer wrote: > OK some questions: > > 1. what options are you passing to create_engine()? sqlalchemy.default.url = postgresql://DBNAME:DBPASS@DBADDRESS/DBNAME sqlalchemy.default.client_encoding=utf8 sqlalchemy.default.pool_recycle = 3600 sqlalchemy.defaul